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.0.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.0-cp312-abi3-win_amd64.whl (876.5 kB view details)

Uploaded CPython 3.12+Windows x86-64

esca-0.2.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

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

esca-0.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ ARM64

esca-0.2.0-cp312-abi3-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

esca-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: esca-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 ab42a82b808bffba170414af5c149ddd6a5dde0412a63909616f94a09e98601d
MD5 596ea495640c151495e304a83ea8009e
BLAKE2b-256 8e6f6afecc128c01f8ddb92f4256c8dd51bbec8648fbee87e8272675d2d7dbc7

See more details on using hashes here.

Provenance

The following attestation bundles were made for esca-0.2.0.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.0-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: esca-0.2.0-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 876.5 kB
  • 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.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 73249f10628b05c52011e985803e8307e3820b4c738aacd427fa9406523f963b
MD5 0f56b7be4eda0e17de0b3bb770b407c6
BLAKE2b-256 727c2763410e1bc49e928c3e51d6f4d63e4e6f769bf98bb08fa7dc72cb6de386

See more details on using hashes here.

Provenance

The following attestation bundles were made for esca-0.2.0-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.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for esca-0.2.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cf3d7ea8916500a6451615916b224384f3b0bc1c75d1d9461466a920dfbf6afe
MD5 b05fe2a01defd36ba1ea5190e46125d9
BLAKE2b-256 013fa14bf8aef3fd98388043d44ec0c6ef67c02a850755436ff023bd767d7721

See more details on using hashes here.

Provenance

The following attestation bundles were made for esca-0.2.0-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.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for esca-0.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 af32977645632be045a4c20ef8cd6a85a60811630ec10482690bf0e185688d66
MD5 1fc892a677e415fbbf340d9422af87b4
BLAKE2b-256 f31ad1d215bef83797515784dd1ff80f2a185552f8a8d8ca1ad4fca07dfff889

See more details on using hashes here.

Provenance

The following attestation bundles were made for esca-0.2.0-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.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: esca-0.2.0-cp312-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.0 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.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a5331a17badf26d1137c2b477ac0b661c77b815b0f011a281ec97fb0917930e7
MD5 0e131cdea67723af03741586b852f83f
BLAKE2b-256 ebb223437fad78102894626774e400d79e0fd6934a9fc0a2256e2bf6f923895c

See more details on using hashes here.

Provenance

The following attestation bundles were made for esca-0.2.0-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.0-cp312-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for esca-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3bbc6154352c8fb58faf0a3b21e666a9d71ba78d3ade9c441823d5859a472663
MD5 cd42444290a25165d83d0d5007c8ccb3
BLAKE2b-256 19e3a12c8b8aa7a7e7e23be8dc48d57aa0fb5daf6c08615fb5ba77c1213d13c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for esca-0.2.0-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

0.2.1

6 files

This release

0.2.0 This release

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