1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 09:13:08 +00:00

Test for legality only after futility pruning

Although there is a small functional change it seems
an improvment of about 2% in speed !

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2011-05-23 15:14:47 +02:00
parent 4b232f5ddc
commit 9884573561

View file

@ -909,7 +909,7 @@ split_point_start: // At split points actual search starts from here
moveCount = ++sp->moveCount; moveCount = ++sp->moveCount;
lock_release(&(sp->lock)); lock_release(&(sp->lock));
} }
else if (move == excludedMove || !pos.pl_move_is_legal(move, pinned)) else if (move == excludedMove)
continue; continue;
else else
moveCount++; moveCount++;
@ -950,6 +950,7 @@ split_point_start: // At split points actual search starts from here
// a margin then we extend ttMove. // a margin then we extend ttMove.
if ( singularExtensionNode if ( singularExtensionNode
&& move == ttMove && move == ttMove
&& pos.pl_move_is_legal(move, pinned)
&& ext < ONE_PLY) && ext < ONE_PLY)
{ {
Value ttValue = value_from_tt(tte->value(), ss->ply); Value ttValue = value_from_tt(tte->value(), ss->ply);
@ -969,7 +970,6 @@ split_point_start: // At split points actual search starts from here
} }
// Update current move (this must be done after singular extension search) // Update current move (this must be done after singular extension search)
ss->currentMove = move;
newDepth = depth - ONE_PLY + ext; newDepth = depth - ONE_PLY + ext;
// Step 12. Futility pruning (is omitted in PV nodes) // Step 12. Futility pruning (is omitted in PV nodes)
@ -1024,6 +1024,12 @@ split_point_start: // At split points actual search starts from here
} }
} }
// Check for legality only before to do the move
if (!pos.pl_move_is_legal(move, pinned))
continue;
ss->currentMove = move;
// Step 13. Make the move // Step 13. Make the move
pos.do_move(move, st, ci, givesCheck); pos.do_move(move, st, ci, givesCheck);
@ -1334,9 +1340,6 @@ split_point_start: // At split points actual search starts from here
{ {
assert(move_is_ok(move)); assert(move_is_ok(move));
if (!pos.pl_move_is_legal(move, pinned))
continue;
givesCheck = pos.move_gives_check(move, ci); givesCheck = pos.move_gives_check(move, ci);
// Futility pruning // Futility pruning
@ -1396,6 +1399,10 @@ split_point_start: // At split points actual search starts from here
continue; continue;
} }
// Check for legality only before to do the move
if (!pos.pl_move_is_legal(move, pinned))
continue;
// Update current move // Update current move
ss->currentMove = move; ss->currentMove = move;