resizing positionHistory when we reach max size | bench 1136338
This commit is contained in:
1 parent
5aac7463ad
commit
46eb8d4b35
1 file changed
+6
@@ -176,6 +176,9 @@ static SearchResults Quiescence(Board& board, int alpha, int beta, int ply, Sear
|
|||||||
Board copy = board;
|
Board copy = board;
|
||||||
int isLegal = copy.MakeMove(board.moveList[i]);
|
int isLegal = copy.MakeMove(board.moveList[i]);
|
||||||
if (!isLegal) continue;
|
if (!isLegal) continue;
|
||||||
|
if (copy.positionIndex >= ctx.positionHistory.size()) {
|
||||||
|
ctx.positionHistory.resize(copy.positionIndex + 100);
|
||||||
|
}
|
||||||
ctx.positionHistory[copy.positionIndex] = copy.hashKey;
|
ctx.positionHistory[copy.positionIndex] = copy.hashKey;
|
||||||
ctx.nodes++;
|
ctx.nodes++;
|
||||||
int score = -Quiescence<mode>(copy, -beta, -alpha, ply + 1, ctx).score;
|
int score = -Quiescence<mode>(copy, -beta, -alpha, ply + 1, ctx).score;
|
||||||
@@ -304,6 +307,9 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
|||||||
bool isLegal = copy.MakeMove(currMove);
|
bool isLegal = copy.MakeMove(currMove);
|
||||||
|
|
||||||
if (!isLegal) continue;
|
if (!isLegal) continue;
|
||||||
|
if (copy.positionIndex >= ctx.positionHistory.size()) {
|
||||||
|
ctx.positionHistory.resize(copy.positionIndex + 100);
|
||||||
|
}
|
||||||
ctx.positionHistory[copy.positionIndex] = copy.hashKey;
|
ctx.positionHistory[copy.positionIndex] = copy.hashKey;
|
||||||
ctx.nodes++;
|
ctx.nodes++;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user