cleanup gent_adj_lookup

This commit is contained in:
Simon Gardling 2025-02-20 11:48:57 -05:00
parent 66364a5e9d
commit e1bae4e43b
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -52,25 +52,22 @@ fn gen_adj_lookup() -> PosMap<ChainCollection> {
split_from(0..=BOARD_SIZE - 1, j),
);
let mut chains: ChainCollection = ArrayVec::new_const();
chains.extend(
let chains: ChainCollection = ArrayVec::from_iter(
i_chain
.clone()
.into_iter()
.map(|range| range.map(move |i| (i, j)))
.map(Iterator::collect),
.map(Iterator::collect)
.chain(
j_chain
.clone()
.into_iter()
.map(|range| range.map(move |j| (i, j)))
.map(Iterator::collect),
)
.chain(diag_raw(i_chain, j_chain).map(Iterator::collect)),
);
chains.extend(
j_chain
.clone()
.map(|range| range.map(move |j| (i, j)))
.map(Iterator::collect),
);
// 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