Package Exports
- @echecs/koya
Readme
Koya
Koya is a TypeScript library implementing the Koya tiebreak system for round-robin chess tournaments, following the FIDE Tiebreak Regulations (section 9.2). Zero runtime dependencies.
Installation
npm install @echecs/koyaQuick Start
import { koya } from '@echecs/koya';
const games = [
{ blackId: 'B', result: 1, round: 1, whiteId: 'A' },
{ blackId: 'C', result: 0.5, round: 2, whiteId: 'A' },
{ blackId: 'A', result: 0, round: 3, whiteId: 'D' },
];
const score = koya('A', games);
// Returns points scored against opponents who achieved >= 50% of the maximum scoreAPI
koya(playerId, games)
FIDE section 9.2 — Koya score. Returns the total points scored by playerId
only in games played against opponents who achieved at least 50% of the maximum
possible score in the tournament. Designed for round-robin (all-play-all)
tournaments. Byes are excluded from both the threshold calculation and the score
sum.
koya(playerId: string, games: Game[]): numberDrop-in compatible with the shared Tiebreak type
(playerId: string, games: Game[], players: Player[]) => number.
Contributing
Contributions are welcome. Please open an issue at github.com/mormubis/koya/issues.