• Stars
    star
    179
  • Rank 214,039 (Top 5 %)
  • Language
    Rust
  • License
    GNU General Publi...
  • Created almost 8 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Rust library for chess and chess variant rules and operations

shakmaty

A Rust library for chess move generation

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. Provides vocabulary to implement other variants.

  • Bitboards and compact fixed shift magic attack tables.

  • Zobrist hash positions.

  • Probe Syzygy tablebases with shakmaty-syzygy.

Documentation

Read the documentation

Benchmarks

Simple perft of the initial position. No hashtables. i7-6850K CPU @ 3.60GHz.

perft 4 5
shakmaty 0.16.0 1.0 ms 24.1 ms
jordanbray/chess 3.1.1 0.8 ms 18.6 ms
Stockfish 8 (x86-64-bmi2) 4 ms 33 ms

It should be noted that Stockfish is not optimized for perft speed and also maintains additional data structures for evaluation. Newer versions of Stockfish put even less emphasis on this.

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.

More Repositories

1

python-chess

A chess library for Python, with move generation and validation, PGN parsing and writing, Polyglot opening book reading, Gaviota tablebase probing, Syzygy tablebase probing, and UCI/XBoard engine communication
Python
2,157
star
2

chessops

Chess and chess variant rules and operations in TypeScript
TypeScript
86
star
3

rust-chessground

An experimental chessboard widget for Relm/GTK
Rust
63
star
4

web-boardimage

An HTTP service that renders chess board images
Python
61
star
5

rust-pgn-reader

Fast non-allocating and streaming reader for chess games in PGN notation
Rust
60
star
6

syzygy-tables.info

User interface and public API for probing Syzygy endgame tablebases
Python
58
star
7

node-irc-server

Implementation of the IRC server protocol using node.js
JavaScript
56
star
8

python-agentspeak

A Python-based interpreter for the agent-oriented programming language JASON
Python
48
star
9

build-raspbian-image

Builds a minimal Raspbian Stretch image
Shell
39
star
10

stockfish.pexe

The strong open source chess engine Stockfish as a PNaCl module
C++
23
star
11

rust-huffman-compress

A Rust library for Huffman compression given a propability distribution over arbitrary symbols
Rust
23
star
12

indexed.py

A Python dictionary that is indexed by insertion order
Python
20
star
13

shakmaty-syzygy

A Rust library to probe Syzygy endgame tablebases
Rust
17
star
14

python-asyncdgt

Communicate asynchronously with DGT boards
Python
15
star
15

double-checked-cell

A thread-safe lazily initialized cell using double-checked locking.
Rust
12
star
16

magics

Finding magic factors for bitboard based move generation
C
12
star
17

lila-websocket

Experimental WebSocket server for lichess.org - superceded by https://github.com/ornicar/lila-ws
Rust
10
star
18

python-tinyhtml

A tiny library to safely render compact HTML5 from Python expressions.
Python
10
star
19

git-rebase-patch

Rebase patches that no longer apply to HEAD
Shell
9
star
20

rust-btoi

Parse integers directly from ASCII byte slices
Rust
7
star
21

lila-openingexplorer3

Opening explorer for lichess.org
Rust
5
star
22

ip2proxy-rust

Rust library to query IP2Proxy BIN Data files
Rust
3
star
23

tbserve

Syzygy tablebase server
C++
3
star
24

fishnet-assets

Precompiled Stockfish binaries for fishnet
3
star
25

antichess-tree-server

HTTP API and C library to query Watkins antichess proof tables: 1. e3 is winning for White
C
2
star
26

rust-gaviota-sys

Low level Rust bindings for libgtb, a library for Gaviota tablebase probing
Rust
2
star
27

cloudflare-camo

A Cloudflare worker to proxy images for privacy, to avoid mixed content, and to add headers
TypeScript
2
star
28

media_feeds

Enable mapping imported sources to media fields.
PHP
1
star
29

chessclock

Various clock types for two player games
C++
1
star
30

lichess-stagebot

A bot waiting for deploy commands in the Slack channel
Python
1
star
31

project_git_default_branch

Let drupal.org module maintainers set the default branch for their repositories.
PHP
1
star
32

versioncontrol_project

Drupal Version Control API Project integration module
PHP
1
star
33

display-kiosk

Display a website in a stripped down kiosk
C++
1
star
34

field_copy

PHP
1
star
35

flexibledate

A CCK field for drupal that can contain both full dates and quarters.
PHP
1
star
36

jumpnevolve

Yet another jump'n'run game
Java
1
star
37

android-barcode-scanner

Use an android device as a wireless barcode scanner
C++
1
star
38

lightbox2_media

Allows using Lightbox2 for displaying images in Media fields.
PHP
1
star
39

field_label_plurals

A Drupal module that allows you to use different field labels for singular and plural, depending on the number of field values.
PHP
1
star
40

taxonomy_icon

A drupal module that allows the user to show taxonomy term references as icons.
PHP
1
star
41

fishnet-tuning

Experiments to find good parameters for reproducible Stockfish analysis
Python
1
star
42

github-showcases

A dataset of all repositories showcased on GitHub
Python
1
star
43

media

Fork of the Drupal Media module for #1349058
PHP
1
star
44

birthdays

The Drupal Birthdays module
PHP
1
star
45

pheres

Tools to experiment with the AgentSpeak programming language
Rust
1
star
46

cig-lectures

Seat reservations for CIG lectures at TU Clausthal
Python
1
star