- // Static null move pruning. We're betting that the opponent doesn't have
- // a move that will reduce the score by more than FutilityMargins[int(depth)]
- // if we do a null move.
+ // Step 6. Razoring
+ if ( !value_is_mate(beta)
+ && !isCheck
+ && depth < RazorDepth
+ && staticValue < beta - (0x200 + 16 * 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 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);
+ }
+
+ // Step 7. Static null move pruning
+ // We're betting that the opponent doesn't have a move that will reduce
+ // the score by more than fuility_margin(depth) if we do a null move.