-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
111 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
"typescript": "^5.3.3" | ||
}, | ||
"dependencies": { | ||
"luxon": "^3.4.4" | ||
"luxon": "^3.4.4", | ||
"uuid": "^9.0.1" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { v4 as guid } from "uuid"; | ||
|
||
export const generateId = () => guid(); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,49 @@ | ||
import { generateId } from "../utilities"; | ||
|
||
/** | ||
* Activity type for scheduling; options are: | ||
* - all: all teams are scheduled at once | ||
* - single: each team will get a single run at this activity | ||
* - multiple: each team will get multiple runs at this activity | ||
*/ | ||
export type ActivityType = "all" | "single" | "multiple"; | ||
|
||
/** | ||
* A single type of tournament activity. | ||
* e.g. Judging session, Lunch break, Robot Round 1 | ||
*/ | ||
export default class Activity {} | ||
export default class Activity { | ||
id: string; | ||
type: ActivityType; | ||
name: string; | ||
/** | ||
* How long (in minutes) is one session of this activity? | ||
* Specifically, how long is the team at the location | ||
*/ | ||
duration: number; | ||
/** | ||
* How long (in minutes) does it take to clean up after this activity? | ||
* Specifically, how long after a team is done can the next team start? | ||
*/ | ||
cleanup: number; | ||
/** When does the activity start? In minutes from midnight on the first tournament day */ | ||
start: number; | ||
|
||
/** Names of each location */ | ||
locations: string[]; | ||
constructor( | ||
name: string, | ||
type: ActivityType, | ||
start: number, | ||
duration: number, | ||
cleanup: number | ||
) { | ||
this.id = generateId(); | ||
this.name = name; | ||
this.type = type; | ||
this.duration = duration; | ||
this.cleanup = cleanup; | ||
this.start = start; | ||
this.locations = []; | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import Activity from "../activity"; | ||
import Tournament from "../tournament"; | ||
|
||
const initAusFLL = (tournament: Tournament) => { | ||
let time = tournament.config.startTime; | ||
const numTeams = tournament.teams.length; | ||
const numTables = 4; | ||
|
||
tournament.activities.push( | ||
new Activity("Opening Ceremony", "all", time, 30, 0) | ||
); | ||
tournament.activities.push(new Activity("Lunch", "all", 12 * 60, 30, 0)); | ||
tournament.activities.push( | ||
new Activity( | ||
"Closing Ceremony", | ||
"all", | ||
tournament.config.endTime - 30, | ||
30, | ||
0 | ||
) | ||
); | ||
const availableTime = | ||
tournament.config.endTime - tournament.config.startTime - 60 - 30; | ||
const matchesPerRound = Math.ceil(numTeams / 2); | ||
const timeForRound = Math.ceil(availableTime / 3); | ||
const matchLength = Math.ceil(timeForRound / matchesPerRound); | ||
const matchDuration = Math.max(Math.ceil(matchLength / 2), 4); | ||
const matchCleanup = matchLength - matchDuration; | ||
time += 30; | ||
tournament.activities.push(new Activity("Judging", "single", time, 45, 0)); | ||
tournament.activities.push( | ||
new Activity("Round 1", "single", time, matchDuration, matchCleanup) | ||
); | ||
time += matchLength * matchesPerRound; | ||
tournament.activities.push(new Activity("Round 2", "single", time, 4, 2)); | ||
time += matchLength * matchesPerRound; | ||
tournament.activities.push(new Activity("Round 3", "single", time, 4, 2)); | ||
}; | ||
|
||
export default initAusFLL; |
This file contains 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