aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/board/engine.rs21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/board/engine.rs b/src/board/engine.rs
index 2ff3aed..47890ad 100644
--- a/src/board/engine.rs
+++ b/src/board/engine.rs
@@ -173,15 +173,18 @@ impl Board {
/// Evaluate move for move ordering, prioritizing efficient captures
/// where low-value pieces capture high-value pieces
fn eval_move(&self, m: Move) -> f32 {
- let [source_eval, target_eval] = [m.source, m.target]
- .map(|sq| self.piece_by_square(sq))
- .map(|p| {
- match p {
- Some(p) => p.static_eval(),
- None => 0.,
- }
- });
- 2. * target_eval - source_eval
+ if m.kind == MoveKind::Capture || m.kind == MoveKind::EnPassant {
+ let [source_eval, target_eval] = [m.source, m.target]
+ .map(|sq| self.piece_by_square(sq))
+ .map(|p| {
+ match p {
+ Some(p) => p.static_eval(),
+ None => 0.,
+ }
+ });
+ return 2. * target_eval - source_eval
+ }
+ 0.0
}
pub fn negamax_search(&mut self, mut alpha: f32, beta: f32, depth_left: u8, deadline: Instant) -> (f32, Vec<Move>) {