Tournaments
Overview
Automated tournaments are distinct from organizer events. The backend runs signup, pairing, and game creation from TOURNAMENT* records and scheduled public queries.
Record types
| pk | sk | Purpose |
|---|---|---|
TOURNAMENT |
<tournamentid> |
Tournament definition and state |
TOURNAMENTPLAYER |
<tournamentid>#<division>#<playerid> |
Player entry |
TOURNAMENTGAME |
<tournamentid>#<division>#<gameid> |
Linked game |
COMPLETEDTOURNAMENT |
<metaGame>#<tournamentid> |
Archived tournament |
TOURNAMENTCOMMENTS |
<tournamentid> |
Public tournament chat log |
TOURNAMENTSCOUNTER |
<metaGame>#<variants> (single-leg) or �#2 (two-leg) |
Serial number counter per series |
Lifecycle
- Create � auth
new_tournament(organizer). Requires the meta game to supportplayercount: 2in gameslib (playercountsincludes2). OptionalmatchLegs: 2enables two-leg pairings (leg 2 opens when leg 1 ends, with swapped seats). Default is single game per opponent (matchLegs: 1or omitted). - Join / withdraw �
join_tournament,withdraw_tournament. Join is rejected for the same 2-player requirement. - Start �
starttournamentsLambda (EventBridge 10:00/22:00 UTC). Admins can also invoke it for one tournament (including resume after a partial start). Signup tournaments for ineligible games are cancelled (same path as zero participants). - Play � games are normal
GAMErecords linked viaTOURNAMENTGAME. - End � auth
end_tournament; publicarchive_tournamentsmoves completed tournaments.
Time control
Automated tournament games use a hard Fischer clock set when starttournaments creates pairings (constants in lib/tournaments/clock.ts): players begin with the full clockMax bank (120 hours today), gain clockInc hours per move (36 hours today), and remain capped at clockMax. Leg-2 games reset both players to clockMax when spawned from a finished leg-1 game.
Two-leg format (matchLegs: 2)
- At start, only leg 1 games are created (same round-robin pairings as single-leg).
divisions.*.numGamescounts both legs (2 �pairings per division).- When a leg-1 game finishes, the API creates leg 2 for that pairing with reversed seat order.
- Generated game records use
header.roundof1:1and1:2({schedulingRound}:{matchLeg}). Single-leg tournaments remain1.
Public schedulers
These are called by cron or external schedulers (no user auth):
get_tournaments,get_tournament,get_old_tournamentsarchive_tournaments
Player blocking
Tournament pairing and visibility are not affected by player blocking.
Queries
See Public queries and Auth queries tournament sections.
Tournament chat
- Read � public
get_tournamentreturnscomments(same shape as in-gameGAMECOMMENTSentries; Markdown on the client). - Write � auth
submit_tournament_comment(tournamentid,comment). Participants (any division) and site admins may post. - Notify � other participants receive in-app
tournamentChatnotifications (preftournamentChat, deduped per tournament). Real-time refresh on the tournament page uses WebSocketwatchTournamentsand verbtournament.
Related
- Events � manual organizer events
- Database schema