aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-29 09:01:30 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-29 09:01:30 +0300
commitb3b6fa6959332a3b1ed8a8e8efb0c08cd3693c85 (patch)
tree80630fc41749cb24b332d259430ab8438d2c5908
parent2a67d2266b513d9707bacd67fe93c89b49597b07 (diff)
downloadchessnost-b3b6fa6959332a3b1ed8a8e8efb0c08cd3693c85.tar.gz
test: add weird bishop sacrifice test-case
-rw-r--r--src/board/engine.rs15
1 files changed, 14 insertions, 1 deletions
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};