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';
// games[n] = round n+1; Game has no `round` field
const games = [
[{ black: 'B', result: 1, white: 'A' }], // round 1
[{ black: 'C', result: 0.5, white: 'A' }], // round 2
[{ black: 'A', result: 0, white: 'D' }], // round 3
];
const score = koya('A', games);
// Returns points scored against opponents who achieved >= 50% of the maximum scoreAPI
koya(playerId, games, players?)
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. Round is determined by array position: games[0] = round 1, games[1] =
round 2, etc. The Game type has no round field.
koya(playerId: string, games: Game[][], players?: Player[]): numberContributing
Contributions are welcome. Please open an issue at github.com/mormubis/koya/issues.