Skip to content

Commit c580965

Browse files
authored
Fix Illegal PV (#115)
Elo | 0.98 +- 2.90 (95%) SPRT | 8.0+0.08s Threads=1 Hash=8MB LLR | 2.96 (-2.94, 2.94) [-5.00, 0.00] Games | N: 16686 W: 4079 L: 4032 D: 8575 Penta | [169, 1830, 4300, 1873, 171] https://chess.aronpetkovski.com/test/2832/ bench 1849271
1 parent 4aca025 commit c580965

File tree

1 file changed

+8
-4
lines changed
  • Serendipity/src/main/java/org/shawn/games/Serendipity/Search

1 file changed

+8
-4
lines changed

Serendipity/src/main/java/org/shawn/games/Serendipity/Search/AlphaBeta.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ public AlphaBeta(TranspositionTable tt, NNUE network)
7474
private void updatePV(Move move, int ply)
7575
{
7676
threadData.pv[ply][0] = move;
77-
System.arraycopy(threadData.pv[ply + 1], 0, threadData.pv[ply], 1, MAX_PLY - 1);
78-
threadData.pv[ply + 1][0] = null;
77+
System.arraycopy(threadData.pv[ply + 1], 0, threadData.pv[ply], 1, MAX_PLY);
7978
}
8079

8180
private void clearPV()
@@ -284,6 +283,11 @@ private int mainSearch(Board board, int depth, int alpha, int beta, int ply, boo
284283
inCheck = sse.inCheck = board.isKingAttacked();
285284
inSingularSearch = sse.excludedMove != null;
286285

286+
if (isPV)
287+
{
288+
threadData.pv[ply][0] = null;
289+
}
290+
287291
if ((nodesCount & 1023) == 0 && (timeManager.shouldStop() || (nodesLimit > 0 && nodesCount > nodesLimit)))
288292
{
289293
throw new TimeOutException();
@@ -577,9 +581,9 @@ else if (givesCheck)
577581
r -= isPV ? 1 : 0;
578582
r -= givesCheck ? 1 : 0;
579583
r += cutNode ? 1 : 0;
580-
584+
581585
final int history = threadData.history.get(board, move) + 4500;
582-
586+
583587
r -= history / 5000;
584588

585589
int d = newdepth - r;

0 commit comments

Comments
 (0)