Perft

Also known as: Performance test

A test that counts every legal move sequence to an exact search depth.

Explanation

Perft traverses the tree of legal moves from a position and counts every sequence that reaches an exact depth. Depth one means counting the legal moves available now. Depth two includes every legal reply, and the pattern continues from there. Each sequence is counted separately even when two different sequences reach the same board state. The result is a reproducible number for that position and depth.

Its main purpose is to verify a program's move generator. If the total differs from a trusted reference, some rule or position update is wrong. A form called divide reports a separate subtotal for every starting move, helping the developer locate the branch where the discrepancy begins.

Perft is especially good at exposing subtle errors involving checks, en passant, a special pawn capture, promotions, and , the special joint move of king and rook. It can also reveal that a program restores the side to move, castling rights, or the en passant target incorrectly after undoing a move.

Perft performs no position evaluation, best-move selection, or branch pruning. Passing it shows agreement with tested legal-move counts, but it does not show that an plays strong chess. Although the name comes from performance test, correct counting is the central purpose; timing is an additional benchmark that depends on the implementation.

Common confusions

Perft and playing strength

Perft validates rules and move generation. It does not measure positional understanding, evaluation quality, or tactical strength.

Perft and hashing

An implementation may use to recognize positions, but a correct key does not replace legal counting.

View term

Sources

  1. 1.Perft, Chess Programming Wiki

Related terms

© 2026 MindZug