Matches, tournaments and games

match — Display a match

Shows the positions and analyses of an imported match. In text and summary output, the header repeats what the source file says about the match when it says it: each player’s Elo rating and experience, transcriber, Jacoby and Beaver rules of a money session, program that wrote the file; the json output carries them in the match object.

When the match kept the duration of its decisions (a match played against a bot, see the Duel), the text output gives the duration of each decision, the cube decision apart, and the summary output each player’s total and mean, with the mark of the player whose reserve ran out first, then the number of its decisions per non-empty duration band (<2 s: 4, 2-5 s: 11); /v1/stats.matchTimeSummary delivers these bands (the histogram of each player, bounds in milliseconds in histogram_bounds_ms); the json output carries decision_ms and cube_decision_ms. An unknown duration is not written. list --type timeerrors gives, per player and duration band (under 5 s, 5 to 15 s, 15 to 30 s, over 30 s), the number of decisions, the mean error and the share of blunders; --format json delivers the rows. --ids (match IDs, comma-separated) restricts the table to those matches: the review of a tournament or of a session.

For a match played here by a Duel, the text and summary outputs add its origin: the start, the revealed dice seed and its SHA-256, to compare with the fingerprint published when the Duel was created, how the match ended (played to the end, stopped before the end, or lost on time and by whom), the time control, the player whose reserve ran out first and the Bot (level, gammonNet version). For a match that was not played here, they write Origin: not played here. The json output carries the origin under origin (including lost_on_time), null for a match that was not played here. The server serves it through /v1/matches.origin: null for a match without origin, 404 for a match that does not exist.

For an analysed match, each play’s loss of match-winning chances (mwc_loss, a fraction: 0.0123 is 1.23%, null for an unrated play) follows the same path: the json output carries the list under decision_losses, text adds an MWC loss line to rated plays and summary gives the total per player, equal to the MWC loss in the match list. Each entry also carries its difficulty (difficulty, the expected loss of a reference player in the same position, same unit, null for an unrated play) and avoidable for an avoidable error; the json output adds difficulty_summary (per player: difficulty, excess, ratio, avoidable), text the Difficulty and Avoidable error lines, summary a Difficulty section. The server serves it through /v1/stats.matchDecisionLosses.

The json output also carries win_trace: the first player’s match winning chances before and after each move (mwc_before, mwc_after, as fractions), analysed for an analysed move, null without analysis, with mwc_loss and error to mark errors; money is true for a money game, none of whose moves has a value. text adds the line MWC (<player 1>): 50.00% -> 48.77% to analysed moves (Match winning chances curve). The server serves it through /v1/stats.matchWinTrace.

summary ends with a Review section, the match summary (match summary): per player, the PR and its 95 % interval over the games, the MWC loss scaled to 7 points and its interval over the games, the luck-adjusted result (with the result, the net luck, the error gap and the dice coverage), the three errors to review (game, move, loss and avoidable share) and the split of errors between hasty and deliberate. The server serves it through /v1/stats.matchReview. In stats, the overall PR and the rows by phase, by label and by score carry their 95 % interval over the matches (column 95 % CI), and list --type players a column L7.

./blunderdb match --db <path> --id <id> [--format <format>] [--output <file>]

Options:

  • --db — Database (required).

  • --id — Match ID to display (required).

  • --format — Output format: json, text or summary (default: json).

  • --output — Output file (default: stdout).

Examples:

./blunderdb match --db base.db --id 1 --format summary
./blunderdb match --db base.db --id 1 --format text
./blunderdb match --db base.db --id 1 --output match1.json

match repair — Rewrites a match’s positions, analyses and errors from its source file, the one the Info tab of its card names. The match keeps its identifier, its tournament, the player names as stored (aliases, corrections, swap), its date, its comment, its video and its marks, its transcription, and the comments written on its positions: a comment left on a position the repair leaves moves to the one the file names for the same move, unless a collection, an Anki card or a lesson still holds that position; the comment then stays there and the report counts it. An analysis deeper than the file’s (a rollout run since the import) or corrected by hand stays. A match that already matches its file is not rewritten. --dry-run says what would change without writing anything. --list goes through every match that names a source file and gives those that differ from it, with the number of moves whose position changes and the share of analysed moves before and after, as well as those whose file cannot be found; it writes nothing. A relative path is looked for from the database’s folder, then from the current folder. The repair is refused when the file cannot be found, no longer holds the match (its fingerprint is no longer that of the stored match), or when the stored moves do not tell which player of the file is which. The server serves it through /v1/matches.repair, with the source file sent in the request.

