change BoardValueMap type to i8

This commit is contained in:
Simon Gardling 2025-03-24 15:44:44 -04:00
parent 886eddf484
commit 5796032693
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -1,6 +1,6 @@
use crate::repr::{Board, Piece, PosMap};
pub struct BoardValueMap(PosMap<i16>);
pub struct BoardValueMap(PosMap<i8>);
impl BoardValueMap {
pub fn board_value(&self, board: &Board, color: Piece) -> i16 {
@ -15,12 +15,13 @@ impl BoardValueMap {
// target has position
value
})
.map(|x| x as i16)
.sum()
}
/// Weights from: https://repub.eur.nl/pub/7142/ei2005-47.pdf
pub const fn weighted() -> Self {
const POSITION_VALUES: [[i16; 8]; 8] = [
const POSITION_VALUES: [[i8; 8]; 8] = [
[100, -20, 10, 5, 5, 10, -20, 100],
[-20, -50, -2, -2, -2, -2, -50, -20],
[10, -2, -1, -1, -1, -1, -2, 10],