Increase size of internal repetition table to avoid possible bounds error

This commit is contained in:
Sebastian Lague 2023-08-01 16:52:10 +02:00
parent f19b15dcab
commit bcd8cbb423

View file

@ -11,8 +11,9 @@ namespace ChessChallenge.Chess
public RepetitionTable() public RepetitionTable()
{ {
hashes = new ulong[256]; const int size = 1024;
startIndices = new int[hashes.Length + 1]; hashes = new ulong[size - 1];
startIndices = new int[size];
} }
public void Init(Board board) public void Init(Board board)
@ -36,8 +37,8 @@ namespace ChessChallenge.Chess
{ {
hashes[count] = hash; hashes[count] = hash;
startIndices[count + 1] = reset ? count : startIndices[count]; startIndices[count + 1] = reset ? count : startIndices[count];
count++;
} }
count++;
} }
public void TryPop() public void TryPop()