I've developed a new open source chess move generation library in rust! This aims to be a fast move generator, where many people can share the move generation code. It is under the very permissive MIT license.
It uses magic bitboards for move generation, has all the usual suspects when it comes to move generation optimizations (pinned pieces, whether or not you're in check during generation, etc). It can enumerate pseudo_legal or legal moves, and a board.legal_quick(...) function to check pseudo_legal moves generated by the structure, without the full cost of the board.legal(...) function.
There are two move generators, actually. One gives you a rust Iterator<> which will use incremental move generation (but is slightly slower for perft testing), the other will give you an array (of size 256) for all legal chess moves, and is a bit faster.
It uses copy-on-make, which is easier to implement (and consistent with the rust style), and I've made the board structure as small as possible to prevent overhead during copying. (Additionally, rust will *not* copy the board if it doesn't have to). No mailboxing .
It has nice structures for ranks, files, squares, etc, all of which are designed to be optimized down efficiently by the rust compiler.
It has an incrementally updated pawn_hash() and a full board hash() for trasposition tables. It also has a CacheTable<T> which acts as a general purpose transposition table, designed for chess engine use (AKA: much faster than a HashMap<>). These features are tested with perft().
It has unit tests for perft testing.
You can download it using the rust 'cargo' package manager here: https://crates.io/crates/chess.
Documentation is available here: https://jordanbray.github.io/chess/chess/index.html
Source code is available here: https://github.com/jordanbray/chess
Some perft results are available here: https://github.com/jordanbray/chess_perft
Example of running a perft test:
Code: Select all
[jordan@localhost ~]$ cargo install chess_perft Updating registry `https://github.com/rust-lang/crates.io-index` Compiling getopts v0.2.14 Compiling lazy_static v0.2.2 Compiling libc v0.2.17 Compiling bitflags v0.7.0 Compiling rand v0.3.15 Compiling chess v0.3.4 Compiling chess_perft v0.0.7 Finished release [optimized] target(s) in 14.45 secs Installing /home/jordan/.cargo/bin/chess_perft warning: be sure to add `/home/jordan/.cargo/bin` to your PATH to be able to run the installed binaries [jordan@localhost ~]$ chess_perft -f "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1" -d 5 -m # Test the KiwiPete Position Perft 5 of r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1 Result: 193690690, Time: 1s 561ms [jordan@localhost ~]$