Extend full 3 fold detection to PvNodes

And restore old behaviour of not returning from a RootNode
without updating RootMoves[].

Also renamed is_draw() template parameters to reflect a
'positive' logic (Check instead of Skip) that is easier
to follow.

New bench: 5312693
This commit is contained in:
Marco Costalba
2012-10-26 11:56:33 +02:00
parent 71f37ac1aa
commit c594b989c0
3 changed files with 14 additions and 26 deletions
+3 -7
View File
@@ -524,7 +524,7 @@ namespace {
if (!RootNode)
{
// Step 2. Check for aborted search and immediate draw
if (Signals.stop || pos.is_draw<false,true>() || ss->ply > MAX_PLY)
if (Signals.stop || pos.is_draw<true, PvNode>() || ss->ply > MAX_PLY)
return DrawValue[pos.side_to_move()];
// Step 3. Mate distance pruning. Even if we mate at the next move our score
@@ -538,10 +538,6 @@ namespace {
if (alpha >= beta)
return alpha;
}
else
{
if(pos.is_draw<false,false>()) return DrawValue[pos.side_to_move()];
}
// Step 4. Transposition table lookup
// We don't want the score of a partial search to overwrite a previous full search
@@ -1107,7 +1103,7 @@ split_point_start: // At split points actual search starts from here
ss->ply = (ss-1)->ply + 1;
// Check for an instant draw or maximum ply reached
if (pos.is_draw<true,true>() || ss->ply > MAX_PLY)
if (pos.is_draw<false, false>() || ss->ply > MAX_PLY)
return DrawValue[pos.side_to_move()];
// Transposition table lookup. At PV nodes, we don't use the TT for
@@ -1556,7 +1552,7 @@ void RootMove::extract_pv_from_tt(Position& pos) {
&& pos.is_pseudo_legal(m)
&& pos.pl_move_is_legal(m, pos.pinned_pieces())
&& ply < MAX_PLY
&& (!pos.is_draw<false,true>() || ply < 2))
&& (!pos.is_draw<true, true>() || ply < 2))
{
pv.push_back(m);
pos.do_move(m, *st++);