Skip to content
Coen Dunnink edited this page Aug 9, 2024 · 29 revisions

Welcome to the php-sports-planning wiki!

Sports

Every sport has one of the defined GameModes. Per gamemode there can be a

GameModes

name example description nrOfGamePlaces
AllInOneGame cycling, "formula 1"-racing, marathon All competitors play which eachother in a game nrOfPoulePlaces
Single shuffleboard or bridge 1 or more competitors play with eachother in a game 1 <= x <= max of (4 or nrOfPoulePlaces)
Against football or basketball 2 competitors battle against eachother ina game nrOfGamePlaces is divided in 2 AgainstSides. Home and Away, each has a nrOfPlaces available with a maximum of 2

PlanningSchedules

Each PlanningSchedule has one or more SportSchedules for a nrOfPlaces. The name is based on these two properties.

examples

nrOfPlaces SportSchedules GameModes
6 [{"nrOfHomePlaces":1,"nrOfAwayPlaces":1,"nrOfH2H":1}] Against
8 [{"nrOfGamesPerPlace":1,"nrOfGamePlaces":4}, {"nrOfHomePlaces":2,"nrOfAwayPlaces":2,"nrOfGamesPerPlace":2}] Single, Against
8 [{"nrOfGamesPerPlace":4}, {"nrOfGamesPerPlace":3,"nrOfGamePlaces":2}] AllInOneGame, Single

restrictions

There are some restrictions to the combination of SportSchedules:

  1. For SportSchedules with a Sport with GameMode Against there are 3 combinations of nrOfHomePlaces and nrOfAwayPlaces available: "1 vs 1", "1 vs 2" and "2 vs 2"
  2. For SportSchedules with a Sport with GameMode Single the maximum nrOfGamePlaces is 4
  3. The maximum nrOfGames is 496
  4. The maximum nrOfSportSchedules is 12

#TODO write tests to check if business-exceptions are thrown when these restrictions are not met. #TODO check these restrictions also on the frontend side.

gamesCreation

To create the correct games based on the PlanningSchedule the following things should be considered: Every competitor should play 1 the same nrOfGames 2 the same nrOfGames at Home if there are Sports with GameMode Against 3 the same nrOfGames Against eachother if there are Sports with GameMode Against 4 the same nrOfGames With eachother if there are Sports with GameMode Against and has a Side with multiple nrOfPlaces 5 the same nrOfGames Together(including Sports with GameMode Single and Against)

Because creating these games for a certain PlanningSchedule can be time-consuming. There are two extra properties added: "succeededMargin" and "nrOfTimeoutSecondsTried".

Why these properties are added and how the 5 above criteria should be met will be explained in the following chapter.

counters

De volgende counters bestaan :

naam omschrijving sporten aantal items
Amount hoe vaak een deelnemer is toegekend(Assigned) alle 1
With met wie je in 1 team hebt gespeeld "Against - GamesPerPlace" 2
Against tegen wie je hebt gespeeld "Against - H2h" & "Against - GamesPerPlace" 2
Home hoe vaak een deelnemer "Home" heeft gespeeld "Against - H2h" & "Against - GamesPerPlace" 1
Together met wie je in 1 wedstrijd hebt gespeeld "With" & "Against - H2h" & "Against - GamesPerPlace" 2

volgorde & afhankelijkheden

Bij het aanmaken van een schedule voor meerdere sporten wil je dat de deelnemers even vaak samen spelen. De volgorde van het verwerken van de sporten en de voorwaarden staan hieronder beschreven:

volgorder naam voorbeeld omschrijving afhankelijke counters toepasbare counters
1 AllInOneGame wielrennen Iedereen speelt tegelijk
2 Single sjoelen 1 of meerdere spelers spelen samen Amount (sort) & Together
3 Against-H2h voetbal Is altijd "1vs1", je geeft op hoevaak iedereen tegen elkaar speelt (max 4) Home
4 Against-GamesPerPlace tennis (veranderende teams) Is "1vs2" of "2vs2", je geeft op hoevaak iedereen speelt. Wanneer niet iedereen even vaak kan spelen dan is het opgegeven aantal het maximum Together & Home Amount & Together & Home & With & Against

iedereen evenveel thuiswedstrijden laten spelen

Na het bepalen van de wedstrijden (welke plaats in welke wedstrijd komt), moet er voor gezorgd worden dat iedereen evenvaak thuis speelt. Deze onbalans kan alleen ontstaan bij het sporttype "Against-GamesPerPlace".