From bcd8cbb423f08f1336f70121e5d3c794868ae7ee Mon Sep 17 00:00:00 2001 From: Sebastian Lague Date: Tue, 1 Aug 2023 16:52:10 +0200 Subject: [PATCH] Increase size of internal repetition table to avoid possible bounds error --- .../src/Framework/Chess/Board/RepetitionTable.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Chess-Challenge/src/Framework/Chess/Board/RepetitionTable.cs b/Chess-Challenge/src/Framework/Chess/Board/RepetitionTable.cs index c76c4c4..b317f06 100644 --- a/Chess-Challenge/src/Framework/Chess/Board/RepetitionTable.cs +++ b/Chess-Challenge/src/Framework/Chess/Board/RepetitionTable.cs @@ -11,8 +11,9 @@ namespace ChessChallenge.Chess public RepetitionTable() { - hashes = new ulong[256]; - startIndices = new int[hashes.Length + 1]; + const int size = 1024; + hashes = new ulong[size - 1]; + startIndices = new int[size]; } public void Init(Board board) @@ -36,8 +37,8 @@ namespace ChessChallenge.Chess { hashes[count] = hash; startIndices[count + 1] = reset ? count : startIndices[count]; + count++; } - count++; } public void TryPop()