Echecs.Perft (Echecs v0.1.5)

Copy Markdown View Source

Performance-test (perft) helpers for validating move generation.

perft/2 counts leaf nodes from a %Game{}; perft_fast/5 and perft_fast/6 recurse on raw (board_tuple, turn, castling, en_passant) state without allocating game structs. perft_parallel/2 distributes root moves over all schedulers and divide/2 returns per-root-move counts for debugging. Compare results against the standard reference nodes (start position depth 5: 4,865,609; Kiwipete depth 3: 97,862).

Summary

Functions

Returns per-root-move node counts for debugging.

Counts leaf nodes from the given game state.

Counts leaf nodes from raw position fields.

Distributes root nodes across schedulers.

Counts leaf nodes with an ETS-backed transposition table.

Functions

divide(game, depth)

@spec divide(Echecs.Game.t(), non_neg_integer()) :: [{String.t(), non_neg_integer()}]

Returns per-root-move node counts for debugging.

perft(game, depth)

Counts leaf nodes from the given game state.

perft_fast(board, turn, castling, en_passant, depth)

Counts leaf nodes from raw position fields.

perft_parallel(game, depth)

@spec perft_parallel(Echecs.Game.t(), non_neg_integer()) :: non_neg_integer()

Distributes root nodes across schedulers.

perft_with_tt(game, depth)

@spec perft_with_tt(Echecs.Game.t(), non_neg_integer()) :: non_neg_integer()

Counts leaf nodes with an ETS-backed transposition table.