Skip to main content

esca

A chess model that answers what is true about a position — a Rust crate and a Python package built from it.

The esca is the anglerfish's lure: the small thing that lights up what is in front of it.

Position is placement and state and nothing else. Rules live in Variant implementations — Classic and Chess960 — so a position can be asked the same question under different rules, and a new variant is a new implementation and nothing else. A Game pairs a variant with the moves played, which is what repetition and claimable draws need. Facts answers what is true about a position, both as prose a reader can check and as the flat f32 row a net consumes.

Rust

[dependencies]
esca = "0.1"
use esca::{Game, Schema, Side, classic};

let mut game = Game::new(classic());   // Chess960 rules: `esca::chess960()`
game.play_san("e4").unwrap();
game.play_uci("e7e5").unwrap();
println!("{}", game.position().fen());

let facts = game.facts();              // side-relative, in the mover's view
println!("{}", facts.tactics[Side::Us.index()].legal_move_count);
println!("{}", facts.summary());

let schema = Schema::v1();             // the row a net eats: 2039 f32
println!("{}", facts.encode(schema, schema.all()).len());

Cargo features, none on by default: lichess (streaming reader for the Lichess evaluation dump), pgn (reading and writing games as PGN) and python (the PyO3 module the wheel is built from).

Python

pip install esca
import esca

game = esca.Game()  # Chess960 rules: esca.Game(variant=esca.CHESS960)
game.play_san("e4")
game.play("e7e5")
print(game.position.fen)

facts = game.facts()  # side-relative: index with esca.US / esca.THEM
print(facts.tactics[esca.US].legal_move_count)
print(facts.summary())

rows = esca.encode([game.position.fen])  # (1, 2039) float32, ready for a net
print(rows.shape, esca.SCHEMA_ID)

Wheels are abi3 for Python 3.12 and up. esca.lichess.batches() streams the evaluation dump as encoded batches with their targets.

What it covers

  • Classic chess and Chess960, behind one Variant trait.
  • FEN and EPD, reading KQkq and the AHah of X-FEN and Shredder-FEN alike, and writing KQkq whenever the rook files allow it.
  • Legal move generation into a MoveList that never allocates.
  • UCI move text in either castling spelling, and SAN with the disambiguation it needs.
  • Checkmate, stalemate, insufficient material, the fifty- and seventy-five-move rules, and threefold and fivefold repetition.
  • Facts: fourteen groups of cheap position facts — the board itself, game state, material, pawns, pieces, king, mobility, attacks, exchanges, threats, one-ply tactics, endgame, history and attack planes — plus MoveFacts for every legal move, all side-relative and in the mover's view.
  • Schema, a versioned manifest with a schema_id, and batch encoders that write f32 rows without allocating.

Documentation

License

MIT — see LICENSE.

Download files

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

Source Distribution

esca-0.2.1.tar.gz (399.1 kB view details)

Uploaded Source

Built Distributions

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

esca-0.2.1-cp312-abi3-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.12+Windows x86-64

esca-0.2.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ x86-64

esca-0.2.1-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ ARM64

esca-0.2.1-cp312-abi3-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

esca-0.2.1-cp312-abi3-macosx_10_12_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

File details

Details for the file esca-0.2.1.tar.gz.

File metadata

  • Download URL: esca-0.2.1.tar.gz
  • Upload date:
  • Size: 399.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for esca-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f30e2f30e2ab249855077b973c1b645ef4fae735c67f2f58bc7a71e63eabf5c5
MD5 718403f4b440b4821d613fc291810950
BLAKE2b-256 3ab1e7b53077754e18e2b03a1ed7d301c0c76af75792dd8f549f6a55b7ae6321

See more details on using hashes here.

Provenance

The following attestation bundles were made for esca-0.2.1.tar.gz:

Publisher: publish.yml on AnglerfishChess/anglerfish

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

File details

Details for the file esca-0.2.1-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: esca-0.2.1-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for esca-0.2.1-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7f38f8cebb2689d6eb3541c94189644219f69c5b8b19fafd344c28dab5b65240
MD5 049635285db65a4ebdd2debe83fb7049
BLAKE2b-256 2e329af2d0f74507d07eb5d4ed4f668b3bda573ddfc8c2d8451d844693b88d7c

See more details on using hashes here.

Provenance

The following attestation bundles were made for esca-0.2.1-cp312-abi3-win_amd64.whl:

Publisher: publish.yml on AnglerfishChess/anglerfish

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

File details

Details for the file esca-0.2.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for esca-0.2.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 897277fa7f4e8f3b1816d4a311cf01b3e01cefd47729a38acce044680eda8965
MD5 f0b0e8d97c278c791aa4b45b6971bc57
BLAKE2b-256 56694aa26eedf16708c1c91dfea0fdf332fa7ce407f99b978ee611f6079ac734

See more details on using hashes here.

Provenance

The following attestation bundles were made for esca-0.2.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on AnglerfishChess/anglerfish

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

File details

Details for the file esca-0.2.1-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for esca-0.2.1-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4e4d546f48e0cfb93f86d4a70f374863bd2d4e0fe664b1a6e773b6feed3c3410
MD5 82f5a73a69b75ab88f5930a7a1746c87
BLAKE2b-256 035393e276b113fe2c279e8377eb143fbc444048bd57666e47f26aa70dd22fe0

See more details on using hashes here.

Provenance

The following attestation bundles were made for esca-0.2.1-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on AnglerfishChess/anglerfish

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

File details

Details for the file esca-0.2.1-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: esca-0.2.1-cp312-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.12+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for esca-0.2.1-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 23c12c88c348733670507cef85b2cc32d776f39366c213fc6b9e1f41e8800317
MD5 e9cb4f3cbe02bcc455979c2736bd4eda
BLAKE2b-256 bf295cfbb004bde38b6203bc3f0806c53e6f1f6ee7f99844772564b2f27cd609

See more details on using hashes here.

Provenance

The following attestation bundles were made for esca-0.2.1-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on AnglerfishChess/anglerfish

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

File details

Details for the file esca-0.2.1-cp312-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for esca-0.2.1-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 427a9d73ae91be425bedc5fde00ed2f4ac92c8d4da83981f3aa680f414edc285
MD5 faba4047465da88fa4009a4572e2318d
BLAKE2b-256 1ecfe902a3c8cabf5de9f3c165e767191124d39f6b90e8778f4d8085a6f72a69

See more details on using hashes here.

Provenance

The following attestation bundles were made for esca-0.2.1-cp312-abi3-macosx_10_12_x86_64.whl:

Publisher: publish.yml on AnglerfishChess/anglerfish

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

Release history Release notifications | RSS feed

0.3.0

6 files

This release

0.2.1 This release

6 files

0.2.0

6 files

0.1.0

6 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page