clippy + cleanup

This commit is contained in:
2025-02-17 15:06:36 -05:00
parent 7049039a77
commit 43585802d8
2 changed files with 15 additions and 13 deletions

View File

@@ -127,12 +127,10 @@ impl FutureMoves {
}).collect();
// we want to keep only the best move of the agent
if color == self.agent_color {
if new.len() > 1 {
// negative, because we want the max value to be at the first index
new.sort_by_key(|x| -x.compute_self_value(self.agent_color, 1));
new.drain(1..);
}
if color == self.agent_color && new.len() > 1 {
// negative, because we want the max value to be at the first index
new.sort_by_key(|x| -x.compute_self_value(self.agent_color, 1));
new.drain(1..);
}
self.arena.extend(new);
@@ -164,11 +162,11 @@ impl FutureMoves {
let mut visited = vec![false; self.arena.len()];
for depth in (0..=self.current_depth).rev() {
for idx in 0..self.arena.len() {
if visited[idx] {
for (idx, was_visited) in visited.iter_mut().enumerate() {
if *was_visited {
continue;
} else {
visited[idx] = true;
*was_visited = true;
}
if self.depth_of(idx) != depth as usize {
continue;