Reduce size of eval to i16
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user