Repository navigation
Releases
Releases · AnglerfishChess/esca
v0.4.0 — the API to start from
The largest release so far, and a breaking one: nearly every public name changed shape between 0.3.0 and here. It is also the first release whose API we would call decent and convenient. 0.3.x code does not compile or import against it unchanged; every rename is listed in the CHANGELOG, old → new. Treat 0.4.0 as the version to start from.
- Typed facts are the API.
Position::facts()answers 221 named facts in 14 groups, plus 27 per legal move, each with a real type, read by absolute colour (.white,.black), documented in one generated catalogue (docs/features.md) that the code cannot drift from. - One JSON form for the facts, identical from Rust (
serde) and Python (to_dict()), with a JSON Schema. - Typed tensors (
esca::facts::tensors,esca.tensors): one array per fact with its own dtype and shape, expanded or bit-packed, saved as safetensors. No normalisation; that is the trainer's business. - Named endings with theory verdicts and technique names, and a plain-English
describe()beside every explanation enum. - A
Positionanswers rules questions (legal_moves,san,play,outcome) without aGame; the vocabulary parses from text and prints as text; aGamepickles; errors say what they refused. - chess-esca-mcp: an MCP server over the library, released from this same tag as the PyPI package
chess-esca-mcp(uvx chess-esca-mcp), with a Claude Code plugin inAnglerfishChess/plugins. - Examples in
examples/andpython/examples/: the three programs each reviewer wrote as a newcomer, kept as they were written.
The f32 training encoder left the library; it belongs to the anglerfish trainer.
0.3.0
- The
explainlayer answers a rules question with the evidence behind it,
every reason that applies at once and each carrying the squares it was read
off.Position::castlingnames the right, the rook, the check, every
covered square of the king's path with the units covering it, and every
unit standing on the path;en_passant_statusnames each pawn that could
take and what forbids it, the rank pin that binds neither pawn alone
included.checkers,attackers,between,pinsandskewershand over
the squares behind an answer. Chess960 throughout: the castling path is the
one the variant's rule names, so a king that never moves and a rook the king
crosses are answered by the same fields. Game::repetition_statuslists the plies the position has stood at and the
earlier plies with the same placement that do not count, with what differs;
fifty_move_statuscounts the clock down to the claim and to the automatic
draw and names the move that last cleared it;draw_statuslists every draw
that holds rather than the first, a stalemate carrying the king's covered
escape squares and what holds each other unit;claims_aftersays what a
move would earn without playing it.- Python has it as
esca.explain, reached from methods onPositionand
Game. None of it is part of the feature schema. - The UCI client speaks asynchronously on both surfaces. Rust gains the
tokio
feature anduci::tokio::Engine: the same conversation, the same values and
the sameErroras the blockingEngine, with every method awaited and
every future cancellation-safe. A search let go of unanswered asks the engine
to stop, and the engine settles on its next call, since a drop cannot wait. esca.uci.AsyncEngineis asyncio all the way down: it drives the process
itself, with no worker thread and no blocking call under it, sorun, which
named that thread, is gone. Cancelling an awaitedplay,analyseor
answerstops the search and leaves the engine usable. Itstimeoutis
settable, as the blockingEngine's is.esca.uci.protocolputs the protocol core on the Python surface, for a
client of one's own:Commandconstructors that render a line,parse
reading one line of engine output into aMessage, andSessionsaying what
may come next.- Both Rust clients and the asyncio one cap the lines an engine has written and
the client has not read at 4096. The oldest line that carries no part of the
conversation goes first, anddropped_linescounts what went, so an engine
writing faster than it is read costs a bounded amount of memory rather than
its answer. Position::polyglot_key, needing no feature: the key the Polyglot format
fixes, the same number in every run and in every program that implements it,
so it is a key to store and to send wherePosition::keyis not. Python
reads it asposition.polyglot_key.- Opening books, behind the
polyglotfeature and always in the wheel:
polyglot::Bookmemory-maps a book and answers a position with its entries
in book order, its heaviest, or one drawn by weight from a seed; a move that
is not legal in the position asked about is refused, never guessed.
Book::writeandpolyglot::Buildergo the other way, counting the moves
of played games or of a PGN source into a sorted, merged book with a maximum
ply and a minimum count. Python mirrors it asesca.polyglot, which also
hasdownloadfor fetching a book to a path with an optional digest. - The ECO catalogue, behind the
openingsfeature and always in the wheel:
openings::lookupgives a position its code and name, andGame::opening
the deepest one a game has reached. Keyed by position, so a transposition is
named. Python mirrors it asesca.openingsandgame.opening().
0.2.1
0.2.0
- PGN, behind the
pgnfeature and always in the wheel:pgn::Readerover a
file or a string, tolerant of the archives in the wild and, with
skipping(), of one bad game among many;pgn::Gamewith headers,
mainline, variations, comments and NAGs,mainline_game()to play it and
Game::to_pgn()to write one, X-FEN setups included. Python mirrors it as
esca.pgn. - A UCI client, behind the
ucifeature and always in the wheel:
uci::protocolis the protocol as values and does no I/O;uci::Engine
runs the process with every wait bounded, so a silent or dead engine is an
error, not a hang.set_positionsetsUCI_Chess960and the castling
spelling from the game's variant, and refuses a Chess960 game to an engine
that does not offer the option. Python hasesca.uci.Engine(GIL released
around every wait) andAsyncEngine, the same surface as coroutines, with
no async runtime under it. - The v1 schema,
schema_semver1.0.0: fourteen groups in the order
features.md§2 gives them.Schema::v1replacesSchema::v0, which is
gone, as is every net trained on it; Python names itesca.SCHEMA_V1and
esca.SCHEMA. - The clock and repetition facts move out of
stateinto the newhistory
group, so a training source without clocks omits one group name.
Facts::historycarries them;StateFactsno longer does. The group also
says what the recent plies did: captures and checks in the last eight, the
plies since either, the material trend over them, and what the last move
moved, took and gave. AGamesupplies them; a barePositiondoes not. pawnsgains the structure a player names out loud: the longest chain and
whether its base is under attack, the majority on each wing, the holes a
side can never cover again and the enemy minors sitting on them, fixed and
blockaded pawns, the lead passer's distance to promotion, both kings'
distances to its promotion square, whether the defending king is in its
square and whether its path is empty, the files semi-open at the enemy king,
and the backward pawns the enemy can actually attack.pieces.knights_on_outpostbecomespieces.minors_on_outpost, which counts
bishops too;king.king_distancedrops the two distances two kings can
never stand at;state.repetition_available_themis gone.piecesgains what makes a minor good or bad and a rook worth its rank: the
own fixed pawns standing on an own bishop's colour, the bishop pair against a
knight pair as one signed value, a rook on the seventh with the enemy king
shut on the eighth, and the units with nowhere safe to go, by count and by
value. A trapped unit ismobility.immobile_pieceswith safety asked of the
squares it does reach.attacksgains the value twinsattacked_count,attacked_value,
en_prise_valueandpinned_value.- The new
placementgroup: the raw board as twelve 64-square planes in the
mover's view, so a run measuring the augmentation against the board alone
selects a group instead of building its own input.Facts::placement. - The
endgamegroup fills in: how central each king stands, the plies each
side's leading passer still needs and the difference between them, the
opposition the kings stand in, a king on a key square of its own passer, a
wrong-colour bishop, and the three drawn material configurations
material.insufficient_materialdeliberately excludes.Facts::endgame,
with theOppositionandDrawishMaterialenums. The opposition is no
longer on the excluded list offeatures.md§4. history.last_move_was_checkis gone: with a history it isstate.in_check
read from the other end, and a check cannot survive the move that answers
it.- Static exchange evaluation:
Position::seeandPosition::see_capture, the
newexchangegroup over them, andtactics.winning_capture_available,
winning_capture_max_gain,equal_capture_countandlosing_capture_count
redefined from the exchange instead of the 1-ply victim-versus-capturer
test. SEE is no longer on the excluded list offeatures.md§4. - The new
threatsgroup,Facts::threats: what each side stands to lose,
read from the exchange on each of its own units — which are threatened, what
they are worth and the largest gain against them — plus the units a lesser
enemy unit attacks, the overloaded and removable defenders, the loose units,
the units more cheap attackers bear on than defenders, and the slider
geometry a threat comes from: x-rays through an enemy unit, batteries, and
batteries whose line meets the enemy king ring. - The
moveschema grows from 24 values to 40. Each legal move now also
carries its SEE, the largest one it leaves us next, whether it moves an
attacked unit or interposes on a check, whether it advances or creates a
passer, the isolated, doubled and backward pawns it makes, a king file it
opens for us, what it does to both king rings and to both hanging counts,
whether it leaves a piece hanging, and whether it uncovers a slider.
esca.MOVE_WIDTHandMoveFacts::WIDTHsay 40. kinggains the defensive half of the siege and the exposure a player reads
off the board: the pieces defending their own king's ring and their weight,
the besieging weight less that, the open rays off the king, whether it has
luft, which side it reads as having castled to, and whether the two kings
stand on opposite wings.KingFactscarries them, with theCastledSide
enum andKingFacts::ring_attacker_surplus;castled_sidejoins the
featuresfeatures.md§4 keeps to classic chess.tacticsgains six bits per side: a check that also captures safely, a
discovery onto the enemy queen, a back-rank mate threat, a quiet move that
leaves more to be won than stands to be won now, a side with no safe move at
all, and a promotion the exchange on its square makes profitable.- The move row is a section of the schema of its own, named
move, with a
version, named features, widths and encodings, and its text folded into the
oneschema_id. A checkpoint that stores the id now refuses a move row of
another shape as surely as a position row of one.Schema::moves,
GroupSpec::canonicalandGroupSpec::feature;esca.MOVE_SCHEMAand
Schema.moves()in Python. materialgains the bishop-pair imbalance and the piece-value difference,
mobilitythe safe-mobility difference per type, andplanesa ninth
plane: where their threatened units stand.
v0.1.0
First release. esca is published to crates.io and PyPI; the engine and the
trainer ship in the repository only.
esca:Position,Gameand theVarianttrait, withClassicand
Chess960behind it; FEN and EPD, X-FEN and Shredder-FEN castling, legal
move generation, UCI and SAN move text, and every terminal and claimable
outcome.Facts, the v0 schema: nine groups of side-relative position facts plus
per-move facts, aschema_idpinned by golden fixtures, and batch encoders
that write 1065-widef32rows.- The
escaPython package: an abi3-py312 wheel built from the crate, typed,
with NumPy batch encoding. - The
lichessreader: streams the Lichess evaluation dump into encoded
batches with their targets. anglerfish-core: theanglerfishUCI binary — protocol loop, bounded
search, move-picking strategies, and theEvaluator/Policytraits a net
will plug into (UniformandMaterialuntil then).