logical improvements and cleanup
This commit is contained in:
@@ -24,9 +24,11 @@ pub struct Move {
|
||||
/// Indices of this Move's Children
|
||||
pub children: Vec<usize>,
|
||||
|
||||
/// Value of this move
|
||||
/// Value of this move (including children)
|
||||
pub value: i64,
|
||||
|
||||
pub self_value: i64,
|
||||
|
||||
pub color: Piece,
|
||||
|
||||
pub lazy_children: bool,
|
||||
@@ -37,6 +39,32 @@ lazy_static! {
|
||||
}
|
||||
|
||||
impl Move {
|
||||
pub fn new(
|
||||
i: usize,
|
||||
j: usize,
|
||||
board: Board,
|
||||
color: Piece,
|
||||
lazy_children: bool,
|
||||
agent_color: Piece,
|
||||
parent: Option<usize>,
|
||||
) -> Self {
|
||||
let mut m = Move {
|
||||
i,
|
||||
j,
|
||||
board,
|
||||
winner: board.game_winner(),
|
||||
parent,
|
||||
children: Vec::new(),
|
||||
value: 0,
|
||||
color,
|
||||
lazy_children,
|
||||
self_value: 0,
|
||||
};
|
||||
m.self_value = m.compute_self_value(agent_color);
|
||||
m.value = m.self_value;
|
||||
m
|
||||
}
|
||||
|
||||
pub const fn coords(&self) -> (usize, usize) {
|
||||
(self.i, self.j)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user