aboutsummaryrefslogtreecommitdiff
path: root/src/board/engine.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/board/engine.rs')
-rw-r--r--src/board/engine.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/board/engine.rs b/src/board/engine.rs
index a710efb..5f64c39 100644
--- a/src/board/engine.rs
+++ b/src/board/engine.rs
@@ -476,8 +476,7 @@ mod tests {
#[test]
fn material() {
let board = Board::new();
- assert_eq!(board.material(Color::Black), 40.0);
- assert_eq!(board.material(Color::White), 40.0);
+ assert_eq!(board.material(Color::Black), board.material(Color::White));
}
@@ -495,6 +494,20 @@ mod tests {
]);
}
+ #[test]
+ fn stupid_knight_sac() {
+ let fen = String::from("r3k1r1/pp3ppp/1q6/2ppPn2/6P1/1PPP1P2/P1N3KP/R2QR3 b - - 0 18");
+ let mut board = Board::from_FEN(fen);
+ board.ply += 1; // TODO: remove me when FEN parsing includes side to move
+
+ let (_, pv) = board.iterative_deepening(6, Duration::from_secs(60));
+ assert_eq!(
+ pv[0],
+ Move { source: Square::F5, target: Square::H4, kind: MoveKind::Quiet },
+ "You should save this poor knight from danger!"
+ );
+ }
+
mod evaluation {
use crate::{moves::{Move, MoveKind}, square::Square};
@@ -537,7 +550,7 @@ mod tests {
board.print();
println!("Score {}", score);
- assert!(score < -4.0);
+ assert!(score < -3.0);
}
#[test]