aboutsummaryrefslogtreecommitdiff
path: root/src/board/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/board/mod.rs')
-rw-r--r--src/board/mod.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/board/mod.rs b/src/board/mod.rs
index e2d4d60..5e2f4e3 100644
--- a/src/board/mod.rs
+++ b/src/board/mod.rs
@@ -44,6 +44,13 @@ pub enum PieceType {
KingBlack,
}
+impl PieceType {
+ pub fn without_color(&self) -> Self {
+ let index = *self as usize;
+ Self::from(index % 6)
+ }
+}
+
const PIECE_CHARS: [&str; 12] = [
"♟︎", "♞", "♝", "♜", "♛", "♚",
"♙", "♘", "♗", "♖", "♕", "♔",
@@ -147,10 +154,6 @@ impl Board {
occupancy
}
- pub fn color_to_move(&self) -> Color {
- Color::from((self.ply % 2) as u8)
- }
-
pub fn print(&self) {
println!();
for rank in (0..8).rev() {