rename board variables

This commit is contained in:
2025-03-11 17:05:40 -04:00
parent f84706ac40
commit 37292dd0f1
3 changed files with 24 additions and 24 deletions

View File

@@ -9,7 +9,7 @@ pub type CoordAxis = u8;
/// using u8 for this results in a ~3-6% perf increase
pub type CoordPairInner = u8;
const_assert!(CoordPairInner::MAX as usize >= Board::BOARD_AREA.0 as usize);
const_assert!(CoordPairInner::MAX as usize >= Board::AREA.0 as usize);
#[derive(PartialEq, Eq, Copy, Clone, Hash)]
pub struct CoordPair(pub CoordPairInner);
@@ -17,12 +17,12 @@ pub struct CoordPair(pub CoordPairInner);
impl CoordPair {
/// Convert a row and column to an index in the board
pub const fn from_axes(row: CoordAxis, col: CoordAxis) -> Self {
Self(row * Board::BOARD_SIZE + col)
Self(row * Board::SIZE + col)
}
#[allow(clippy::wrong_self_convention)]
fn into_indexes(&self) -> (CoordAxis, CoordAxis) {
self.0.div_mod_floor(&Board::BOARD_SIZE)
self.0.div_mod_floor(&Board::SIZE)
}
pub const fn area(pos: CoordAxis) -> Self {