add ChildrenEvalMethod
This commit is contained in:
92
src/elo.rs
92
src/elo.rs
@@ -2,7 +2,7 @@ use crate::{
|
||||
agent::Agent,
|
||||
complexagent::ComplexAgent,
|
||||
game_inner::GameInner,
|
||||
logic::FutureMoveConfig,
|
||||
logic::{ChildrenEvalMethod, FutureMoveConfig},
|
||||
repr::{Board, Piece, Winner},
|
||||
};
|
||||
use rayon::iter::{IntoParallelIterator, ParallelIterator};
|
||||
@@ -20,70 +20,36 @@ pub fn run() {
|
||||
max_arena_size: 1_000_000,
|
||||
do_not_prune: true,
|
||||
print: false,
|
||||
children_eval_method: ChildrenEvalMethod::Max,
|
||||
};
|
||||
|
||||
let mut arena = PlayerArena::new(vec![
|
||||
(
|
||||
"ComplexAgentD1".into(),
|
||||
Box::new(|piece| {
|
||||
Box::new(ComplexAgent::new(
|
||||
piece,
|
||||
FutureMoveConfig {
|
||||
max_depth: 1,
|
||||
..FMV_BASE
|
||||
},
|
||||
))
|
||||
}),
|
||||
),
|
||||
(
|
||||
"ComplexAgentD2".into(),
|
||||
Box::new(|piece| {
|
||||
Box::new(ComplexAgent::new(
|
||||
piece,
|
||||
FutureMoveConfig {
|
||||
max_depth: 2,
|
||||
..FMV_BASE
|
||||
},
|
||||
))
|
||||
}),
|
||||
),
|
||||
(
|
||||
"ComplexAgentD3".into(),
|
||||
Box::new(|piece| {
|
||||
Box::new(ComplexAgent::new(
|
||||
piece,
|
||||
FutureMoveConfig {
|
||||
max_depth: 3,
|
||||
..FMV_BASE
|
||||
},
|
||||
))
|
||||
}),
|
||||
),
|
||||
(
|
||||
"ComplexAgentD4".into(),
|
||||
Box::new(|piece| {
|
||||
Box::new(ComplexAgent::new(
|
||||
piece,
|
||||
FutureMoveConfig {
|
||||
max_depth: 4,
|
||||
..FMV_BASE
|
||||
},
|
||||
))
|
||||
}),
|
||||
),
|
||||
// (
|
||||
// "ComplexAgentD8".into(),
|
||||
// Box::new(|piece| {
|
||||
// Box::new(ComplexAgent::new(
|
||||
// piece,
|
||||
// FutureMoveConfig {
|
||||
// max_depth: 8,
|
||||
// ..FMV_BASE
|
||||
// },
|
||||
// ))
|
||||
// }),
|
||||
// ),
|
||||
]);
|
||||
let vec: Vec<(String, Box<dyn Fn(Piece) -> Box<dyn Agent>>)> = (1..8)
|
||||
.flat_map(|d| {
|
||||
[
|
||||
ChildrenEvalMethod::Average,
|
||||
ChildrenEvalMethod::Max,
|
||||
ChildrenEvalMethod::Min,
|
||||
]
|
||||
.into_iter()
|
||||
.map(move |m| -> (String, Box<dyn Fn(Piece) -> Box<dyn Agent>>) {
|
||||
(
|
||||
format!("ComplexAgentD{}{:?}", d, m),
|
||||
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(1000);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user