mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 11:39:15 +00:00
Move legal check out of MovePicker
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
45ce92b89c
commit
4b232f5ddc
3 changed files with 11 additions and 17 deletions
|
@ -64,8 +64,6 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
|
|||
|
||||
assert(d > DEPTH_ZERO);
|
||||
|
||||
pinned = p.pinned_pieces(pos.side_to_move());
|
||||
|
||||
if (p.in_check())
|
||||
{
|
||||
ttMoves[1].move = killers[0].move = killers[1].move = MOVE_NONE;
|
||||
|
@ -98,8 +96,6 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h)
|
|||
|
||||
assert(d <= DEPTH_ZERO);
|
||||
|
||||
pinned = p.pinned_pieces(pos.side_to_move());
|
||||
|
||||
if (p.in_check())
|
||||
phasePtr = EvasionTable;
|
||||
else if (d >= DEPTH_QS_CHECKS)
|
||||
|
@ -275,16 +271,14 @@ Move MovePicker::get_next_move() {
|
|||
case PH_TT_MOVES:
|
||||
move = (curMove++)->move;
|
||||
if ( move != MOVE_NONE
|
||||
&& pos.move_is_pl(move)
|
||||
&& pos.pl_move_is_legal(move, pinned))
|
||||
&& pos.move_is_pl(move))
|
||||
return move;
|
||||
break;
|
||||
|
||||
case PH_GOOD_CAPTURES:
|
||||
move = pick_best(curMove++, lastMove).move;
|
||||
if ( move != ttMoves[0].move
|
||||
&& move != ttMoves[1].move
|
||||
&& pos.pl_move_is_legal(move, pinned))
|
||||
&& move != ttMoves[1].move)
|
||||
{
|
||||
// Check for a non negative SEE now
|
||||
int seeValue = pos.see_sign(move);
|
||||
|
@ -302,7 +296,6 @@ Move MovePicker::get_next_move() {
|
|||
move = (curMove++)->move;
|
||||
if ( move != MOVE_NONE
|
||||
&& pos.move_is_pl(move)
|
||||
&& pos.pl_move_is_legal(move, pinned)
|
||||
&& move != ttMoves[0].move
|
||||
&& move != ttMoves[1].move
|
||||
&& !pos.move_is_capture(move))
|
||||
|
@ -318,8 +311,7 @@ Move MovePicker::get_next_move() {
|
|||
if ( move != ttMoves[0].move
|
||||
&& move != ttMoves[1].move
|
||||
&& move != killers[0].move
|
||||
&& move != killers[1].move
|
||||
&& pos.pl_move_is_legal(move, pinned))
|
||||
&& move != killers[1].move)
|
||||
return move;
|
||||
break;
|
||||
|
||||
|
@ -330,15 +322,13 @@ Move MovePicker::get_next_move() {
|
|||
case PH_EVASIONS:
|
||||
case PH_QCAPTURES:
|
||||
move = pick_best(curMove++, lastMove).move;
|
||||
if ( move != ttMoves[0].move
|
||||
&& pos.pl_move_is_legal(move, pinned))
|
||||
if (move != ttMoves[0].move)
|
||||
return move;
|
||||
break;
|
||||
|
||||
case PH_QCHECKS:
|
||||
move = (curMove++)->move;
|
||||
if ( move != ttMoves[0].move
|
||||
&& pos.pl_move_is_legal(move, pinned))
|
||||
if ( move != ttMoves[0].move)
|
||||
return move;
|
||||
break;
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ private:
|
|||
|
||||
const Position& pos;
|
||||
const History& H;
|
||||
Bitboard pinned;
|
||||
MoveStack ttMoves[2], killers[2];
|
||||
int badCaptureThreshold, phase;
|
||||
const uint8_t* phasePtr;
|
||||
|
|
|
@ -880,6 +880,7 @@ split_point_start: // At split points actual search starts from here
|
|||
// Initialize a MovePicker object for the current position
|
||||
MovePickerExt<SpNode, Root> mp(pos, ttMove, depth, H, ss, (PvNode ? -VALUE_INFINITE : beta));
|
||||
CheckInfo ci(pos);
|
||||
Bitboard pinned = pos.pinned_pieces(pos.side_to_move());
|
||||
ss->bestMove = MOVE_NONE;
|
||||
futilityBase = ss->eval + ss->evalMargin;
|
||||
singularExtensionNode = !Root
|
||||
|
@ -908,7 +909,7 @@ split_point_start: // At split points actual search starts from here
|
|||
moveCount = ++sp->moveCount;
|
||||
lock_release(&(sp->lock));
|
||||
}
|
||||
else if (move == excludedMove)
|
||||
else if (move == excludedMove || !pos.pl_move_is_legal(move, pinned))
|
||||
continue;
|
||||
else
|
||||
moveCount++;
|
||||
|
@ -1325,6 +1326,7 @@ split_point_start: // At split points actual search starts from here
|
|||
// be generated.
|
||||
MovePicker mp(pos, ttMove, depth, H);
|
||||
CheckInfo ci(pos);
|
||||
Bitboard pinned = pos.pinned_pieces(pos.side_to_move());
|
||||
|
||||
// Loop through the moves until no moves remain or a beta cutoff occurs
|
||||
while ( alpha < beta
|
||||
|
@ -1332,6 +1334,9 @@ split_point_start: // At split points actual search starts from here
|
|||
{
|
||||
assert(move_is_ok(move));
|
||||
|
||||
if (!pos.pl_move_is_legal(move, pinned))
|
||||
continue;
|
||||
|
||||
givesCheck = pos.move_gives_check(move, ci);
|
||||
|
||||
// Futility pruning
|
||||
|
|
Loading…
Add table
Reference in a new issue