reduce size of ints that represent value

This commit is contained in:
2025-03-06 15:39:40 -05:00
parent 38ada710d9
commit 945ec934f5
3 changed files with 11 additions and 11 deletions

View File

@@ -23,10 +23,10 @@ pub struct Move {
pub tried_children: bool,
/// Value of this move (including children)
pub value: Option<i128>,
pub value: Option<i32>,
/// What is the inherit value of this move (not including children)
pub self_value: i64,
pub self_value: i16,
/// Which color made a move on this move?
pub color: Piece,
@@ -55,15 +55,15 @@ impl Move {
m
}
fn compute_self_value(&self, agent_color: Piece) -> i64 {
fn compute_self_value(&self, agent_color: Piece) -> 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.
// We shouldn't prune branches because we still need to always react to the opponent's moves
return i64::MIN + 1;
return i16::MIN + 1;
} else if self.winner == Winner::Player(agent_color) {
// results in a win for the agent
return i64::MAX - 1;
return i16::MAX - 1;
}
// else if self.winner == Winner::Tie {
// // idk what a Tie should be valued?