Reduce size of eval to i16

This commit is contained in:
stefiosif
2025-02-04 20:02:29 +02:00
parent 55056537f3
commit 908a87bd26
7 changed files with 21 additions and 19 deletions

View File

@@ -5,7 +5,7 @@ pub fn score_move(
mv: Move,
killer_move: Option<Move>,
tt_move: Option<Move>,
) -> i32 {
) -> i16 {
if Some(mv) == tt_move {
return -100;
}
@@ -15,9 +15,11 @@ pub fn score_move(
}
let aggressor = mailbox.piece_at(mv.src()).expect("No aggressor found.");
mailbox.piece_at(mv.dst()).map_or(100, |victim| {
aggressor.0.idx() as i32 - (victim.0.idx() * 8) as i32
})
if let Some(victim) = mailbox.piece_at(mv.dst()) {
return (aggressor.0.idx() - 8 * victim.0.idx()) as i16;
}
100
}
#[cfg(test)]