Skip to main content

iterative_negamax

Function iterative_negamax 

Source
pub fn iterative_negamax(
    position: Position,
    ply: PlyKind,
    mode: Mode,
    history: History,
    tt: &TranspositionTable,
    stopper: Arc<AtomicBool>,
) -> Option<SearchResult>
Expand description

Iterative fail-soft Negamax implementation with alpha-beta pruning and transposition table lookup.

In fail-soft, the return value of a call can exceed its given bounds alpha and beta (score < alpha, score > beta).

Why change from recursive to iterative?

  • Need to be able to STOP searching at any time. This is hard to do from a recursive search without changing/checking return value.
  • Makes it easier to tell how far a node is from root.
  • Easy to stop without risk of corrupting transposition table entries.