fn nmp_can_be_applied<const PV: bool>(
    context: &mut SearchContext,
    depth: i8,
    beta: i16,
    allow_null_move: bool,
    friendly_king_checked: bool
) -> bool
Expand description

The main idea of the null move pruning is to prune all nodes, for which the search gives us score above beta even if we skip a move (which allows the opposite color to make two of them in a row). This is based on the null move observation, which says that there’s always a better alternative than doing nothing (except zugzwang).

Conditions:

  • only non-PV nodes
  • depth >= nmp_min_depth
  • game phase is not indicating endgame
  • beta score is not a mate score
  • friendly king is not checked
  • this is not the second null move in a row