board_game/ai/mod.rs
1use crate::board::{Board, BoardDone};
2
3pub mod mcts;
4pub mod minimax;
5pub mod simple;
6pub mod solver;
7
8pub trait Bot<B: Board> {
9 /// Pick a move to play.
10 ///
11 /// `self` is mutable to allow for random state, this method is not supposed to
12 /// modify `self` in any other significant way.
13 fn select_move(&mut self, board: &B) -> Result<B::Move, BoardDone>;
14}
15
16impl<B: Board, F: FnMut(&B) -> Result<B::Move, BoardDone>> Bot<B> for F {
17 fn select_move(&mut self, board: &B) -> Result<B::Move, BoardDone> {
18 self(board)
19 }
20}