major algo improvements again
This commit is contained in:
@@ -32,7 +32,10 @@ impl Move {
|
||||
fn value(&self, agent_color: Piece, depth: usize) -> i64 {
|
||||
let mut captured_value = self.captured as i64;
|
||||
|
||||
if agent_color != self.color {
|
||||
if self.board.game_over() && self.board.get_winner() != Some(!agent_color) {
|
||||
// if this board results in the opponent winning, MAJORLY negatively weigh this move
|
||||
captured_value = i64::MIN;
|
||||
} else if agent_color != self.color {
|
||||
captured_value = -captured_value;
|
||||
}
|
||||
|
||||
@@ -133,6 +136,8 @@ impl Agent for ComplexAgent {
|
||||
.into_iter()
|
||||
.max_by_key(|m| m.value(self.color, 1));
|
||||
|
||||
assert!(self.curr_move.is_some(), "ComplexAgent didn't make a move");
|
||||
|
||||
self.curr_move.as_ref().map(Move::coords)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user