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

@@ -1,5 +1,5 @@
pub mod pesto;
pub const MAX_SCORE: i32 = 100000;
pub const MIN_SCORE: i32 = -100000;
pub const MATE_SCORE: i32 = 50000;
pub const MAX_SCORE: i16 = 10000;
pub const MIN_SCORE: i16 = -10000;
pub const MATE_SCORE: i16 = 5000;

View File

@@ -224,7 +224,7 @@ impl Pesto {
Self { mg_table, eg_table }
}
pub fn eval(&self, game: &Game) -> i32 {
pub fn eval(&self, game: &Game) -> i16 {
let mut mg = [0, 0];
let mut eg = [0, 0];
let mut phase = 0;
@@ -243,7 +243,7 @@ impl Pesto {
let mg_phase = std::cmp::min(phase, 24);
let eg_phase = 24 - mg_phase;
(mg_score * mg_phase + eg_score * eg_phase) / 24
((mg_score * mg_phase + eg_score * eg_phase) / 24) as i16
}
}