cleanup test + ensure chain validity

This commit is contained in:
2025-02-18 22:53:13 -05:00
parent 6bda402a12
commit 45224bf6c2
2 changed files with 12 additions and 5 deletions

View File

@@ -53,6 +53,15 @@ fn gen_adj_lookup() -> PosMap<ChainCollection> {
// handle diagonals
chains.extend(diag_raw(i_chain, j_chain).map(Iterator::collect));
// make sure all chains are in the proper range so we can ignore bounds checking later
assert!(
chains.iter().all(|x| x.iter().all(
|(i, j)| (0..BOARD_SIZE).contains(i) && (0..BOARD_SIZE).contains(j)
)),
"chains go out-of-bounds"
);
chains
})
.collect()