#chess #move #perft

app chess_perft

This package runs a ‘perft’ test on a particular chess position. This makes every move out to a certain depth, and counts the number of leaf-nodes. This is used to verify that move generation is correct and fast. This also (optionally) verifies that the hashing function produces unique values for each position.

16 releases (10 stable)

✓ Uses Rust 2018 edition

3.1.1 Jul 14, 2019
3.0.1 Jan 16, 2019
2.0.1 Oct 29, 2018
1.0.7 Oct 16, 2018
0.0.5 May 29, 2016

#14 in Game development

Download history 17/week @ 2019-03-30 2/week @ 2019-04-06 2/week @ 2019-04-13 16/week @ 2019-04-20 16/week @ 2019-04-27 17/week @ 2019-05-04 19/week @ 2019-05-11 38/week @ 2019-05-18 58/week @ 2019-05-25 30/week @ 2019-06-01 43/week @ 2019-06-08 38/week @ 2019-06-15 231/week @ 2019-06-22 30/week @ 2019-06-29 118/week @ 2019-07-06

219 downloads per month

LGPL-3.0+

25KB
169 lines

Perft Test Benchmarks for crates.io/chess/, crates.io/shakmaty/

This simple program tests the performance of the 'chess' crate and the 'shakmaty' crate. The 'chess-move-gen' crate was removed because it seems to be no-longer maintained (and I couldn't get it to compile recently).

Running

To run the program, you must specify a valid FEN string (representing a chess position) and a depth to search.

The program will report the number of leaf nodes it found starting at that position, and the amount of time it took to search (ignoring setup time, which currently is a lot).

You can also use the -a [size] option to cache results at each depth, speeding up perft performance.

You can also use the -m option to use the MoveGen structure, which is an iterator to test its functionality. (This is now the fastest way to generate moves, in most cases, for the 'chess' crate.)

You can also specify the -c option to use the 'chess' crate, the -s option to use the 'shakmaty' crate, or the -g for the 'chesss-move-gen' crate. Note: not all of the features supported by this application are in the 'shakmaty' crate, so I default to calling their 'perft' function for all command-line arguments.

Performance

Below I compare the performance numbers (using the command 'RUSTFLAGS="-C target-cpu=native" cargo bench | python graph_benches.py') of chess and shakmaty (lower is better).

Performance Numbers SVG

If viewing on crates.io, you can view the performance numbers on https://github.com/jordanbray/chess_perft.

Example

[jordan@razer chess_perft]$ ./target/release/chess_perft -f "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1" -d 6 -m # Test the KiwiPete Position
chess   : Perft 6 of r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1       Result: 8031647685      Time: 22s 492ms

Dependencies

~1MB
~17K SLoC