diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-01-23 17:43:27 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-01-23 17:43:27 +0300 |
commit | aa80421ebb89c5d776d9b981a4145b58b73f01db (patch) | |
tree | 289199f4a140fe5ed9e4cb7fddc25b34396bcc5b /src/board.rs | |
parent | b2378ac0b5a3fa24e8856de8e38b37ef5ea7704e (diff) | |
download | chessnost-aa80421ebb89c5d776d9b981a4145b58b73f01db.tar.gz |
refactor: use better namings
Diffstat (limited to 'src/board.rs')
-rw-r--r-- | src/board.rs | 24 |
1 files changed, 12 insertions, 12 deletions
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); |