diff options
-rw-r--r-- | src/attacks.rs | 18 | ||||
-rw-r--r-- | src/board.rs | 24 |
2 files changed, 21 insertions, 21 deletions
diff --git a/src/attacks.rs b/src/attacks.rs index 2c8e55f..8217ce6 100644 --- a/src/attacks.rs +++ b/src/attacks.rs @@ -321,7 +321,7 @@ mod tests { 1 << Square::F3 as usize; #[test] - fn test_pawn_attacks() { + fn pawn_attacks() { let attacks = Attacks::precompute_pawn_attacks(); let square = Square::E4 as usize; let white_attacks = attacks[Color::White as usize][square]; @@ -338,7 +338,7 @@ mod tests { } #[test] - fn test_pawn_pushes() { + fn pawn_pushes() { let (pushes, double_pushes) = Attacks::precompute_pawn_pushes(); assert_eq!(pushes[Color::White as usize][Square::E4 as usize], Square::E5.to_bitboard()); assert_eq!(pushes[Color::White as usize][Square::A2 as usize], Square::A3.to_bitboard()); @@ -352,7 +352,7 @@ mod tests { } #[test] - fn test_knight_attacks() { + fn knight_attacks() { let attacks = Attacks::precompute_knight_attacks(); let e4_attacks = attacks[Square::E4 as usize]; @@ -376,7 +376,7 @@ mod tests { } #[test] - fn test_king_attacks() { + fn king_attacks() { let attacks = Attacks::precompute_king_attacks(); print(attacks[Square::E4 as usize], "King e4"); @@ -395,7 +395,7 @@ mod tests { } #[test] - fn test_first_rank_attacks() { + fn first_rank_attacks() { let attacks = Attacks::precompute_first_rank_attacks(); // HGFEDCBA HGFEDCBA assert_eq!(attacks[0b00010000][4], 0b11101111, "If rook is the only piece on a rank, it should be able to attack all rank"); @@ -412,7 +412,7 @@ mod tests { } #[test] - fn test_ray_attacks() { + fn ray_attacks() { let attacks = Attacks::precompute_ray_attacks(); let square = Square::E4 as usize; let bitboard = @@ -428,7 +428,7 @@ mod tests { } #[test] - fn test_bishop_attacks() { + fn bishop_attacks() { let attacks = Attacks::new(); let square = Square::E4; let bb = attacks.bishop(DEFAULT_OCCUPANCY, square); @@ -446,7 +446,7 @@ mod tests { } #[test] - fn test_rook_attacks() { + fn rook_attacks() { let attacks = Attacks::new(); let square = Square::E4; let occupancy = @@ -473,7 +473,7 @@ mod tests { } #[test] - fn test_queen_attacks() { + fn queen_attacks() { let attacks = Attacks::new(); let square = Square::E4; let bb = attacks.queen(DEFAULT_OCCUPANCY, square); diff --git a/src/board.rs b/src/board.rs index 4a4e2f4..7f35e91 100644 --- a/src/board.rs +++ b/src/board.rs @@ -168,7 +168,7 @@ impl Board { println!(" a b c d e f g h"); } - pub fn generate_moves(&self, color: Color) -> Vec<Move> { + pub fn generate_pseudolegal_moves(&self, color: Color) -> Vec<Move> { let mut moves = Vec::with_capacity(1024); let opponent_occupancy = self.color_occupancy(color.flip()); let empty = self.empty(); @@ -502,7 +502,7 @@ impl Board { } let color = self.color_to_move(); - let moves = self.generate_moves(color); + let moves = self.generate_pseudolegal_moves(color); if print { println!("Running perft for depth {}. Color to move is {:?}\n{} moves available", depth, color, moves.len()); @@ -638,14 +638,14 @@ mod tests { use crate::{bitboard::{pop_count, bitscan, print}, square::Square}; #[test] - fn test_square_enum() { + fn square_enum() { assert_eq!(Square::A1 as u8, 0); assert_eq!(Square::F1 as u8, 5); assert_eq!(Square::H8 as u8, 63); } #[test] - fn test_new_from_default_fen() { + fn new_from_default_fen() { let board = Board::new(); board.print(); @@ -675,10 +675,10 @@ mod tests { } #[test] - fn test_generate_moves_starting_position() { + fn generate_pseudolegal_moves_starting_position() { let board = Board::new(); - let moves = board.generate_moves(Color::White); - let black_moves = board.generate_moves(Color::Black); + let moves = board.generate_pseudolegal_moves(Color::White); + let black_moves = board.generate_pseudolegal_moves(Color::Black); assert_eq!(moves.len(), 20); assert_eq!(black_moves.len(), 20); @@ -689,7 +689,7 @@ mod tests { } #[test] - fn test_make_move() { + fn make_move() { let fen = String::from("q1b2k2/5p1p/4p1pb/pPPp4/3N4/3nPB2/P2QKnR1/1R6 w - - 0 25"); let mut board = Board::from_FEN(fen); let initial_board = board.clone(); @@ -727,7 +727,7 @@ mod tests { } #[test] - fn test_unmake_move() { + fn unmake_move() { let fen = String::from("q1b2k2/5p1p/4p1pb/pPPp4/3N4/3nPB2/P2QKnR1/1R6 w - - 0 25"); let mut board = Board::from_FEN(fen); let initial_board = board.clone(); @@ -746,7 +746,7 @@ mod tests { } #[test] - fn test_perft() { + fn perft() { let mut board = Board::new(); assert_eq!(board.perft(0, false), (1, 0, 0, 0, 0)); @@ -759,7 +759,7 @@ mod tests { } #[test] - fn test_position_perft() { + fn position_perft() { let fen = String::from("r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - "); let mut board = Board::from_FEN(fen); assert_eq!(board.perft(0, false), (1, 0, 0, 0, 0)); @@ -769,7 +769,7 @@ mod tests { } #[test] - fn test_is_square_attacked() { + fn is_square_attacked() { let board = Board::new(); assert_eq!(board.is_square_attacked(Square::E2, Color::White), true); |