X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=d2e3cd32caef87b97a523d53708532de0c9a0c71;hp=56f89456373fc5d6043d8d12fa4d431810aa1d37;hb=01b228b5e179d2e15927d617c5415302be234e3f;hpb=3888d14bd401ea26ea053b56ff3c8896a4e810d3 diff --git a/src/search.cpp b/src/search.cpp index 56f89456..d2e3cd32 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -158,35 +158,40 @@ namespace { }; - /// Constants + /// Adjustments - // Search depth at iteration 1 - const Depth InitialDepth = OnePly; + // Step 6. Razoring + + const Depth RazorDepth = 4 * OnePly; + inline Value razor_margin(Depth d) { return Value(0x200 + 0x10 * d); } - // Use internal iterative deepening? - const bool UseIIDAtPVNodes = true; - const bool UseIIDAtNonPVNodes = true; + // Step 8. Null move search with verification search - // Internal iterative deepening margin. At Non-PV moves, when - // UseIIDAtNonPVNodes is true, we do an internal iterative deepening + // Null move margin. A null move search will not be done if the static + // evaluation of the position is more than NullMoveMargin below beta. + const Value NullMoveMargin = Value(0x200); + + // Step 9. Internal iterative deepening + + const Depth IIDDepthAtPVNodes = 5 * OnePly; + const Depth IIDDepthAtNonPVNodes = 8 * OnePly; + + // Internal iterative deepening margin. At Non-PV nodes + // we do an internal iterative deepening // search when the static evaluation is at most IIDMargin below beta. const Value IIDMargin = Value(0x100); + // Search depth at iteration 1 + const Depth InitialDepth = OnePly; + // Easy move margin. An easy move candidate must be at least this much // better than the second best move. const Value EasyMoveMargin = Value(0x200); - // Null move margin. A null move search will not be done if the static - // evaluation of the position is more than NullMoveMargin below beta. - const Value NullMoveMargin = Value(0x200); - // If the TT move is at least SingleReplyMargin better then the // remaining ones we will extend it. const Value SingleReplyMargin = Value(0x20); - // Depth limit for razoring - const Depth RazorDepth = 4 * OnePly; - /// Lookup tables initialized at startup // Reduction lookup tables and their getter functions @@ -1096,8 +1101,7 @@ namespace { // Step 8. Null move search with verification search (is omitted in PV nodes) // Step 9. Internal iterative deepening - if ( UseIIDAtPVNodes - && depth >= 5*OnePly + if ( depth >= IIDDepthAtPVNodes && ttMove == MOVE_NONE) { search_pv(pos, ss, alpha, beta, depth-2*OnePly, ply, threadID); @@ -1332,15 +1336,15 @@ namespace { if ( !value_is_mate(beta) && !isCheck && depth < RazorDepth - && refinedValue < beta - (0x200 + 16 * depth) + && refinedValue < beta - razor_margin(depth) && ss[ply - 1].currentMove != MOVE_NULL && ttMove == MOVE_NONE && !pos.has_pawn_on_7th(pos.side_to_move())) { - Value rbeta = beta - (0x200 + 16 * depth); + Value rbeta = beta - razor_margin(depth); Value v = qsearch(pos, ss, rbeta-1, rbeta, Depth(0), ply, threadID); if (v < rbeta) - return v; //FIXME: Logically should be: return (v + 0x200 + 16 * depth); + return v; //FIXME: Logically should be: return (v + razor_margin(depth)); } // Step 7. Static null move pruning @@ -1406,8 +1410,10 @@ namespace { } // Step 9. Internal iterative deepening - if (UseIIDAtNonPVNodes && ttMove == MOVE_NONE && depth >= 8*OnePly && - !isCheck && ss[ply].eval >= beta - IIDMargin) + if ( depth >= IIDDepthAtNonPVNodes + && ttMove == MOVE_NONE + && !isCheck + && ss[ply].eval >= beta - IIDMargin) { search(pos, ss, beta, depth/2, ply, false, threadID); ttMove = ss[ply].pv[ply];