This commit is contained in:
stefiosif
2025-02-13 20:37:12 +02:00
parent a69c697892
commit dd79dc61ba

View File

@@ -2,7 +2,7 @@ use anyhow::{bail, Result};
use crate::{
board::game::Game,
evaluation::{MATE_SCORE, MIN_SCORE},
evaluation::{pesto::pesto, MATE_SCORE, MIN_SCORE},
};
use super::{
@@ -54,6 +54,21 @@ pub fn negamax(
}
}
const RFP_DEPTH: u8 = 5;
const RFP_MARGIN: u8 = 75;
let eval = entry
.map(|entry| entry.score)
.unwrap_or_else(|| pesto().eval(game));
if !in_check
&& alpha == beta - 1
&& depth <= RFP_DEPTH
&& eval > beta
&& eval - (RFP_MARGIN * depth) as i16 > beta
{
return Ok(eval);
}
if plies != 0 && !in_check && depth >= 3 && do_nmp && game.board.non_pawn_materials() > 0 {
game.make_null_move();
let score = -negamax(