Implement PeSTO eval

This commit is contained in:
stefiosif
2025-01-12 23:02:10 +02:00
parent 365bd71a6f
commit 2c9181993f
7 changed files with 279 additions and 270 deletions

View File

@@ -1,6 +1,4 @@
use crate::{
board::mailbox::Mailbox, evaluation::evaluation::material_score, movegen::r#move::Move,
};
use crate::{board::mailbox::Mailbox, movegen::r#move::Move};
pub fn sort_moves(mut moves: Vec<Move>, mailbox: &Mailbox, tt_move: Option<Move>) -> Vec<Move> {
if let Some(tt_move) = tt_move {
@@ -17,7 +15,7 @@ pub fn sort_moves(mut moves: Vec<Move>, mailbox: &Mailbox, tt_move: Option<Move>
const fn mvv_lva(mailbox: &Mailbox, mv: Move) -> i32 {
match (mailbox.piece_at(mv.src), mailbox.piece_at(mv.dst)) {
(Some(aggressor), Some(victim)) => material_score(victim.0) - material_score(aggressor.0),
(Some(aggressor), Some(victim)) => victim.0.score() - aggressor.0.score(),
_ => -1000,
}
}

View File

@@ -1,6 +1,6 @@
use anyhow::{bail, Result};
use crate::{board::game::Game, evaluation::evaluation::evaluate_position};
use crate::{board::game::Game, evaluation::pesto::pesto};
use super::{
move_ordering,
@@ -12,7 +12,7 @@ pub fn quiescence(game: &mut Game, mut alpha: i32, beta: i32, time_info: &TimeIn
bail!("Time is up! In Quiescence");
}
let stand_pat = evaluate_position(&game.board);
let stand_pat = pesto().eval(game);
if stand_pat >= beta {
return Ok(beta);