#move-gen #chess-engine #fast #chess

bunnies

A fast chess library for chess engines

3 releases (breaking)

Uses new Rust 2024

new 0.3.0 Apr 15, 2025
0.2.0 Mar 27, 2025
0.1.0 Mar 11, 2025

#440 in Math

Download history 72/week @ 2025-03-05 42/week @ 2025-03-12 129/week @ 2025-03-26 5/week @ 2025-04-02

248 downloads per month

MIT license

220KB
4.5K SLoC

bunnies

A fast chess library for chess engines. Currently in alpha.

Current Features

  • Game state representation
  • (Pseudo-legal) move generation and application (and un-application)
  • FEN parsing and generation
  • UCI generation
  • Full PGN parsing and generation
    • Support for NAGs and variations (comments are parsed, but not generated)
    • Support for nested variations
  • Perft testing
  • Game termination detection (and draw detection)

Optimizations

bunnies makes use of the following optimizations:

  • Bitboard-based board representation
  • Pseudo-legal move generation
  • Make-unmake move application (eliminating the need to copy game state)
  • Magic bitboards for sliding piece attack generation
  • Precomputed attacks for knights and kings
  • Zobrist hashing for board state hashing

bunnies is currently able to generate ~15M moves/thread/second (as measured on an M1 Macbook Pro), which is not nearly as fast as programs like Stockfish (which is able to generate ~120M moves/thread/sec under the same conditions).

Contribution

bunnies needs the following to make 1.0.0 happen:

  • Identify and remove bottlenecks
  • Some more benchmarks
  • Some more integration tests
  • Is the public API good enough?
  • Support for PGN comments
  • Unit tests for draw detection
  • More docs

Feedback and contributions welcome!

Dependencies

~9.5MB
~138K SLoC