Last active
April 29, 2023 17:57
-
-
Save nitzel/e09b86d6027062844e9d94edd2408ff5 to your computer and use it in GitHub Desktop.
Playtak Native Tournament data structure brainstorming
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Not part of MVP | |
*/ | |
type TournamentType = { // not part of mvp, describes the rules of the tournament | |
komi: "no", | |
stages: [ | |
{ | |
type: "round robin", | |
maxGroupSize: 5, | |
rules: GameRules | |
}, | |
{ | |
type: "single elemination" | |
}, | |
//... | |
] | |
} | |
type TournamentPlayerEntryRequirements = { // TBD | |
// not sure how exactly that'll work | |
eloRange: [number, number] | |
} | |
/** | |
* Part of MVP | |
* | |
* While many types here reference each other like in a double linked list, if we go with SQL, | |
* it'll be simpler just to refer to the "parent" ID from the child, as it's always a one-to-many relationship. | |
*/ | |
type Game = { | |
id: "", // PK | |
matchup_id: "", // FK | |
player1goesFirst: boolean, // tbd, maybe have nameWhite/nameBlack here duplicated from the Matchup | |
rules: GameRules, | |
// filled in after the game | |
playtakGameId: 513212, | |
result: "1-0"|"R-0"|"0-R", | |
} | |
type Matchup = { | |
id: "" // PK | |
group_id: "" // FK | |
player1: "me" // FK - this player always plays white first | |
player2: "you" // FK | |
games: [Game] | |
} | |
type Group = { | |
id: "", // PK | |
stageId: "", // FK | |
name: "Group 1" | "Group 2", // optional? | |
games: [Matchup] | |
} | |
type Stage = { | |
id: "", // PK | |
tournamentId: "", // FK | |
name: "Group Stage" | "Semi Finals", | |
groups: [Group] | |
rules: GameRules // tbd: is this necessary? let's have it for now | |
} | |
type Tournament = { // part of mvp | |
id: "", // PK | |
name: "Intermediate 2023", | |
type: "Round Robin, then single elemination", | |
matchupType: "single game" | "double game", | |
stages: [Tournament] | |
// maybe skip these for now | |
applications?: any | |
acceptedApplications?: any | |
entryRequirements?: TournamentPlayerEntryRequirements | |
} | |
type GameRules = { | |
id: number; | |
name: string; | |
/** Seconds */ | |
timeContingent: number; | |
/** Seconds */ | |
timeIncrement: number; | |
extraTimeTriggerMove: number; | |
/** Seconds */ | |
extraTimeAmount: number; | |
komi: number; | |
boardSize: number; | |
capstones: number; | |
pieces: number; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment