X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmovepick.cpp;h=61e5527f42c61d638132201f0b2f2efd18bc999a;hp=b35d1012cb817f718f6700d495fd9f08a5276ee1;hb=a21a110188eed1ff41f2a1535a93b48c654663de;hpb=fca0a2dd881e6bde0a01d3342dd385600e01730b diff --git a/src/movepick.cpp b/src/movepick.cpp index b35d1012..61e5527f 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -32,7 +32,8 @@ namespace { PH_GOOD_CAPTURES, // Queen promotions and captures with SEE values >= captureThreshold (captureThreshold <= 0) PH_GOOD_PROBCUT, // Queen promotions and captures with SEE values > captureThreshold (captureThreshold >= 0) PH_KILLERS, // Killer moves from the current ply - PH_NONCAPTURES, // Non-captures and underpromotions + PH_NONCAPTURES_1, // Non-captures and underpromotions with positive score + PH_NONCAPTURES_2, // Non-captures and underpromotions with non-positive score PH_BAD_CAPTURES, // Queen promotions and captures with SEE values < captureThreshold (captureThreshold <= 0) PH_EVASIONS, // Check evasions PH_QCAPTURES, // Captures in quiescence search @@ -41,7 +42,7 @@ namespace { }; CACHE_LINE_ALIGNMENT - const uint8_t MainSearchTable[] = { PH_TT_MOVE, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES, PH_BAD_CAPTURES, PH_STOP }; + const uint8_t MainSearchTable[] = { PH_TT_MOVE, PH_GOOD_CAPTURES, PH_KILLERS, PH_NONCAPTURES_1, PH_NONCAPTURES_2, PH_BAD_CAPTURES, PH_STOP }; const uint8_t EvasionTable[] = { PH_TT_MOVE, PH_EVASIONS, PH_STOP }; const uint8_t QsearchWithChecksTable[] = { PH_TT_MOVE, PH_QCAPTURES, PH_QCHECKS, PH_STOP }; const uint8_t QsearchWithoutChecksTable[] = { PH_TT_MOVE, PH_QCAPTURES, PH_STOP }; @@ -55,7 +56,7 @@ namespace { /// 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) { + SearchStack* ss, Value beta) : pos(p), H(h), depth(d) { captureThreshold = 0; badCaptures = moves + MAX_MOVES; @@ -152,10 +153,17 @@ void MovePicker::go_next_phase() { lastMove = curMove + 2; return; - case PH_NONCAPTURES: - lastMove = generate(pos, moves); + case PH_NONCAPTURES_1: + lastNonCapture = lastMove = generate(pos, moves); score_noncaptures(); - sort_moves(moves, lastMove, &lastGoodNonCapture); + sort_moves(moves, lastNonCapture, &lastMove); + return; + + case PH_NONCAPTURES_2: + curMove = lastMove; + lastMove = lastNonCapture; + if (depth >= 3 * ONE_PLY) + insertion_sort(curMove, lastMove); return; case PH_BAD_CAPTURES: @@ -319,11 +327,8 @@ Move MovePicker::get_next_move() { return move; break; - case PH_NONCAPTURES: - // Sort negative scored moves only when we get there - if (curMove == lastGoodNonCapture) - insertion_sort(lastGoodNonCapture, lastMove); - + case PH_NONCAPTURES_1: + case PH_NONCAPTURES_2: move = (curMove++)->move; if ( move != ttMove && move != killers[0].move