diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-01-24 22:34:21 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-01-24 22:34:21 +0300 |
commit | ed12bd22248e78ad28157ededfed2be63e2d5062 (patch) | |
tree | 6a5b3116e0e29883494228d81d719d8ecb4f147e /src/board/mod.rs | |
parent | a5fce018294f63cf153b1d9ecc1cb28e82f12c28 (diff) | |
download | chessnost-ed12bd22248e78ad28157ededfed2be63e2d5062.tar.gz |
refactor: cleanup material advantage calculation
Diffstat (limited to 'src/board/mod.rs')
-rw-r--r-- | src/board/mod.rs | 11 |
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() { |