- // Piece offset is at 64 * polyPiece where polyPiece is defined as:
- // BP = 0, WP = 1, BN = 2, WN = 3, ... BK = 10, WK = 11
- Square s = pop_1st_bit(&b);
- Piece p = pos.piece_on(s);
- int polyPiece = 2 * (type_of(p) - 1) + (color_of(p) == WHITE);
- key ^= ZobPiece[64 * polyPiece + s];
+ Square s = pop_lsb(&b);
+ Piece pc = pos.piece_on(s);
+
+ // PolyGlot pieces are: BP = 0, WP = 1, BN = 2, ... BK = 10, WK = 11
+ key ^= PG.Zobrist.psq[2 * (type_of(pc) - 1) + (color_of(pc) == WHITE)][s];