mwg API
    Preparing search index...

    Function search

    • The full negamax result behind chooseMove - the move it would play, its evaluation, and how many positions it visited to get there.

      Parameters

      Returns ChessSearchResult

      import { search, startingChess } from '@datamoc/mw_games/board';

      const result = search(startingChess(), { depth: 2 });
      console.log(result.move !== null); // true - the opening position always has legal moves
      console.log(typeof result.score, typeof result.nodes); // 'number' 'number'