Skip to content

Commit e46a72d

Browse files
committed
Extract a reliable PV line
Truncate the extracted PV from the point where the score stored in hash starts to deviate from the root score. Idea from Ronald de Man. bench: 8732553
1 parent 5ec63eb commit e46a72d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/search.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,7 @@ void RootMove::extract_pv_from_tt(Position& pos) {
14011401
const TTEntry* tte;
14021402
int ply = 0;
14031403
Move m = pv[0];
1404+
Value expectedScore = score;
14041405

14051406
pv.clear();
14061407

@@ -1411,8 +1412,10 @@ void RootMove::extract_pv_from_tt(Position& pos) {
14111412

14121413
pos.do_move(pv[ply++], *st++);
14131414
tte = TT.probe(pos.key());
1415+
expectedScore = -expectedScore;
14141416

14151417
} while ( tte
1418+
&& expectedScore == value_from_tt(tte->value(), ply)
14161419
&& pos.pseudo_legal(m = tte->move()) // Local copy, TT could change
14171420
&& pos.legal(m, pos.pinned_pieces(pos.side_to_move()))
14181421
&& ply < MAX_PLY

0 commit comments

Comments
 (0)