From 795c2c508dfcb768d92871eb3dfd4b6b2f6dde94 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Mon, 23 Dec 2024 21:28:04 -0500 Subject: [PATCH] feat: quiescence search examines all captures using the new movegen, plus static exchange eval --- src/prelude.rs | 2 +- src/search.rs | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/prelude.rs b/src/prelude.rs index a53002b..c57bbbe 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -16,7 +16,7 @@ Copyright © 2024 dogeystamp pub use crate::coordination::{ GoMessage, MsgBestmove, MsgToEngine, MsgToMain, UCIMode, UCIModeMachine, UCIModeTransition, }; -pub use crate::eval::{eval_metrics, Eval, EvalInt, EvalMetrics}; +pub use crate::eval::{eval_metrics, Eval, EvalInt, EvalMetrics, EvalSEE}; pub use crate::fen::{FromFen, ToFen}; pub use crate::movegen::{FromUCIAlgebraic, GenAttackers, Move, MoveGen, ToUCIAlgebraic}; pub use crate::search::{ diff --git a/src/search.rs b/src/search.rs index 4b0b54e..464b312 100644 --- a/src/search.rs +++ b/src/search.rs @@ -124,7 +124,7 @@ impl Default for SearchConfig { alpha_beta_on: true, // try to make this even to be more conservative and avoid horizon problem depth: 10, - qdepth: 1, + qdepth: 2, enable_trans_table: true, transposition_size: 24, } @@ -234,10 +234,12 @@ fn minmax(board: &mut Board, state: &mut EngineState, mm: MinmaxState) -> (Vec = board - .gen_moves() - .into_iter() - .collect::>() + let mvs = if mm.quiesce { + board.gen_captures().into_iter().collect::>() + } else { + board.gen_moves().into_iter().collect::>() + }; + let mut mvs: Vec<_> = mvs .into_iter() .map(|mv| (move_priority(board, &mv, state), mv)) .collect(); @@ -266,14 +268,11 @@ fn minmax(board: &mut Board, state: &mut EngineState, mm: MinmaxState) -> (Vec bool { - if let Some(recap_sq) = board.recap_sq { - if mv.dest == recap_sq { - return false; - } - } + let see = board.eval_see(mv.dest, board.turn); - false + see > 0 }); }