Skip to content

Commit edd0f64

Browse files
committed
Add BitBoard::to_matrix_and_offset Python method
1 parent 8babd2c commit edd0f64

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

gomori/src/board/bitboard.rs

+11
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,17 @@ mod python {
457457
fn __bool__(&self) -> bool {
458458
!self.is_empty()
459459
}
460+
461+
// Python exclusive
462+
fn to_matrix_and_offset(&self) -> ([[bool; 7]; 7], (i8, i8)) {
463+
let arr = std::array::from_fn(|i_local| {
464+
std::array::from_fn(|j_local| {
465+
let idx = i_local * 7 + j_local;
466+
self.bits & (1u64 << idx) != 0
467+
})
468+
});
469+
(arr, self.offset())
470+
}
460471
}
461472
}
462473

0 commit comments

Comments
 (0)