mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Revert hidden checkers rework
It is slower the previous uglier but faster code. So completely restore old one for now :-( Just leave in the rework of status backup/restore in do_move(). We will cherry pick bits of previous work once we are sure we have fixed the performance regression. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -96,6 +96,9 @@ MovePicker::MovePicker(const Position& p, bool pv, Move ttm,
|
||||
else
|
||||
phaseIndex = (noCaptures ? NoMovesPhaseIndex : QsearchWithoutChecksPhaseIndex);
|
||||
|
||||
dc = p.discovered_check_candidates(us);
|
||||
pinned = p.pinned_pieces(us);
|
||||
|
||||
finished = false;
|
||||
}
|
||||
|
||||
@@ -127,7 +130,7 @@ Move MovePicker::get_next_move() {
|
||||
if (ttMove != MOVE_NONE)
|
||||
{
|
||||
assert(move_is_ok(ttMove));
|
||||
if (move_is_legal(pos, ttMove))
|
||||
if (move_is_legal(pos, ttMove, pinned))
|
||||
return ttMove;
|
||||
}
|
||||
break;
|
||||
@@ -136,7 +139,7 @@ Move MovePicker::get_next_move() {
|
||||
if (mateKiller != MOVE_NONE)
|
||||
{
|
||||
assert(move_is_ok(mateKiller));
|
||||
if (move_is_legal(pos, mateKiller))
|
||||
if (move_is_legal(pos, mateKiller, pinned))
|
||||
return mateKiller;
|
||||
}
|
||||
break;
|
||||
@@ -159,7 +162,7 @@ Move MovePicker::get_next_move() {
|
||||
|
||||
case PH_EVASIONS:
|
||||
assert(pos.is_check());
|
||||
numOfMoves = generate_evasions(pos, moves);
|
||||
numOfMoves = generate_evasions(pos, moves, pinned);
|
||||
score_evasions();
|
||||
movesPicked = 0;
|
||||
break;
|
||||
@@ -171,7 +174,7 @@ Move MovePicker::get_next_move() {
|
||||
break;
|
||||
|
||||
case PH_QCHECKS:
|
||||
numOfMoves = generate_checks(pos, moves);
|
||||
numOfMoves = generate_checks(pos, moves, dc);
|
||||
movesPicked = 0;
|
||||
break;
|
||||
|
||||
@@ -391,7 +394,7 @@ Move MovePicker::pick_move_from_list() {
|
||||
moves[bestIndex] = moves[movesPicked++];
|
||||
if ( move != ttMove
|
||||
&& move != mateKiller
|
||||
&& pos.pl_move_is_legal(move))
|
||||
&& pos.pl_move_is_legal(move, pinned))
|
||||
return move;
|
||||
}
|
||||
break;
|
||||
@@ -411,7 +414,7 @@ Move MovePicker::pick_move_from_list() {
|
||||
moves[bestIndex] = moves[movesPicked++];
|
||||
if ( move != ttMove
|
||||
&& move != mateKiller
|
||||
&& pos.pl_move_is_legal(move))
|
||||
&& pos.pl_move_is_legal(move, pinned))
|
||||
return move;
|
||||
}
|
||||
break;
|
||||
@@ -439,7 +442,7 @@ Move MovePicker::pick_move_from_list() {
|
||||
move = badCaptures[movesPicked++].move;
|
||||
if ( move != ttMove
|
||||
&& move != mateKiller
|
||||
&& pos.pl_move_is_legal(move))
|
||||
&& pos.pl_move_is_legal(move, pinned))
|
||||
return move;
|
||||
}
|
||||
break;
|
||||
@@ -454,7 +457,7 @@ Move MovePicker::pick_move_from_list() {
|
||||
moves[bestIndex] = moves[movesPicked++];
|
||||
// Remember to change the line below if we decide to hash the qsearch!
|
||||
// Maybe also postpone the legality check until after futility pruning?
|
||||
if (/* move != ttMove && */ pos.pl_move_is_legal(move))
|
||||
if (/* move != ttMove && */ pos.pl_move_is_legal(move, pinned))
|
||||
return move;
|
||||
}
|
||||
break;
|
||||
@@ -468,7 +471,7 @@ Move MovePicker::pick_move_from_list() {
|
||||
{
|
||||
move = moves[movesPicked++].move;
|
||||
// Remember to change the line below if we decide to hash the qsearch!
|
||||
if (/* move != ttMove && */ pos.pl_move_is_legal(move))
|
||||
if (/* move != ttMove && */ pos.pl_move_is_legal(move, pinned))
|
||||
return move;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user