Core
Start with @echecs/game for full game logic, or pick individual packages for parsing and notation.
Engine
Ratings
Tournaments
Tiebreaks
FIDE-standard tiebreak systems for Swiss and round-robin tournaments. Used by @echecs/tournament or standalone.
UI
File Formats
Clean APIs, strict types
Every package is TypeScript-first with full type inference
import { Game } from '@echecs/game';
import { parse } from '@echecs/san';
const game = new Game();
// Scholar's mate
for (const san of ['e4','e5','Qh5','Nc6','Bc4','Nf6','Qxf7']) {
game.move(parse(san, game.position()));
}
game.isCheckmate(); // true
game.turn(); // 'black'
import { Game } from '@echecs/game';
import { parse } from '@echecs/san';
import { stringify } from '@echecs/fen';
const game = new Game();
for (const san of ['e4','e5','Nf3','Nc6','Bb5']) {
game.move(parse(san, game.position()));
}
// Snapshot as FEN
const pos = game.position();
stringify({ board: pos.pieces(), turn: pos.turn,
castlingRights: pos.castlingRights, halfmoveClock: pos.halfmoveClock,
enPassantSquare: pos.enPassantSquare, fullmoveNumber: pos.fullmoveNumber,
}); // 'r1bqkbnr/pppp1ppp/2n5/1B2p3/...'
import { pair } from '@echecs/swiss';
import { update } from '@echecs/elo';
const players = [
{ id: 'anna', rating: 1800 },
{ id: 'boris', rating: 1750 },
{ id: 'clara', rating: 1600 },
{ id: 'david', rating: 1550 },
];
// Round 1 pairings (FIDE Dutch system)
const { pairings } = pair(players, []);
// After the round, update ratings
const [anna, clara] = update(1800, 1600, 1);