Skip to content

Commit 63778ed

Browse files
authored
Switch completely to bulletformat
1 parent 8c9c8c7 commit 63778ed

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dataparser/src/position.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ impl Position {
2525
{
2626
let mut occupancy = self.occupancy;
2727
let mut pieces = self.pieces;
28-
const PIECE_MIRROR: [i16; 12] = [384, 448, 512, 576, 640, 704, 0, 64, 128, 192, 256, 320];
28+
const PIECE_VALUES: [i16; 14] = [ 0, 64, 128, 192, 256, 320, 0, 0, 384, 448, 512, 576, 640, 704, ];
2929

3030
while occupancy != 0 {
3131
let square = occupancy.trailing_zeros() as i16;
32-
let piece = (pieces & 0b1111) as i16;
32+
let colored_piece = (pieces & 0b1111) as i16;
3333

3434
occupancy &= occupancy - 1;
3535
pieces >>= 4;
3636

37-
let stm_feature = piece * 64 + square;
38-
let nstm_feature = PIECE_MIRROR[piece as usize] + square ^ 56;
37+
let stm_feature = PIECE_VALUES[colored_piece as usize] + square;
38+
let nstm_feature = PIECE_VALUES[(colored_piece ^ 8) as usize] + (square ^ 56);
3939

4040
features(stm_feature, nstm_feature);
4141
}

0 commit comments

Comments
 (0)