mwg API
    Preparing search index...

    Function perft

    • Move-generation node count: 1 at depth 0, else the sum over every legal move. The position is played and taken back as it goes, so it reads identical afterwards. Counts match the published perft numbers, which is the whole point: a wrong move generator cannot hide from them.

      Parameters

      Returns number

      import { perft, startingBitboard } from '@datamoc/mwg/board';

      console.log(perft(startingBitboard(), 2)); // 400 - the opening's two-ply count