switched to 3d array for storing zobrist piece keys

This commit is contained in:
rektdie committed 2024-06-29 05:38:15 +02:00
1 parent 62ba07a283
commit 869af6662b
1 file changed
+4 -3
+4 -3
View File
@@ -1,10 +1,11 @@
#include "tt.h" #include "tt.h"
#include "types.h" #include "types.h"
#include <iostream>
static inline U64 initialSeed = 0x60919C48E57863B9; static inline U64 initialSeed = 0x60919C48E57863B9;
// 2[colors] * 6[pieces] * 64[squares] // 2[colors] * 6[pieces] * 64[squares]
static U64 zKeys[768]; static U64 zKeys[2][6][64];
// There are 8 files // There are 8 files
static U64 zEnPassant[8]; static U64 zEnPassant[8];
@@ -24,9 +25,9 @@ void InitZobrist() {
for (int i = White; i <= Black; i++) { for (int i = White; i <= Black; i++) {
for (int j = Pawn; j <= King; j++) { for (int j = Pawn; j <= King; j++) {
for (int k = a1; k <= h8; k++) { for (int k = a1; k <= h8; k++) {
zKeys[i+j+k] = RandomNum(); zKeys[i][j][k] = RandomNum();
} }
} }
} }
// init en passant file keys // init en passant file keys