simplify PosMap + BoardValueMap logic
This commit is contained in:
@@ -49,6 +49,20 @@ impl<T: Default> PosMap<T> {
|
||||
}
|
||||
}
|
||||
|
||||
type PosMapOrig<T> = [[T; Board::BOARD_SIZE as usize]; Board::BOARD_SIZE as usize];
|
||||
|
||||
impl<T: Default + Copy> From<PosMapOrig<T>> for PosMap<T> {
|
||||
fn from(value: PosMapOrig<T>) -> Self {
|
||||
let mut new = Self::new();
|
||||
for i in 0..Board::BOARD_SIZE {
|
||||
for j in 0..Board::BOARD_SIZE {
|
||||
new.set(i, j, value[i as usize][j as usize]);
|
||||
}
|
||||
}
|
||||
new
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a lookup map for adjacencies and chains from each position on the board
|
||||
pub fn gen_adj_lookup() -> PosMap<ChainCollection> {
|
||||
PosMap(
|
||||
|
||||
Reference in New Issue
Block a user