Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Two bug fixes:
1. Wrong sign in probe_dtz() (fixed in SF master some months ago) which may cause probe_dtz() to return -1 if the position is losing with abs(dtz) > 1 and a (losing) ep capture is available.

2. In testing pawn moves in probe_dtz_no_ep(), probe_ab() was called also if the pawn move is a double push and creates ep rights. But probe_ab() does not test ep captures.
  • Loading branch information
Ronald de Man committed Jun 7, 2016
1 parent f1bb977 commit 6856817
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions interface/tbprobe.cpp
Expand Up @@ -485,7 +485,9 @@ static int probe_dtz_no_ep(Position& pos, int *success)
|| !pos.legal(move, ci.pinned))
continue;
pos.do_move(move, st, ci, pos.gives_check(move, ci));
int v = -probe_ab(pos, -2, -wdl + 1, success);
int v = pos.ep_square() == SQ_NONE ? -probe_ab(pos, -2, -wdl + 1, success)
: -probe_wdl(pos, success);

pos.undo_move(move);
if (*success == 0) return 0;
if (v == wdl)
Expand Down Expand Up @@ -618,7 +620,7 @@ int probe_dtz(Position& pos, int *success)
if (v1 >= 0)
v = v1;
} else if (v < 0) {
if (v1 >= 0 || v1 < 100)
if (v1 >= 0 || v1 < -100)
v = v1;
} else if (v > 100) {
if (v1 > 0)
Expand Down

0 comments on commit 6856817

Please sign in to comment.