RepositoryRustDEGermany
NI

niklasf/shakmaty

A Rust library for chess and chess variant rules and operations

320stars
56forks
7issues
2views

Featured achievements

The project's latest awards

2
TINIX TRENDING·Topic: lichess

#2 Repository of the week

3
TINIX TRENDING·Topic: chess

#3 Repository of the week

2
TINIX TRENDING·Topic: lichess

#2 Repository of the week

shakmaty

A Rust library for chess and chess variant rules and operations

crates.io docs.rs

Features

  • Generate legal moves:

    use shakmaty::{Chess, Position};
    
    let pos = Chess::default();
    let legals = pos.legal_moves();
    assert_eq!(legals.len(), 20);
    
  • Play moves:

    use shakmaty::{Square, Move, Role};
    
    // 1. e4
    let pos = pos.play(&Move::Normal {
        role: Role::Pawn,
        from: Square::E2,
        to: Square::E4,
        capture: None,
        promotion: None,
    })?;
    
  • Detect game end conditions: pos.is_checkmate(), pos.is_stalemate(), pos.is_insufficient_material(), pos.outcome().

  • Read and write FEN, SAN and UCI notation.

  • Supports all Lichess variants: Standard chess, Chess960, Antichess, Atomic, King of the Hill, Three-Check, Crazyhouse, Racing Kings and Horde.

  • Bitboards and attack generation with compact fixed shift magic attack tables or Hyperbola Quintessence.

  • Fast compact binary encodings for positions and moves.

  • Zobrist hash positions.

  • Probe Syzygy tablebases with shakmaty-syzygy.

  • Parse PGN files with pgn-reader (experimental).

Documentation

Performance

Expect move generation performance in the ballpark of the world's best chess engines.

Simple perft speed can give a rough indication, but only that -- for example, Stockfish maintains additional data structures for evaluation (and newer Stockfish versions put even less emphasis on perft speed).

Here is a snapshot at a point in time. No hashtables. i7-6850K CPU @ 3.60GHz.

perft45
shakmaty 0.16.01.0 ms24.1 ms
jordanbray/chess 3.1.10.8 ms18.6 ms
Stockfish 8 (x86-64-bmi2)4 ms33 ms

License

shakmaty is licensed under the GPL-3.0 (or any later version at your option). See the COPYING file for the full license text.

Similar Projects

Discover other similar projects and AI models.

RepositoryRust
thomas-mauran/chess-tui

Play chess in any terminal. Rust TUI, Stockfish, Lichess.

1.2k
Nov 26, 2026
RepositoryRust
lichess-org/fishnet

Distributed Stockfish analysis for lichess.org

946
Nov 21, 2026
RepositoryScala
lichess-org/lila

♞ lichess.org: the forever free, adless and open source chess server ♞

19.1k
Dec 1, 2026
RepositoryDart
lichess-org/mobile

Lichess mobile app

2.7k
Nov 27, 2026
RepositoryTypeScript
lichess-org/chessground

Mobile/Web chess UI for lichess.org

1.4k
Oct 20, 2026
RepositoryPython
lichess-bot-devs/lichess-bot

A bridge between Lichess bots and chess engines

1.1k
Nov 22, 2026
RepositoryPython
pychess/pychess

PyChess - desktop chess client for Linux/Windows/macOS

818
Nov 23, 2026
RepositoryScala
lichess-org/scalachess

Chess API written in scala. Immutable and free of side effects.

792
Dec 1, 2026
Dataset
Lichess/standard-chess-games

[!CAUTION] This dataset is still a work in progress and some breaking changes might occur. Lichess Rated Standard Chess Games Dataset Dataset Description 6,771,826,271 standard rated games, played on lichess.org, updated monthly from the database dumps. This version of the data is meant for data analysis. If you need PGN files you can find those here. That said, once you have a subset of interest, it is trivial to convert it back to PGN as shown in the Dataset… See the full description on the dataset page: https://huggingface.co/datasets/Lichess/standard-chess-games.

♥0
98.5k
Oct 16, 2025