Function shakmaty::perft [] [src]

pub fn perft<P: Position + Clone>(pos: &P, depth: u8) -> u64

Counts legal move paths of a given length.

Paths with mate or stalemate are not counted unless it occurs in the final position. Useful for comparing, testing and debugging move generation correctness and performance.

Examples

use shakmaty::Chess;
use shakmaty::perft;

let pos = Chess::default();
assert_eq!(perft(&pos, 1), 20);
assert_eq!(perft(&pos, 2), 400);
assert_eq!(perft(&pos, 3), 8902);