Skip to content

Commit

Permalink
Fix illegal move in PV when mate in next move.
Browse files Browse the repository at this point in the history
  • Loading branch information
petur committed Nov 12, 2022
1 parent a7c334f commit 0334bb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions seawall.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,11 @@ std::pair<int, Move> Search::search(bool pv, int ply, int depth, int alpha, int
}

if (move_count == 0)
{
if (pv)
pv_lines[ply].length = 0;
return {checkers ? -SCORE_MATE + ply : 0, NO_MOVE};
}
if (ply > 0 && position.halfmove_clock >= 100)
return {0, NULL_MOVE};

Expand Down
2 changes: 2 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,7 @@ echo 'position fen 6Q1/8/8/8/8/7K/8/7k b - - 0 1'
echo 'go depth 1'
echo 'position fen 7Q/8/8/8/8/8/8/5K1k b - - 0 1'
echo 'go depth 1'
echo 'position fen 6k1/5p1p/2pB4/8/1ppPp3/2n1P2p/p1PK1q2/Q7 w - - 0 49 moves d2c1 f2f1 c1d2 c3b1'
echo 'go wtime 33 winc 0 btime 31 binc 0 movestogo 32'
echo 'quit'
) | ./seawall

0 comments on commit 0334bb8

Please sign in to comment.