Java chess rules library

Ashlar Chess

Strict/lenient PGN/SAN parsing, fine-grained validation, PGN writing, and flagfall adjudication using CHA.

What It Is

Ashlar Chess is a Java library for chess rules and notation. It began as a from-scratch programming exercise and matured through extensive testing, refactoring, and finally AI-assisted development into a focused library for positions, games, PGN/SAN handling, validation, and reproducible rule logic.

It is not a chess engine. It does not try to choose strong moves. Its concern is whether chess data is legal, well-formed, explainable, and handled consistently.

What Stands Out

CHA

CHA, the Chess Unwinnability Analyzer, deserves special mention. Miguel Ambrona's implementation lives at miguel-ambrona/D3-Chess, with the project page at chasolver.org.

It gives software a decision procedure for a difficult rule question: does any legal continuation allow a chosen player to give checkmate?

That matters after a flagfall or resignation. Under FIDE Article 6.9, a timeout is not a loss if the opponent cannot checkmate by any possible legal sequence; under Article 5.1.2, the same condition can turn a resignation into a draw. It also matters for Article 5.2.2, where a game ends immediately once the position is dead, meaning unwinnable for both players.

CHA makes these rules practical. Its quick unwinnability analysis brings exact adjudication within reach for rare but real positions that chess software has historically been unable to decide both reliably and fast enough.

Distribution

Published for Java 17+ as io.github.dlbbld:ashlar-chess.