//! Use the [`Random`] algorithm for both players in a tic-tac-toe game. use ncpig::prelude::*; use ncpig_testing::tic_tac_toe::*; fn main() -> anyhow::Result<()> { env_logger::init(); let game = TicTacToe; let init_state = TicTacToeState::default(); let user = UserInput::default(); let search = MonteCarloTreeSearch::builder().build::(); let competition = Competition::new(&game, [&search, &user], true); let final_state = competition.play(init_state)?; if game.score(&TicTacToePlayer::X, &final_state)? == game.score(&TicTacToePlayer::O, &final_state)? { println!("Tie!") } else if game.score(&TicTacToePlayer::X, &final_state)? >= game.score(&TicTacToePlayer::O, &final_state)? { println!("X's won!") } else { println!("O's won!") } Ok(()) }