aboutsummaryrefslogtreecommitdiff
path: root/src/board/mod.rs
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-24 22:34:21 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-24 22:34:21 +0300
commited12bd22248e78ad28157ededfed2be63e2d5062 (patch)
tree6a5b3116e0e29883494228d81d719d8ecb4f147e /src/board/mod.rs
parenta5fce018294f63cf153b1d9ecc1cb28e82f12c28 (diff)
downloadchessnost-ed12bd22248e78ad28157ededfed2be63e2d5062.tar.gz
refactor: cleanup material advantage calculation
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() {