FutureMoves: initial move to not storing board

This commit is contained in:
2025-03-06 16:23:49 -05:00
parent 6958df9df4
commit efd762e5d2
2 changed files with 14 additions and 15 deletions

View File

@@ -7,9 +7,6 @@ pub struct Move {
/// Coordinates (i, j) of the move (if it exists)
pub coord: Option<CoordPair>,
/// [`Board`] state after move is made
pub board: Board,
/// Current winner of the match
pub winner: Winner,
@@ -41,7 +38,6 @@ impl Move {
pub fn new(coord: Option<CoordPair>, board: Board, color: Piece, agent_color: Piece) -> Self {
let mut m = Move {
coord,
board,
winner: board.game_winner(),
parent: None,
children: Vec::new(),
@@ -51,11 +47,11 @@ impl Move {
self_value: 0,
tried_children: false,
};
m.self_value = m.compute_self_value(agent_color);
m.self_value = m.compute_self_value(agent_color, &board);
m
}
fn compute_self_value(&self, agent_color: Piece) -> i16 {
fn compute_self_value(&self, agent_color: Piece, board: &Board) -> i16 {
if self.winner == Winner::Player(!agent_color) {
// if this board results in the opponent winning, MAJORLY negatively weigh this move
// NOTE! this branch isn't completely deleted because if so, the bot wouldn't make a move.
@@ -72,7 +68,7 @@ impl Move {
// 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)
BVM.board_value(board, agent_color)
}
/// Sort children of the [`Move`] by their self_value in `arena`