aboutsummaryrefslogtreecommitdiff
path: root/src/board.rs
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-23 06:41:13 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-23 06:41:13 +0300
commit294eba0fee76e1c7e8b665572622a472316361c7 (patch)
tree502ef429e8999b03d50cde711d17ee82ca4b85ed /src/board.rs
parent8eb51ff6072413f03f6edc8a4ead95bb3380245d (diff)
downloadchessnost-294eba0fee76e1c7e8b665572622a472316361c7.tar.gz
refactor: rename apply_move -> make_move
Diffstat (limited to 'src/board.rs')
-rw-r--r--src/board.rs10
1 files changed, 5 insertions, 5 deletions
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");