Tournament Generator

Simulator

Class responsible for simulating a tournament

Simulating a tournament can be useful if you want to generate all the games beforehand. It generates random scores and progresses teams into next groups / rounds to generate them too. This will allow generating the whole tournament beforehand to calculate all the games and time necessary to play.

Tags
author

Tomá? Vojík vojik@wboy.cz

since
0.3

Table of Contents

simulateCategory()  : array<string|int, Game>
Generates and simulates a tournament category.
simulateCategoryReal()  : array<string|int, Game>
Generates and simulates a category as if it was played for real.
simulateGroup()  : array<string|int, Team>
Simulates games in a given group.
simulateRound()  : void
Simulates games in a round
simulateRounds()  : array<string|int, Game>
Simulate the whole tournament as it was played for real
simulateRoundsReal()  : array<string|int, Game>
Generates and simulates rounds as if it was played for real.
simulateTournament()  : array<string|int, Game>
Simulate the whole tournament as it was played for real
simulateTournamentReal()  : array<string|int, Game>
Generates and simulates the tournament as if it was played for real.

Methods

simulateCategory()

Generates and simulates a tournament category.

public static simulateCategory(Category $category) : array<string|int, Game>

Generates the games for each round, simulates it, progresses the teams and resets the scores. Uses dummy team objects to progress.

Parameters
$category : Category

Category to simulate

Tags
throws
Exception
see
Simulator::simulateRounds()
Return values
array<string|int, Game>

simulateCategoryReal()

Generates and simulates a category as if it was played for real.

public static simulateCategoryReal(Category $category) : array<string|int, Game>

Progresses the real teams, does not create dummy teams.

Parameters
$category : Category

Category to simulate

Tags
throws
Exception
see
Simulator::simulateRoundsReal()
Return values
array<string|int, Game>

simulateGroup()

Simulates games in a given group.

public static simulateGroup(Group $group[, array<string|int, TeamFilter>|array<string|int, array<string|int, TeamFilter>> $filters = [] ][, bool $reset = true ]) : array<string|int, Team>
Parameters
$group : Group

Group to simulate

$filters : array<string|int, TeamFilter>|array<string|int, array<string|int, TeamFilter>> = []

Filters applied to returned teams (ex. if you only want to return the winning team)

$reset : bool = true

If the group should reset its scores after simulation

Tags
throws
Exception
Return values
array<string|int, Team>

Teams sorted and filtered after simulation

simulateRound()

Simulates games in a round

public static simulateRound(Round $round) : void
Parameters
$round : Round

Round to simulate

Tags
throws
Exception
Return values
void

simulateRounds()

Simulate the whole tournament as it was played for real

public static simulateRounds(WithRounds $object) : array<string|int, Game>

Generates the games for each round, simulates it, progresses the teams and resets the scores. Uses dummy team objects to progress.

Parameters
$object : WithRounds

Tournament or Category to generate games from.

Tags
throws
Exception
post

The games' scores will be reset

Return values
array<string|int, Game>

All played games

simulateRoundsReal()

Generates and simulates rounds as if it was played for real.

public static simulateRoundsReal(WithRounds $object) : array<string|int, Game>

Progresses the real teams, does not create dummy teams.

Parameters
$object : WithRounds

Tournament or Category to generate games from.

Tags
throws
Exception
Return values
array<string|int, Game>

simulateTournament()

Simulate the whole tournament as it was played for real

public static simulateTournament(Tournament $tournament) : array<string|int, Game>

Generates the games for each round, simulates it, progresses the teams and resets the scores. Uses dummy team objects to progress.

Parameters
$tournament : Tournament

Tournament to simulate

Tags
post

The games' scores will be reset

throws
Exception
see
Simulator::simulateRounds()
Return values
array<string|int, Game>

All played games

simulateTournamentReal()

Generates and simulates the tournament as if it was played for real.

public static simulateTournamentReal(Tournament $tournament) : array<string|int, Game>

Progresses the real teams, does not create dummy teams.

Parameters
$tournament : Tournament

Tournament to simulate

Tags
throws
Exception
see
Simulator::simulateRoundsReal()
Return values
array<string|int, Game>

Search results