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