improve complexagent stuff

This commit is contained in:
Simon Gardling 2025-01-28 19:57:48 -05:00
parent 37c3f8572f
commit 8eed946c98
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
2 changed files with 15 additions and 3 deletions

View File

@ -24,8 +24,20 @@ impl Agent for ComplexAgent {
fn next_move(&mut self, board: &Board) -> Option<(usize, usize)> {
problem_space(board, self.color)
.iter()
.max_by_key(|(_, _, (_, c))| c)
.map(|&(i, j, (_, _))| (i, j))
.map(|&(i, j, (board, c))| {
(
i,
j,
c as i64
// reduce # of adversarial moves
- problem_space(&board, self.color.flip())
.into_iter()
.map(|(_, _, (_, c))| c as i64)
.count() as i64,
)
})
.max_by_key(|&(_, _, c)| c)
.map(|(i, j, _)| (i, j))
}
fn name(&self) -> &'static str {

View File

@ -55,7 +55,7 @@ impl Game {
self.step(i);
std::thread::sleep(Duration::from_millis(200));
// std::thread::sleep(Duration::from_millis(200));
}
}
}