small rewrite and addition of by_depth + by_depth_test
This commit is contained in:
@@ -23,7 +23,7 @@ pub struct Move {
|
||||
pub children: Vec<usize>,
|
||||
|
||||
/// Value of this move (including children)
|
||||
pub value: i128,
|
||||
pub value: Option<i128>,
|
||||
|
||||
/// What is the inherit value of this move (not including children)
|
||||
pub self_value: i64,
|
||||
@@ -31,8 +31,8 @@ pub struct Move {
|
||||
/// Which color made a move on this move?
|
||||
pub color: Piece,
|
||||
|
||||
/// Should the children of this move be lazily generated?
|
||||
pub lazy_children: bool,
|
||||
/// Was this child lazily created? (it will have delayed child generation)
|
||||
pub is_lazy: bool,
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
@@ -45,7 +45,6 @@ impl Move {
|
||||
j: usize,
|
||||
board: Board,
|
||||
color: Piece,
|
||||
lazy_children: bool,
|
||||
agent_color: Piece,
|
||||
parent: Option<usize>,
|
||||
) -> Self {
|
||||
@@ -56,13 +55,13 @@ impl Move {
|
||||
winner: board.game_winner(),
|
||||
parent,
|
||||
children: Vec::new(),
|
||||
value: 0,
|
||||
value: None,
|
||||
color,
|
||||
lazy_children,
|
||||
is_lazy: false,
|
||||
self_value: 0,
|
||||
};
|
||||
m.self_value = m.compute_self_value(agent_color);
|
||||
m.value = m.self_value as i128;
|
||||
m.value = Some(m.self_value as i128);
|
||||
m
|
||||
}
|
||||
|
||||
@@ -79,11 +78,14 @@ impl Move {
|
||||
} else if self.winner == Winner::Player(agent_color) {
|
||||
// results in a win for the agent
|
||||
return i64::MAX - 1;
|
||||
} else if self.winner == Winner::Tie {
|
||||
// idk what a Tie should be valued?
|
||||
return 0;
|
||||
}
|
||||
// else if self.winner == Winner::Tie {
|
||||
// // idk what a Tie should be valued?
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
// I guess ignore Ties here, don't give them an explicit value,
|
||||
// because even in the case of ties, we want to have a higher score
|
||||
BVM.board_value(&self.board, agent_color)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user