CLI tools for FIDE Swiss Software Endorsement (C.04.A). Provides a Free Pairings
Checker (FPC) and a Random Tournament Generator (RTG) for validating the
@echecs/swiss Dutch pairing engine.
npm install @echecs/endorsementReads a TRF16 file, replays each round through the Dutch pairing engine, and compares results against the stored pairings.
echecs-endorsement check tournament.trf
echecs-endorsement check tournament.trf --rounds 1-5
echecs-endorsement check tournament.trf --verboseOptions:
<file.trf>— path to TRF16 file (required)--rounds <range>— check specific rounds (e.g.3,1-5,2,4,7)--verbose— show each individual pairing comparison
Exit codes:
0— all checked rounds match1— discrepancies found2— error (bad file, parse failure, missing argument)
Generates a simulated tournament and outputs a TRF16 file.
echecs-endorsement generate --players 40 --rounds 9
echecs-endorsement generate --players 40 --rounds 9 --seed 12345
echecs-endorsement generate --players 40 --rounds 9 --seed 12345 -o tournament.trfOptions:
--players <n>— number of players (required)--rounds <n>— number of rounds (required)--seed <n>— PRNG seed for deterministic generation-o <path>— output file path (defaults to stdout)
The package also exports its core functions for programmatic use:
import { check, generate } from '@echecs/endorsement';
// Generate a tournament
const trf = generate({ players: 40, rounds: 9, seed: 42 });
// Check a TRF file
const result = check(trf);
console.log(result.summary);
// { perfectRounds: 9, totalRounds: 9, totalMatching: 180, totalPairings: 180 }Parses TRF content and compares each round's pairings against the Dutch engine.
trfContent: string— raw TRF16 file contentoptions.rounds?: number[]— specific rounds to checkoptions.verbose?: boolean— include detailed pairing comparisons
Returns a CheckResult with per-round reports and summary statistics.
Creates a simulated tournament and returns TRF16 content.
options.players: number— number of playersoptions.rounds: number— number of roundsoptions.seed?: number— PRNG seed for reproducibilityoptions.output?: string— output file path
Returns a seeded PRNG function (mulberry32) producing floats in [0, 1).
Returns the FIDE expected score for a given rating difference.
Converts TRF content into the Player[] + Game[][] structure expected by
pair().
Extracts expected pairings for a specific round from TRF data.
Finds players with pre-assigned absences for a round.
MIT