diff options
-rw-r--r-- | src/board/engine.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/board/engine.rs b/src/board/engine.rs index 8bd409b..1d01e06 100644 --- a/src/board/engine.rs +++ b/src/board/engine.rs @@ -109,6 +109,7 @@ 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)) @@ -118,7 +119,7 @@ impl Board { None => 0., } }); - source_eval - target_eval + 2. * target_eval - source_eval } pub fn negamax_search(&mut self, mut alpha: f32, beta: f32, depth_left: u8, deadline: Instant) -> (f32, Vec<Move>) { @@ -130,7 +131,7 @@ impl Board { moves.sort_unstable_by(|a, b| { let a_eval = self.eval_move(*a); let b_eval = self.eval_move(*b); - a_eval.total_cmp(&b_eval) + a_eval.total_cmp(&b_eval).reverse() }); match self.transposition_table[(self.hash % TTABLE_SIZE) as usize] { @@ -210,7 +211,7 @@ impl Board { moves.sort_unstable_by(|a, b| { let a_eval = self.eval_move(*a); let b_eval = self.eval_move(*b); - a_eval.total_cmp(&b_eval) + a_eval.total_cmp(&b_eval).reverse() }); match self.transposition_table[(self.hash % TTABLE_SIZE) as usize] { |