./blunderdb match repair --db <chemin> (--id <ID> [--dry-run] | --list) [--format text|json]
./blunderdb match repair --db base.db --list
./blunderdb match repair --db base.db --id 42 --dry-run
./blunderdb match repair --db base.db --id 42

tournament — Read a directed tournament

Reads a directed tournament without a graphical interface. Directing one interactively is the job of the Nicomaque engine’s own console; these sub-commands read, none of them waits for input, and only move and confirm write.

./blunderdb tournament <sous-commande> --db <chemin> [options]

Subcommands:

  • list [--format text|json] — The directed tournaments of the database, with their state, the engine version, the event each belongs to (empty if none) and the date of the last decision.

  • verify --id N [--format text|json] — Replays the direction and reports any remaining warning. Exits in error if one remains: this is the after-the-fact check, and a script that runs it over a season’s databases wants a status code, not a line to filter.

  • standings --id N — The standings as CSV, prizes included, in the language of the interface.

  • ranking --season [--rencontre N] [--from AAAA-MM-JJ] [--to AAAA-MM-JJ] [--points 25,18,15] [--participation P] [--elo] [--format csv|json] — The season ranking: the closed tournaments of an event or of a period (bounds included, on the tournament date; with no filter, all the directed tournaments), each place converted into points by the scale (winner first; by default 25, 18, 15, 12, 10, 8, 6, 4, 2, 1), plus --participation per tournament played. Ties share the average of the places they occupy. A person is recognised from one tournament to the next by name. --elo adds a club Elo replayed over the season’s matches (FIBS formula, starting at 1500). The CSV gives one row per person and one column of points per tournament; a tournament that is not closed is listed but earns nothing.

  • page --id N|--rencontre N [--out <folder>] — The HTML display page of a competition (--id), or an event’s wall page (--rencontre: one line per table, whichever competition occupies it). Exactly one of the two is required. Without --out it goes to standard output; with it, the page is written into the folder, which becomes the direction’s own, or the event’s.

  • export --id N — The raw event journal, replayable by the engine’s tools. The journal is the whole truth of a direction: the standings, the brackets and the warnings are replayed from it. A tool reading this output needs no blunderDB at all.

  • move --id N --match M --table T [--format text|json] — Changes the table of a running match, like dragging one cell onto another in the grid. If the target table is taken, the two matches swap tables; an out-of-service table is refused. In an event, if the table is taken by another competition, the swap happens between the two competitions: a table change is written in each log. Prints the table of every running match.

  • hall --rencontre N [--format text|json] — All the tables of an event: one line per table, whichever competition occupies it (competition, match, players), then the proposals of every competition in a single queue (proposal), the players who have waited longest first, and lastly the matches held for want of a table or of a free player (held, with their reason). This is the grid that the All tables view of the Direction displays. Tables are grouped by room when the event has any, and named when they have a name.

  • proposals --id N [--format text|json] — The engine’s numbered queue of proposals: matches, draws, phase change, repechage of a withdrawn pool qualifier.

  • confirm --id N --n K [--format text|json] — Confirms proposal number K of proposals, like Launch in the panel, then shows the queue that follows.

  • tables --rencontre N|--tournament N [--format text|json] — The table properties (name, room, reserved, assigned to) and the rooms each competition of an event plays in (--rencontre), or the properties of a competition that plays alone (--tournament). Read-only: writing goes through call (rencontres.setTables, rencontres.setEventRooms, directions.setTables).

Common options: --db (required), --id (required except for list, ranking, page --rencontre, hall and tables), --format.

Examples:

