X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmovepick.cpp;h=5163e87ca67710ed14f92224075e215ae2c6d85e;hp=19785b64ab027606e138a44da71c16f8d12442b7;hb=3a2cd370802db61dc3060b81d613444363cf0371;hpb=a4a0ffce711962c0b04b35998c3c06491be373bf diff --git a/src/movepick.cpp b/src/movepick.cpp index 19785b64..5163e87c 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 { @@ -220,7 +221,6 @@ void MovePicker::score_noncaptures() { Move m; Piece piece; Square from, to; - int hs; for (MoveStack* cur = moves; cur != lastMove; cur++) { @@ -228,14 +228,7 @@ void MovePicker::score_noncaptures() { from = move_from(m); to = move_to(m); piece = pos.piece_on(from); - hs = H.move_ordering_score(piece, to); - - // Ensure history has always highest priority - if (hs > 0) - hs += 10000; - - // Gain table based scoring - cur->score = hs + 16 * H.gain(piece, to); + cur->score = H.value(piece, to) + H.gain(piece, to); } } @@ -260,7 +253,7 @@ void MovePicker::score_evasions_or_checks() { cur->score = pos.midgame_value_of_piece_on(move_to(m)) - pos.type_of_piece_on(move_from(m)) + HistoryMax; else - cur->score = H.move_ordering_score(pos.piece_on(move_from(m)), move_to(m)); + cur->score = H.value(pos.piece_on(move_from(m)), move_to(m)); } } @@ -312,9 +305,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;