MinMax is much better
This commit is contained in:
59
src/elo.rs
59
src/elo.rs
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
agent::Agent,
|
||||
agent::{Agent, RandomAgent},
|
||||
complexagent::ComplexAgent,
|
||||
game_inner::GameInner,
|
||||
logic::{ChildrenEvalMethod, FutureMoveConfig},
|
||||
@@ -18,7 +18,7 @@ type AgentMaker = Box<dyn Fn(Piece) -> Box<dyn Agent>>;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn run() {
|
||||
const FMV_BASE: FutureMoveConfig = FutureMoveConfig {
|
||||
let fmv_base = FutureMoveConfig {
|
||||
max_depth: 20,
|
||||
min_arena_depth: 14,
|
||||
top_k_children: 2,
|
||||
@@ -26,26 +26,26 @@ pub fn run() {
|
||||
max_arena_size: usize::MAX,
|
||||
do_prune: false,
|
||||
print: false,
|
||||
children_eval_method: ChildrenEvalMethod::AverageDivDepth,
|
||||
children_eval_method: Default::default(),
|
||||
};
|
||||
|
||||
let configs = [6]
|
||||
.into_iter()
|
||||
.map(move |d| FutureMoveConfig {
|
||||
max_depth: d,
|
||||
..FMV_BASE
|
||||
..fmv_base
|
||||
})
|
||||
.flat_map(move |prev_c| {
|
||||
// create children which enable, and disable pruning
|
||||
[true, false].map(move |do_prune| FutureMoveConfig { do_prune, ..prev_c })
|
||||
})
|
||||
.filter(move |move_c| {
|
||||
if move_c.do_prune {
|
||||
move_c.max_depth >= 8
|
||||
} else {
|
||||
move_c.max_depth < 8
|
||||
}
|
||||
[false].map(move |do_prune| FutureMoveConfig { do_prune, ..prev_c })
|
||||
})
|
||||
// .filter(move |move_c| {
|
||||
// if move_c.do_prune {
|
||||
// move_c.max_depth >= 8
|
||||
// } else {
|
||||
// move_c.max_depth < 8
|
||||
// }
|
||||
// })
|
||||
// .flat_map(move |prev_c| {
|
||||
// [
|
||||
// ChildrenEvalMethod::Average,
|
||||
@@ -64,12 +64,23 @@ pub fn run() {
|
||||
}
|
||||
|
||||
// different values of top_k_children
|
||||
[1, 2, 3]
|
||||
.map(move |top_k_children| FutureMoveConfig {
|
||||
top_k_children,
|
||||
..prev_c
|
||||
})
|
||||
.to_vec()
|
||||
[2].map(move |top_k_children| FutureMoveConfig {
|
||||
top_k_children,
|
||||
..prev_c
|
||||
})
|
||||
.to_vec()
|
||||
})
|
||||
.flat_map(move |prev_c| {
|
||||
[
|
||||
ChildrenEvalMethod::Average,
|
||||
ChildrenEvalMethod::AverageDivDepth,
|
||||
ChildrenEvalMethod::MinAvgDivDepth,
|
||||
ChildrenEvalMethod::MinMax,
|
||||
]
|
||||
.map(move |method| FutureMoveConfig {
|
||||
children_eval_method: method,
|
||||
..prev_c
|
||||
})
|
||||
})
|
||||
.flat_map(move |prev_c| {
|
||||
if !prev_c.do_prune {
|
||||
@@ -79,8 +90,7 @@ pub fn run() {
|
||||
|
||||
// different values to be subtracted from max_depth
|
||||
// to become min_arena_depth
|
||||
[1, 2, 3]
|
||||
.into_iter()
|
||||
[2].into_iter()
|
||||
.filter(|&x| x <= prev_c.max_depth)
|
||||
.map(move |ad_offset| FutureMoveConfig {
|
||||
min_arena_depth: prev_c.max_depth - ad_offset,
|
||||
@@ -95,8 +105,7 @@ pub fn run() {
|
||||
}
|
||||
|
||||
// different values of up_to_minus
|
||||
[prev_c.max_depth, 1, 2, 3]
|
||||
.into_iter()
|
||||
[3].into_iter()
|
||||
.filter(|&x| x <= prev_c.max_depth)
|
||||
.map(move |up_to_minus| FutureMoveConfig {
|
||||
up_to_minus,
|
||||
@@ -105,7 +114,7 @@ pub fn run() {
|
||||
.collect()
|
||||
});
|
||||
|
||||
let vec: Vec<(String, AgentMaker)> = configs
|
||||
let mut vec: Vec<(String, AgentMaker)> = configs
|
||||
.into_iter()
|
||||
.map(move |config| -> (String, AgentMaker) {
|
||||
(
|
||||
@@ -114,6 +123,10 @@ pub fn run() {
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
vec.push((
|
||||
"RandomAgent".to_string(),
|
||||
Box::new(move |piece| Box::new(RandomAgent::new(piece))),
|
||||
));
|
||||
|
||||
let mut arena = PlayerArena::new(vec);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user