diff options
Diffstat (limited to 'src/board/io.rs')
-rw-r--r-- | src/board/io.rs | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/board/io.rs b/src/board/io.rs index b5cd95e..30d487f 100644 --- a/src/board/io.rs +++ b/src/board/io.rs @@ -2,7 +2,7 @@ use std::io::{stdin, stdout, Write}; use crate::{bitboard::Bitboard, attacks::Attacks, moves::Move, square::Square}; -use super::{Board, PieceType, ttable::TTABLE_SIZE, zobrist::Zobrist}; +use super::{Board, Piece, ttable::TTABLE_SIZE, zobrist::Zobrist}; const PIECE_CHARS: [&str; 12] = [ "♟︎", "♞", "♝", "♜", "♛", "♚", @@ -65,18 +65,18 @@ impl IO for Board { } } else { match character { - 'P' => piece_sets[PieceType::Pawn as usize] |= position, - 'N' => piece_sets[PieceType::Knight as usize] |= position, - 'B' => piece_sets[PieceType::Bishop as usize] |= position, - 'R' => piece_sets[PieceType::Rook as usize] |= position, - 'Q' => piece_sets[PieceType::Queen as usize] |= position, - 'K' => piece_sets[PieceType::King as usize] |= position, - 'p' => piece_sets[PieceType::PawnBlack as usize] |= position, - 'n' => piece_sets[PieceType::KnightBlack as usize] |= position, - 'b' => piece_sets[PieceType::BishopBlack as usize] |= position, - 'r' => piece_sets[PieceType::RookBlack as usize] |= position, - 'q' => piece_sets[PieceType::QueenBlack as usize] |= position, - 'k' => piece_sets[PieceType::KingBlack as usize] |= position, + 'P' => piece_sets[Piece::Pawn as usize] |= position, + 'N' => piece_sets[Piece::Knight as usize] |= position, + 'B' => piece_sets[Piece::Bishop as usize] |= position, + 'R' => piece_sets[Piece::Rook as usize] |= position, + 'Q' => piece_sets[Piece::Queen as usize] |= position, + 'K' => piece_sets[Piece::King as usize] |= position, + 'p' => piece_sets[Piece::PawnBlack as usize] |= position, + 'n' => piece_sets[Piece::KnightBlack as usize] |= position, + 'b' => piece_sets[Piece::BishopBlack as usize] |= position, + 'r' => piece_sets[Piece::RookBlack as usize] |= position, + 'q' => piece_sets[Piece::QueenBlack as usize] |= position, + 'k' => piece_sets[Piece::KingBlack as usize] |= position, '/' => { rank -= 1; file = -1; // So it becomes 0 @@ -151,22 +151,22 @@ mod tests { board.print(); board.empty().print("Empty squares"); - assert_eq!(board.piece_sets[PieceType::Pawn as usize].pop_count(), 8); - assert_eq!(board.piece_sets[PieceType::Knight as usize].pop_count(), 2); - assert_eq!(board.piece_sets[PieceType::Bishop as usize].pop_count(), 2); - assert_eq!(board.piece_sets[PieceType::Rook as usize].pop_count(), 2); - assert_eq!(board.piece_sets[PieceType::Queen as usize].pop_count(), 1); - assert_eq!(board.piece_sets[PieceType::King as usize].pop_count(), 1); - - assert_eq!(board.piece_sets[PieceType::PawnBlack as usize].pop_count(), 8); - assert_eq!(board.piece_sets[PieceType::KnightBlack as usize].pop_count(), 2); - assert_eq!(board.piece_sets[PieceType::BishopBlack as usize].pop_count(), 2); - assert_eq!(board.piece_sets[PieceType::RookBlack as usize].pop_count(), 2); - assert_eq!(board.piece_sets[PieceType::QueenBlack as usize].pop_count(), 1); - assert_eq!(board.piece_sets[PieceType::KingBlack as usize].pop_count(), 1); - - assert_eq!(board.piece_sets[PieceType::King as usize].bitscan(), Square::E1); - assert_eq!(board.piece_sets[PieceType::QueenBlack as usize].bitscan(), Square::D8); + assert_eq!(board.piece_sets[Piece::Pawn as usize].pop_count(), 8); + assert_eq!(board.piece_sets[Piece::Knight as usize].pop_count(), 2); + assert_eq!(board.piece_sets[Piece::Bishop as usize].pop_count(), 2); + assert_eq!(board.piece_sets[Piece::Rook as usize].pop_count(), 2); + assert_eq!(board.piece_sets[Piece::Queen as usize].pop_count(), 1); + assert_eq!(board.piece_sets[Piece::King as usize].pop_count(), 1); + + assert_eq!(board.piece_sets[Piece::PawnBlack as usize].pop_count(), 8); + assert_eq!(board.piece_sets[Piece::KnightBlack as usize].pop_count(), 2); + assert_eq!(board.piece_sets[Piece::BishopBlack as usize].pop_count(), 2); + assert_eq!(board.piece_sets[Piece::RookBlack as usize].pop_count(), 2); + assert_eq!(board.piece_sets[Piece::QueenBlack as usize].pop_count(), 1); + assert_eq!(board.piece_sets[Piece::KingBlack as usize].pop_count(), 1); + + assert_eq!(board.piece_sets[Piece::King as usize].bitscan(), Square::E1); + assert_eq!(board.piece_sets[Piece::QueenBlack as usize].bitscan(), Square::D8); assert_eq!(board.occupancy.pop_count(), 32); assert_eq!(board.empty().pop_count(), 32); |