diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/attacks.rs | 2 | ||||
-rw-r--r-- | src/board.rs | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/attacks.rs b/src/attacks.rs index a9947bc..1ccd0cf 100644 --- a/src/attacks.rs +++ b/src/attacks.rs @@ -38,7 +38,7 @@ enum Direction { NoWe, } -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Attacks { pub knight: AttackTable, pub king: AttackTable, diff --git a/src/board.rs b/src/board.rs index f32f7fc..7d0d6c5 100644 --- a/src/board.rs +++ b/src/board.rs @@ -2,7 +2,7 @@ use crate::{bitboard::{Bitboard, serialize_bitboard}, moves::Move, attacks::Atta pub static DEFAULT_FEN: &str = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Board { pub pieces: [Bitboard; 12], @@ -200,7 +200,7 @@ impl Board { /// *Blindlessly* apply a move without any validation /// Move should be validated beforehand - pub fn apply_move(&mut self, mov: Move) { + pub fn make_move(&mut self, mov: Move) { // Target match self.pieces .iter() @@ -298,14 +298,14 @@ mod tests { } #[test] - fn test_apply_move() { + fn test_make_move() { let fen = String::from("q1b2k2/5p1p/4p1pb/pPPp4/3N4/3nPB2/P2QKnR1/1R6 w - - 0 25"); let mut board = Board::from_FEN(fen); board.print(); let black_move = Move { source: Square::F7, target: Square::F5 }; println!("\n{:?}", black_move); - board.apply_move(black_move); + board.make_move(black_move); board.print(); assert!(board.pieces[PieceType::PawnBlack as usize] & Square::F7.to_bitboard() == 0); @@ -314,7 +314,7 @@ mod tests { let white_move = Move { source: Square::D2, target: Square::A5 }; println!("\n{:?}", white_move); - board.apply_move(white_move); + board.make_move(white_move); board.print(); assert!(board.pieces[PieceType::PawnBlack as usize] & Square::A5.to_bitboard() == 0, "Target piece should be captured"); |