improve complexagent stuff
This commit is contained in:
parent
37c3f8572f
commit
8eed946c98
@ -24,8 +24,20 @@ impl Agent for ComplexAgent {
|
|||||||
fn next_move(&mut self, board: &Board) -> Option<(usize, usize)> {
|
fn next_move(&mut self, board: &Board) -> Option<(usize, usize)> {
|
||||||
problem_space(board, self.color)
|
problem_space(board, self.color)
|
||||||
.iter()
|
.iter()
|
||||||
.max_by_key(|(_, _, (_, c))| c)
|
.map(|&(i, j, (board, c))| {
|
||||||
.map(|&(i, j, (_, _))| (i, j))
|
(
|
||||||
|
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 {
|
fn name(&self) -> &'static str {
|
||||||
|
|||||||
@ -55,7 +55,7 @@ impl Game {
|
|||||||
|
|
||||||
self.step(i);
|
self.step(i);
|
||||||
|
|
||||||
std::thread::sleep(Duration::from_millis(200));
|
// std::thread::sleep(Duration::from_millis(200));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user