value changes
This commit is contained in:
parent
3b07a67d2e
commit
8de01ffd57
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user