add board weights

This commit is contained in:
2025-02-22 20:55:17 -05:00
parent 60aaa883c1
commit ed101f8968
2 changed files with 25 additions and 9 deletions

View File

@@ -18,19 +18,28 @@ impl BoardValueMap {
.sum()
}
/// Weights from: https://repub.eur.nl/pub/7142/ei2005-47.pdf
pub fn new() -> Self {
let mut map = PosMap::new();
assert_eq!(
Board::BOARD_SIZE,
8,
"BVM only supports Board::BOARD_SIZE of 8"
);
const POSITION_VALUES: [[i64; 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],
[5, -2, -1, -1, -1, -1, -2, 5],
[5, -2, -1, -1, -1, -1, -2, 5],
[10, -2, -1, -1, -1, -1, -2, 10],
[-20, -50, -2, -2, -2, -2, -50, -20],
[100, -20, 10, 5, 5, 10, -20, 100],
];
for (i, j) in Board::all_positions() {
map.set(i, j, 1);
}
for (i, j) in Board::sides() {
map.set(i, j, 100);
}
for (i, j) in Board::corners() {
map.set(i, j, 1000);
map.set(i, j, POSITION_VALUES[i][j])
}
Self(map)