./blunderdb tournament list --db base.db
./blunderdb tournament verify --db base.db --id 3
./blunderdb tournament standings --db base.db --id 3 > classement.csv
./blunderdb tournament ranking --db base.db --season --from 2026-01-01 --to 2026-12-31 --elo > saison.csv
./blunderdb tournament page --db base.db --id 3 --out /tmp/affichage
./blunderdb tournament page --db base.db --rencontre 1 --out /tmp/evenement
./blunderdb tournament export --db base.db --id 3 > journal.json
./blunderdb tournament move --db base.db --id 3 --match m4 --table 7
./blunderdb tournament hall --db base.db --rencontre 1
./blunderdb tournament tables --db base.db --rencontre 1
./blunderdb tournament proposals --db base.db --id 3
./blunderdb tournament confirm --db base.db --id 3 --n 1

transcribe — Replay a transcription

Replays a transcription and reports what the replay finds in it. The source is a .mat file, a match of the library or a transcription draft — exactly one of the three. A match is read through the .mat it would export, so what is replayed is what an export would contain.

./blunderdb transcribe --mat <fichier> [--check] [--render <sortie>]
./blunderdb transcribe --db <path> --match <id> --check
./blunderdb transcribe --db <path> --draft <id> --check
./blunderdb transcribe --db <path> --match <id> --edit [--accept-losses]
./blunderdb transcribe --db <path> --draft <id> --finish|--abandon
./blunderdb transcribe --db <path> --materialize <document.json>
./blunderdb transcribe --db <path> --import <fichier.mat|document.json>
./blunderdb transcribe --db <path> --marks <manifeste.jsonl> [--match <id>]

Options:

  • --mat — .mat file to replay.

  • --db — Database, for --match and --draft.

  • --match — Id of the library match to replay.

  • --draft — Id of the transcription draft to replay.

  • --check — List the inconsistencies found (the default behaviour).

  • --render — Write the transcription back as .mat to this path.

  • --format — Output format: text (default) or json.

  • --edit — Opens a draft on the --match (or returns the one already open on it).

  • --accept-losses — With --edit on an imported match: accepts that its analyses and comments may be lost.

  • --finish — Finishes the --draft: writes its match, or replaces the one it was opened from, and releases the draft.

  • --abandon — Abandons the --draft: deletes it without a match; a match it was opened from stays as it is.

  • --yes — With --abandon on a draft that never produced a match: confirms that everything typed in it is lost.

  • --materialize — JSON document (header and actions, dice included) to write as a match in one go, or not at all.

  • --import — .mat file or JSON transcription document to open a new draft on.

  • --marks — Writes the manifest of the local videos’ marks to this path, one JSON line per timed move (--match narrows it to one match).

--check names each inconsistency with the number of the action and the game it sits in: an illegal play, two turns in a row for the same player, an impossible cube action, an action past the end of the match, a play whose steps do not use its own dice, a game’s first play rolled as a double, which no opening roll can be, an unrecorded play — the ??? cell gnubg writes when it did not keep the play that was made, and which is not a dance, a declared score that does not add up — a game whose score line is not the one the previous games give, replayed at the written score.

An inconsistency is reported, never held against the input: nothing is refused for one, and the exit status stays 0 whatever the replay finds. A non-zero status signals a real failure — an unreadable file, a database that will not open, an output that cannot be written. A script that wants to act on the findings reads them from --format json, where a broken file and a game containing an illegal play are not confused with one another.

--render writes the transcription back out as .mat, which is how the round trip is checked on a real file outside the tests.

--materialize writes, without a draft, the match played by an actions document that came from elsewhere. The rules are applied strictly: the first refused action makes the command fail with its rank (from 0) and its reason, and nothing is written. The decision durations of the document (decision_ms, cube_decision_ms) are carried over onto the moves.

--import opens a new draft on a .mat file or on a JSON transcription document (header, actions, and optionally format_version and next_score, the shape a draft is stored in). The file’s inconsistencies are kept and marked, as in any draft: they are corrected before --finish writes the match. A file no replay can read — unreadable JSON, unknown action kind, player, die or point off the board, .mat without a game — fails the command and opens no draft.

Only three other options write, through the same methods as the Transcription panel: --edit opens a draft on an existing match, --finish finishes it — the match is replaced under the same identifier — and --abandon deletes a draft without a match, and requires --yes for a draft that was never finished, which takes everything typed in it along. An imported match carries analyses and comments that a .mat does not: --edit reports at most their count and refuses without --accept-losses.

