mod difficulty;
mod opponent;
mod random_bot;
mod search_bot;
mod tactical_bot;
pub use difficulty::Difficulty;
pub use difficulty::UnknownDifficulty;
pub use opponent::Opponent;
pub use random_bot::RandomBot;
pub use search_bot::SearchBot;
pub use tactical_bot::TacticalBot;
use crate::game::GameState;
use rand::SeedableRng;
use rand::rngs::StdRng;
use std::fmt;
pub trait Bot: fmt::Debug {
fn choose_move(&mut self, state: &GameState) -> Option<usize>;
fn name(&self) -> &'static str {
"Bot"
}
}
impl Bot for Box<dyn Bot> {
fn choose_move(&mut self, state: &GameState) -> Option<usize> {
(**self).choose_move(state)
}
fn name(&self) -> &'static str {
(**self).name()
}
}
pub(crate) fn random_numbers(seed: Option<u64>) -> StdRng {
seed.map_or_else(StdRng::from_os_rng, StdRng::seed_from_u64)
}