Crates.io | board-game |
lib.rs | board-game |
version | 0.8.2 |
source | src |
created_at | 2021-09-08 19:31:40.074169 |
updated_at | 2023-07-01 20:07:37.814444 |
description | A board game abstraction and generic utilities around it. |
homepage | |
repository | https://github.com/KarelPeeters/board-game-rs |
max_upload_size | |
id | 448599 |
size | 414,636 |
A Board abstraction for deterministic two player games. This allows for code to be generic over the actual game, so it only needs to written once.
Currently, the implemented games are:
Most game implementations are heavily optimized, using bitboards or other techniques where appropriate.
There are also some utility boards:
Utilities in this crate that work for any Board:
This crate is also used as the foundation for kZero, a general AlphaZero implementation.
let mut board = AtaxxBoard::default();
println!("{}", board);
board.available_moves().unwrap().for_each(|mv| {
println!("{:?}", mv)
});
let mv = board.random_available_move(&mut rng).unwrap();
println!("Picked move {:?}", mv);
board.play(mv).unwrap();
println!("{}", board);
let board = AtaxxBoard::default();
println!("{}", board);
let mut bot = MCTSBot::new(1000, 2.0, thread_rng());
println!("{:?}", bot.select_move(&board))