--marks writes a manifest and does not touch the database: one JSON line per move that carries a mark (an instant of the video), for the matches whose video is a local file only. Each line gives the video’s path, the match, the game and the move number, the player, the dice, the play, the board before and after, roll_tick_ms (the instant of the roll) and tick_ms (the instant of the play); a move without a mark is not listed. A video that is an http(s) URL never enters it: it is counted in the summary at the end of the run. A local file missing from the disk is reported on the error output and its match left out. No image is read or written. The command exists on the command line only: the serve daemon reads no video file, and the desktop does not expose it.

Example:

./blunderdb transcribe --mat match.mat --check

# match.mat: 7 point match, 4 game(s), 203 action(s)
#   Final score: 9-2
# Inconsistencies: none

duel — Play a Duel

Plays a Duel without an interface, one Action per call. Each call is its own process: it resumes the Duel from the database, plays one Action and writes it back. The durations of the moves of a Duel played this way are unknown, never zero.

./blunderdb duel create --db <path> (--length <n> | --money [--jacoby]) [--side1 <côté>] [--side2 <côté>]
./blunderdb duel create --db <path> --length <n> [--start <XGID>] [--away <j1>,<j2>] [--reroll] [--after-cube] [--single-game] [--minutes-per-point <min> --delay <s>]
./blunderdb duel show --db <path> --id <id>
./blunderdb duel list --db <path>
./blunderdb duel move --db <path> --id <id> --play "24/18 13/11"
./blunderdb duel roll|double|take|pass|resign --db <path> --id <id>
./blunderdb duel forfeit --db <path> --id <id> --side 1|2
./blunderdb duel contribute --db <path> --id <id> --side 1|2 --value <texte>
./blunderdb duel stop|discard --db <path> --id <id>

Subcommands:

  • create — Starts a Duel and plays up to the first decision of an external Side. --length (1 to 25 points) or --money; --start (XGID of the Start); --name1 and --name2; --side1 and --side2 (external, or bot:<level> with instant, normal or thorough, or external:<configuration>@<engine>, an external Side declaring the Bot that plays behind it: the Match’s origin records it as declared, not attested); --discard-at-end throws the draft away at the end instead of writing the Match; --combined-seed rolls no die before each external Side has contributed to the seed. --away gives the score of the first game in points away, player1,player2 (1: the Crawford game, 0: one point after it), and replaces that of --start; without --start, the game starts from the initial position at this score. --reroll has the roll carried by --start drawn again; --after-cube begins after the cube decision of the Start (the player on roll rolls at once, an offered double is taken) — by default the Duel begins before it, and an offered double waits for the opponent’s answer. --single-game stops the Duel at the end of its first game, written alone as a Match. --minutes-per-point and --delay set the time control: each player’s reserve in minutes per point of the match (Standard 2, Speed 0.4) and the delay per move in seconds (12, 10); --time-out (continue or lose_match) what an exhausted reserve does. A Start the rules do not admit (checkers, score beyond the length, both players in the Crawford game, cube) is refused with its reason. With two Bots, the whole match is played in this call (--side1 bot:instant --side2 bot:instant); a money session between two Bots is refused, since it would never end, except as a single game.

  • show — The score, what the Duel is waiting for and, for a move, the legal plays. The dice seed is never shown before the end: the fingerprint stands for it.

  • list — The suspended Duels.

  • roll, move, double, take, pass, resign — One Action by the Side the Duel is waiting for (--side 1|2 to name it); --play gives the move in notation, in any order; --level (1 to 3) the value of a resignation; --revision refuses the Action if the Duel has moved on.

  • contribute — An external Side’s contribution to the combined seed (--side 1|2, --value, 1 to 64 bytes), only once, before the first roll; the last contribution starts the dice. The rolls then come from the HMAC-SHA256 of the sealed seed over each Side’s contribution preceded by its length, and the Match’s origin carries the contributions.

  • forfeit — The Side --side (required) forfeits the match: the game in progress goes to the other Side for the points that bring it to the length (in money play, a single game at the cube’s value), and the Match is written as won by it.

  • stop — Stops a money session and writes its Match as it stands, the game in progress with no winner. A match in points is refused: it is written only whole (forfeit, discard). Stopping is not forfeiting.

  • discard — Throws the Duel away: nothing is written.

All take --db and --format (text or json).