value changes

This commit is contained in:
Simon Gardling 2025-02-20 21:52:15 -05:00
parent 3b07a67d2e
commit 8de01ffd57
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
3 changed files with 7 additions and 9 deletions

View File

@ -192,13 +192,11 @@ impl FutureMoves {
.rev() // rev then reverse so we get an index starting from the back
.enumerate()
// since children are sorted by value, we should weight the first one more
.map(|(i, &child)| self.arena[child].value * (i as i64 + 1))
.sum::<i64>()
.checked_div((&self.arena[idx]).children.len() as i64)
.unwrap_or(0);
.map(|(i, &child)| self.arena[child].value * (i as i128 + 1))
.sum::<i128>();
self.arena[idx].value =
self.arena[idx].self_value / (depth as i64 + 1) + children_value;
(self.arena[idx].self_value / (depth as i64 + 1)) as i128 + children_value;
}
}
}

View File

@ -25,7 +25,7 @@ pub struct Move {
pub children: Vec<usize>,
/// Value of this move (including children)
pub value: i64,
pub value: i128,
pub self_value: i64,
@ -61,7 +61,7 @@ impl Move {
self_value: 0,
};
m.self_value = m.compute_self_value(agent_color);
m.value = m.self_value;
m.value = m.self_value as i128;
m
}

View File

@ -10,8 +10,8 @@ pub mod repr;
fn main() {
let player1 = complexagent::ComplexAgent::new(Piece::Black);
// let player2 = complexagent::ComplexAgent::new(Piece::White);
// let player2 = agent::ManualAgent::new(Piece::White);
let player2 = agent::RandomAgent::new(Piece::White);
let player2 = agent::ManualAgent::new(Piece::White);
// let player2 = agent::RandomAgent::new(Piece::White);
let mut game = Game::new(Box::new(player1), Box::new(player2));
game.game_loop();
}