From b3b6fa6959332a3b1ed8a8e8efb0c08cd3693c85 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 29 Jan 2023 09:01:30 +0300 Subject: test: add weird bishop sacrifice test-case --- src/board/engine.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/board/engine.rs b/src/board/engine.rs index 5f64c39..3977258 100644 --- a/src/board/engine.rs +++ b/src/board/engine.rs @@ -197,7 +197,7 @@ impl Board { let king_tropism_penalty = self.king_tropism(color) - self.king_tropism(opponent_color); - material_advantage + 0.1 * mobility_advantage - 0.5 * pawn_structure_penalty + king_tropism_penalty * opponent_material / 150.0 + material_advantage + 0.1 * mobility_advantage - 0.4 * pawn_structure_penalty + king_tropism_penalty * opponent_material / 150.0 } /// Evaluate move for move ordering, prioritizing efficient captures @@ -508,6 +508,19 @@ mod tests { ); } + #[test] + fn weird_bishop_sac() { + let fen = String::from("r1b1k1nr/p4pp1/1pp1p3/4n2p/1b1qP3/1B1P3N/PPPBQPPP/RN2K2R w KQkq - 7 10"); + let mut board = Board::from_FEN(fen); + + let (_, pv) = board.iterative_deepening(5, Duration::from_secs(60)); + assert_eq!( + pv[0], + Move { source: Square::C2, target: Square::C3, kind: MoveKind::Quiet }, + "You should fork this bastard!" + ); + } + mod evaluation { use crate::{moves::{Move, MoveKind}, square::Square}; -- cgit v1.2.3