Skip to main content

High-performance chess library with board sizes from 6x6 to 16x16

Project description

spooky_chess 🎃👻

Rust and Python library for the game of Chess.

Features

  • Drive external engines with Universal Chess Interface.
  • Variable board sizes from 6x6 to 16x16.
  • Relatively fast.
  • Out-of-the-box support for DL/ML, including AlphaZero and MAIA2 action encoding.
  • Consistent interface with spooky-connect4 and spooky-go.

Performance

Measured with a Threadripper 9980x, and 6400 MT/s CL36 DDR5. Python 3.14.

> cd tests/comparison && cargo run --release && cd -
50000 random game playouts
  spooky_chess (Rust Bindings):
    moves:   4936906
    time:    2.14s
    moves/s: 2311096.73
> uv run python -m pytest -k test_compare_random_game_playout -s --run-slow
50000 random game playouts
  spooky_chess (Python Bindings):
    moves:   4936141
    time:    6.66s
    moves/s: 740666.24
  python-chess:
    moves:   4935315
    time:    113.33s
    moves/s: 43548.00
  Speedup: 17.01x

Validity

Fuzz-tested against python-chess, with 5 million random playouts.

Install

Rust

cargo add spooky_chess

Python

uv add spooky-chess

Includes type hints.

Examples

Quick start:

Rust:

cargo run --example quick_start

Python:

uv run python examples/quick_start.py

More Rust examples:

  • cargo run --example pgn_summary
  • cargo run --example legal_moves
  • cargo run --example action_encoding
  • cargo run --example custom_board

More Python examples:

  • uv run python examples/pgn_summary.py
  • uv run python examples/legal_moves.py
  • uv run python examples/action_encoding.py
  • uv run python examples/custom_board.py

PGN + UCI analysis:

Rust:

cargo run --example analyse_pgn

Python:

uv run python examples/analyse_pgn.py

Develop

Tests

  • fish run_tests.fish
    • fish run_python_tests.fish
    • fish run_rust_tests.fish

Lints

  • fish run_lints.fish

Docs

  • uv run --with sphinx==9.1.0 python -m sphinx -b html -E docs docs/_build/html

Performance

  • fish run_benchmark.fish
  • fish run_profile.fish

See Also

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spooky_chess-1.1.0.tar.gz (101.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

spooky_chess-1.1.0-cp314-cp314-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

spooky_chess-1.1.0-cp314-cp314-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

spooky_chess-1.1.0-cp313-cp313-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

spooky_chess-1.1.0-cp313-cp313-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

spooky_chess-1.1.0-cp312-cp312-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

spooky_chess-1.1.0-cp312-cp312-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

spooky_chess-1.1.0-cp311-cp311-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

spooky_chess-1.1.0-cp311-cp311-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file spooky_chess-1.1.0.tar.gz.

File metadata

  • Download URL: spooky_chess-1.1.0.tar.gz
  • Upload date:
  • Size: 101.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for spooky_chess-1.1.0.tar.gz
Algorithm Hash digest
SHA256 0fd93c36b6bce5f0e1c256440c33167c920bab6a3b7ed1b115f831924931ed4b
MD5 114bc68ce67e4555875b59dad8eb9b41
BLAKE2b-256 dfe32b4b71c623c5e7ff9529e91fbbee0bb633468b6916009b5a656a2d4444e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for spooky_chess-1.1.0.tar.gz:

Publisher: publish.yml on snowdrop4/spooky-chess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spooky_chess-1.1.0-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for spooky_chess-1.1.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 058532205f1c7a7052eff56c11e65b03c1a563ab2a680a4fd829a83b06d7b455
MD5 59530aeeaff956c4dfc8f5df0e0142fd
BLAKE2b-256 3bee1b23fc88b2150b4491807ffb854eff5f9d1c6ccaf843b715a270ccd97823

See more details on using hashes here.

Provenance

The following attestation bundles were made for spooky_chess-1.1.0-cp314-cp314-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on snowdrop4/spooky-chess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spooky_chess-1.1.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spooky_chess-1.1.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9cac9e1b3d56cdb60c673820dd89d465429b3a6a1640ab07e5486f9acba654fb
MD5 08d8b20813e530d65e053ce65c2501be
BLAKE2b-256 b7bb89229ccbe48544850265be876d942ac52f005501fb815c74906819ac41e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for spooky_chess-1.1.0-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: publish.yml on snowdrop4/spooky-chess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spooky_chess-1.1.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for spooky_chess-1.1.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2241cfae8c0367b530d7715bbea6ca6905ad87a2dcea29d9af033bf3f06bc5d0
MD5 b58132c3bad2cf94622dbbd6666ef48b
BLAKE2b-256 abf9cca769086c1b02a26b0fcb88c37207c1aa8a7000f470b53215d5f8140b40

See more details on using hashes here.

Provenance

The following attestation bundles were made for spooky_chess-1.1.0-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on snowdrop4/spooky-chess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spooky_chess-1.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spooky_chess-1.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e17a0cf566c5fcef817705ba2bb61d9e1f34f9f1367c0db8399505bc9c42b17c
MD5 48d952eb57a52baba6b15091daa86443
BLAKE2b-256 b89999126a88eb4490492f1697d724208322fb117c69c77fa48fd7f3f0db17f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for spooky_chess-1.1.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on snowdrop4/spooky-chess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spooky_chess-1.1.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for spooky_chess-1.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 655d49782d3766f2ff85148579fa517f4347844c76540a55e920f56cf35cad0e
MD5 e1d133722a3b7c59a274b4ba1ba9946b
BLAKE2b-256 f180d7fa0951a256bcba62f3377ea6445b29e36328b9caab86a2e6ea1e8901a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for spooky_chess-1.1.0-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on snowdrop4/spooky-chess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spooky_chess-1.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spooky_chess-1.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2cafaf71bb4de29c7f561438effc514ad27fa6b5e9012139aa1301fba254ed0
MD5 bd3eaa80e5f4627dbd6e619c5d01f53c
BLAKE2b-256 e78de8a382761cf7a19343dffcf7f767a663d8922cf81067292e58efbf58f30a

See more details on using hashes here.

Provenance

The following attestation bundles were made for spooky_chess-1.1.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on snowdrop4/spooky-chess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spooky_chess-1.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for spooky_chess-1.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fc72d299b2209e7cd4462233db950f0a70fbb7a3eb97f6df1465eeafc2c080e1
MD5 8e2bb4e65961e01973f17364caa2a42c
BLAKE2b-256 1f9bde6ab128c64e1bfabd5f9b982ff94626c9c7b14d88ea83fabfc4efc0c4ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for spooky_chess-1.1.0-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on snowdrop4/spooky-chess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spooky_chess-1.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spooky_chess-1.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 02241611dca5121299b3f7baddcb9e58da0c8ca941df04a3ac11ebf8c7b9992a
MD5 149eb89b2c30b45cba5628d9fcdc26a5
BLAKE2b-256 a9d9b46f51ee8b31b74cfabe128589f59940b0f13b7a9862a1eba3ee23b601ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for spooky_chess-1.1.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yml on snowdrop4/spooky-chess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page