diff --git a/src/elo.rs b/src/elo.rs index ca6eaff..9d10632 100644 --- a/src/elo.rs +++ b/src/elo.rs @@ -20,38 +20,29 @@ pub fn run() { max_arena_size: usize::MAX, do_not_prune: true, print: false, - children_eval_method: ChildrenEvalMethod::Max, + children_eval_method: ChildrenEvalMethod::Average, }; - let vec: Vec<(String, Box Box>)> = (1..=6) - .flat_map(|d| { - [ - ChildrenEvalMethod::Average, - // ChildrenEvalMethod::Max, - // ChildrenEvalMethod::Min, - ] - .into_iter() - .map(move |m| -> (String, Box Box>) { - ( - format!("ComplexAgentD{}{:?}", d, m), - Box::new(move |piece| { - Box::new(ComplexAgent::new( - piece, - FutureMoveConfig { - max_depth: d, - children_eval_method: m, - ..FMV_BASE - }, - )) - }), - ) - }) + let vec: Vec<(String, Box Box>)> = (3..=6) + .map(move |d| -> (String, Box Box>) { + ( + format!("ComplexAgentD{}", d), + Box::new(move |piece| { + Box::new(ComplexAgent::new( + piece, + FutureMoveConfig { + max_depth: d, + ..FMV_BASE + }, + )) + }), + ) }) .collect(); let mut arena = PlayerArena::new(vec); - arena.prop_arena(300); + arena.prop_arena(10); println!("{}", arena); } diff --git a/src/main.rs b/src/main.rs index 680b164..c870b35 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,3 @@ -use elo::run; use game::Game; use logic::{ChildrenEvalMethod, FutureMoveConfig}; use repr::Piece; @@ -13,8 +12,8 @@ pub mod repr; // TODO! make this agent configuration a config option via `clap-rs` fn main() { - run(); - return; + // elo::run(); + // return; let player1 = complexagent::ComplexAgent::new( Piece::Black, FutureMoveConfig { @@ -25,7 +24,7 @@ fn main() { max_arena_size: 100_000_000, do_not_prune: false, print: true, - children_eval_method: ChildrenEvalMethod::Max, + children_eval_method: ChildrenEvalMethod::Average, }, ); // let player2 = complexagent::ComplexAgent::new( diff --git a/src/repr/bitboard.rs b/src/repr/bitboard.rs index 8ff2b63..521211e 100644 --- a/src/repr/bitboard.rs +++ b/src/repr/bitboard.rs @@ -3,7 +3,6 @@ use super::{ coords::{CoordPair, CoordPairInner}, CoordAxis, }; -use num::PrimInt; use static_assertions::const_assert; #[cfg(not(feature = "bitvec"))] @@ -155,14 +154,13 @@ mod test { #[test] fn set_and_get() { let mut b = BitBoard::new(); - for i in 0..Board::BOARD_SIZE { - for j in 0..Board::BOARD_SIZE { - assert!( - !b.get((i, j).into()), - "A just-initalized BitBoard should be completely empty" - ) - } + for c in 0..Board::BOARD_AREA { + assert!( + !b.get(CoordPair(c)), + "A just-initalized BitBoard should be completely empty" + ) } + assert!(!b.get((2, 4).into())); b.set((2, 4).into(), true); assert!(b.get((2, 4).into())); diff --git a/src/repr/board.rs b/src/repr/board.rs index d3fba1a..9c8a124 100644 --- a/src/repr/board.rs +++ b/src/repr/board.rs @@ -144,22 +144,11 @@ impl Board { /// Starting position pub fn starting_pos(mut self) -> Self { - self.place_unchecked( - ((Self::BOARD_SIZE / 2) - 1, (Self::BOARD_SIZE / 2) - 1).into(), - Piece::White, - ); - self.place_unchecked( - (Self::BOARD_SIZE / 2, (Self::BOARD_SIZE / 2) - 1).into(), - Piece::Black, - ); - self.place_unchecked( - ((Self::BOARD_SIZE / 2) - 1, Self::BOARD_SIZE / 2).into(), - Piece::Black, - ); - self.place_unchecked( - (Self::BOARD_SIZE / 2, Self::BOARD_SIZE / 2).into(), - Piece::White, - ); + let hf = Self::BOARD_SIZE / 2; + self.place_unchecked((hf - 1, hf - 1).into(), Piece::White); + self.place_unchecked((hf, hf - 1).into(), Piece::Black); + self.place_unchecked((hf - 1, hf).into(), Piece::Black); + self.place_unchecked((hf, hf).into(), Piece::White); self }