a
This commit is contained in:
parent
ee70413bcf
commit
ea7df6a739
19
src/elo.rs
19
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<dyn Fn(Piece) -> Box<dyn Agent>>)> = (1..=6)
|
||||
.flat_map(|d| {
|
||||
[
|
||||
ChildrenEvalMethod::Average,
|
||||
// ChildrenEvalMethod::Max,
|
||||
// ChildrenEvalMethod::Min,
|
||||
]
|
||||
.into_iter()
|
||||
.map(move |m| -> (String, Box<dyn Fn(Piece) -> Box<dyn Agent>>) {
|
||||
let vec: Vec<(String, Box<dyn Fn(Piece) -> Box<dyn Agent>>)> = (3..=6)
|
||||
.map(move |d| -> (String, Box<dyn Fn(Piece) -> Box<dyn Agent>>) {
|
||||
(
|
||||
format!("ComplexAgentD{}{:?}", d, m),
|
||||
format!("ComplexAgentD{}", d),
|
||||
Box::new(move |piece| {
|
||||
Box::new(ComplexAgent::new(
|
||||
piece,
|
||||
FutureMoveConfig {
|
||||
max_depth: d,
|
||||
children_eval_method: m,
|
||||
..FMV_BASE
|
||||
},
|
||||
))
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
|
||||
let mut arena = PlayerArena::new(vec);
|
||||
|
||||
arena.prop_arena(300);
|
||||
arena.prop_arena(10);
|
||||
|
||||
println!("{}", arena);
|
||||
}
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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 {
|
||||
for c in 0..Board::BOARD_AREA {
|
||||
assert!(
|
||||
!b.get((i, j).into()),
|
||||
!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()));
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user