Skip to content

Commit

Permalink
Extract a reliable PV line
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mcostalba committed May 17, 2014
1 parent 5ec63eb commit e46a72d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,7 @@ void RootMove::extract_pv_from_tt(Position& pos) {
const TTEntry* tte;
int ply = 0;
Move m = pv[0];
Value expectedScore = score;

pv.clear();

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

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

} while ( tte
&& expectedScore == value_from_tt(tte->value(), ply)
&& pos.pseudo_legal(m = tte->move()) // Local copy, TT could change
&& pos.legal(m, pos.pinned_pieces(pos.side_to_move()))
&& ply < MAX_PLY
Expand Down

0 comments on commit e46a72d

Please sign in to comment.