Skip to content

Commit

Permalink
Fix Illegal PV (#115)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xu-shawn authored Aug 14, 2024
1 parent 4aca025 commit c580965
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ public AlphaBeta(TranspositionTable tt, NNUE network)
private void updatePV(Move move, int ply)
{
threadData.pv[ply][0] = move;
System.arraycopy(threadData.pv[ply + 1], 0, threadData.pv[ply], 1, MAX_PLY - 1);
threadData.pv[ply + 1][0] = null;
System.arraycopy(threadData.pv[ply + 1], 0, threadData.pv[ply], 1, MAX_PLY);
}

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

if (isPV)
{
threadData.pv[ply][0] = null;
}

if ((nodesCount & 1023) == 0 && (timeManager.shouldStop() || (nodesLimit > 0 && nodesCount > nodesLimit)))
{
throw new TimeOutException();
Expand Down Expand Up @@ -577,9 +581,9 @@ else if (givesCheck)
r -= isPV ? 1 : 0;
r -= givesCheck ? 1 : 0;
r += cutNode ? 1 : 0;

final int history = threadData.history.get(board, move) + 4500;

r -= history / 5000;

int d = newdepth - r;
Expand Down

0 comments on commit c580965

Please sign in to comment.