X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmovepick.cpp;h=63f77dbaebfc14570cb4ff56408348fa4b15adb0;hp=10835e6872e832a06d36e51e77f22c93757c2d64;hb=6776f76d20a205b19eb8f5c000debe9df9094bb3;hpb=9fc602bae74b8e09bd45ace3b42a8ce84d56b23c diff --git a/src/movepick.cpp b/src/movepick.cpp index 10835e68..63f77dba 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -70,18 +70,18 @@ namespace { /// search captures, promotions and some checks) and about how important good /// move ordering is at the current node. -MovePicker::MovePicker(const Position& p, Move ttm, Depth d, - const History& h, SearchStack* ss, Value beta) : pos(p), H(h) { +MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h, + SearchStack* ss, Value beta) : pos(p), H(h) { int searchTT = ttm; ttMoves[0].move = ttm; - lastBadCapture = badCaptures; badCaptureThreshold = 0; + lastBadCapture = badCaptures; pinned = p.pinned_pieces(pos.side_to_move()); 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; killers[0].move = ss->killers[0]; killers[1].move = ss->killers[1]; @@ -98,7 +98,8 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, badCaptureThreshold = -PawnValueMidgame; phasePtr = MainSearchPhaseTable; - } else if (d == Depth(0)) + } + else if (d == Depth(0)) phasePtr = QsearchWithChecksPhaseTable; else { @@ -111,7 +112,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, searchTT = ttMoves[0].move = MOVE_NONE; } - phasePtr += !searchTT - 1; + phasePtr += int(!searchTT) - 1; go_next_phase(); } @@ -312,9 +313,9 @@ Move MovePicker::get_next_move() { case PH_KILLERS: move = (curMove++)->move; if ( move != MOVE_NONE + && move_is_legal(pos, move, pinned) && move != ttMoves[0].move && move != ttMoves[1].move - && move_is_legal(pos, move, pinned) && !pos.move_is_capture(move)) return move; break;