mwg API
    Preparing search index...

    Function tourneyThink

    • The tournament engine's serializable task: a full iterative-deepening search over a bitboard position, with nothing outside its own body.

      threads.spawn rehydrates this function in a worker with new Function, so it may not reference imports, module scope, or any outer binding: every rule it touches is nested inside it. The main-thread wrappers call this same function directly, so the two sides cannot diverge the way a copied worker body could.

      What it does, per Roadmap item 390 phase 1: negamax alpha-beta with principal variation search, null-move pruning, late-move reductions, iterative deepening with aspiration windows, a bounded transposition table over Zobrist keys, quiescence over captures and promotions, ordering by hash move then MVV-LVA captures then killers then history, and a classical material plus in-house piece-square evaluation. Positions are plain bitboard data, so they structured-clone into a worker untouched.

      Draws: stalemate, fifty moves, KvK/KBvK/KNvK dead material, and repetition along the search path all score 0. Repetition only sees the path from the searched position, not the game before it; mate scores prefer the faster mate.

      Parameters

      • position: BitboardState
      • options: { depth?: number; maxNodes?: number; signal?: AbortSignal; timeMs?: number } = {}

      Returns TourneyResult