board backing referencing improvements
This commit is contained in:
@@ -20,9 +20,13 @@ impl CoordPair {
|
||||
Self(row * Board::BOARD_SIZE + col)
|
||||
}
|
||||
|
||||
fn from_index(&self) -> (CoordAxis, CoordAxis) {
|
||||
fn into_indexes(&self) -> (CoordAxis, CoordAxis) {
|
||||
self.0.div_mod_floor(&Board::BOARD_SIZE)
|
||||
}
|
||||
|
||||
pub const fn area(pos: CoordAxis) -> Self {
|
||||
Self(pos.pow(2) as CoordPairInner)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for CoordPair {
|
||||
@@ -40,7 +44,7 @@ impl std::fmt::Debug for CoordPair {
|
||||
|
||||
impl From<CoordPair> for (CoordAxis, CoordAxis) {
|
||||
fn from(val: CoordPair) -> Self {
|
||||
val.from_index()
|
||||
val.into_indexes()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user