mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 00:56:39 +08:00
Test killer for legality earlier
Many killers moves, around 40%, are not legal, so skip earlier in this case. Some Movepicker c'tor cleanup while there. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -70,18 +70,18 @@ namespace {
|
|||||||
/// search captures, promotions and some checks) and about how important good
|
/// search captures, promotions and some checks) and about how important good
|
||||||
/// move ordering is at the current node.
|
/// move ordering is at the current node.
|
||||||
|
|
||||||
MovePicker::MovePicker(const Position& p, Move ttm, Depth d,
|
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
|
||||||
const History& h, SearchStack* ss, Value beta) : pos(p), H(h) {
|
SearchStack* ss, Value beta) : pos(p), H(h) {
|
||||||
int searchTT = ttm;
|
int searchTT = ttm;
|
||||||
ttMoves[0].move = ttm;
|
ttMoves[0].move = ttm;
|
||||||
lastBadCapture = badCaptures;
|
|
||||||
badCaptureThreshold = 0;
|
badCaptureThreshold = 0;
|
||||||
|
lastBadCapture = badCaptures;
|
||||||
|
|
||||||
pinned = p.pinned_pieces(pos.side_to_move());
|
pinned = p.pinned_pieces(pos.side_to_move());
|
||||||
|
|
||||||
if (ss && !p.is_check())
|
if (ss && !p.is_check())
|
||||||
{
|
{
|
||||||
ttMoves[1].move = (ss->mateKiller == ttm)? MOVE_NONE : ss->mateKiller;
|
ttMoves[1].move = (ss->mateKiller == ttm) ? MOVE_NONE : ss->mateKiller;
|
||||||
searchTT |= ttMoves[1].move;
|
searchTT |= ttMoves[1].move;
|
||||||
killers[0].move = ss->killers[0];
|
killers[0].move = ss->killers[0];
|
||||||
killers[1].move = ss->killers[1];
|
killers[1].move = ss->killers[1];
|
||||||
@@ -98,7 +98,8 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d,
|
|||||||
badCaptureThreshold = -PawnValueMidgame;
|
badCaptureThreshold = -PawnValueMidgame;
|
||||||
|
|
||||||
phasePtr = MainSearchPhaseTable;
|
phasePtr = MainSearchPhaseTable;
|
||||||
} else if (d == Depth(0))
|
}
|
||||||
|
else if (d == Depth(0))
|
||||||
phasePtr = QsearchWithChecksPhaseTable;
|
phasePtr = QsearchWithChecksPhaseTable;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -312,9 +313,9 @@ Move MovePicker::get_next_move() {
|
|||||||
case PH_KILLERS:
|
case PH_KILLERS:
|
||||||
move = (curMove++)->move;
|
move = (curMove++)->move;
|
||||||
if ( move != MOVE_NONE
|
if ( move != MOVE_NONE
|
||||||
|
&& move_is_legal(pos, move, pinned)
|
||||||
&& move != ttMoves[0].move
|
&& move != ttMoves[0].move
|
||||||
&& move != ttMoves[1].move
|
&& move != ttMoves[1].move
|
||||||
&& move_is_legal(pos, move, pinned)
|
|
||||||
&& !pos.move_is_capture(move))
|
&& !pos.move_is_capture(move))
|
||||||
return move;
|
return move;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user