add diagonal support

This commit is contained in:
Simon Gardling 2025-01-28 22:40:16 -05:00
parent 8eed946c98
commit 37658c7bd0
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
2 changed files with 8 additions and 4 deletions

View File

@ -105,7 +105,13 @@ impl Board {
.map(|range| range.into_iter().map(|j| (i, j)).collect()),
);
// TODO! add diagonals to `chains` here
chains.extend(
split_from(0, BOARD_SIZE - 1, i)
.into_iter()
.zip(split_from(0, BOARD_SIZE - 1, j))
.map(|(i_vec, j_vec)| i_vec.into_iter().zip(j_vec))
.map(|x| x.into_iter().map(|(i, j)| (i, j)).collect()),
);
let mut captured: usize = 0;

View File

@ -51,11 +51,9 @@ impl Game {
println!("{}", self);
// return;
self.step(i);
// std::thread::sleep(Duration::from_millis(200));
std::thread::sleep(Duration::from_millis(200));
}
}
}