Tournament

com.phasmidsoftware.gambit.game.Tournament
class Tournament[P, S, M, Pl](contestants: Seq[Contestant[S, M, Pl]], gamesPerPairing: Int = ..., random: Random = ...)(using state: State[P, S], game: Game[S, M, Pl])

A round-robin tournament for two-player zero-sum games.

Every pair of contestants plays gamesPerPairing games with each contestant taking the first-player role in half the games, so neither side has a systematic first-move advantage in the overall standings.

== Scoring == Standard football (soccer) 3-1-0 scoring: Win = 3 points Draw = 1 point Loss = 0 points

Ties in the table are broken by goal difference (wins minus losses), then by total wins.

== Usage ==

 val t = Tournament(contestants, gamesPerPairing = 10, random = new Random(42L))
 println(t.leagueTable)

Type parameters

M

the move type.

P

the proto-state type.

Pl

the player identity type.

S

the state type.

Value parameters

contestants

the players to enter in the tournament.

game

implicit Game[S, M, Pl].

gamesPerPairing

number of games each ordered pair plays (A-as-first vs B-as-second). Each unordered pair therefore plays 2 * gamesPerPairing games in total.

random

random source passed to each GameRunner.

state

implicit State[P, S].

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def leagueTable: String

Run the full round-robin and return a formatted league table string.

Run the full round-robin and return a formatted league table string.

Each row shows: rank, name, games played, wins, draws, losses, points. Rows are sorted by points desc, then goal difference desc, then wins desc.

Attributes

def standings: Seq[(String, Int, Int, Int, Int, Int, Int)]

Run all pairings and return the sorted standings. Each entry is (name, played, wins, draws, losses, goalDiff, points).

Run all pairings and return the sorted standings. Each entry is (name, played, wins, draws, losses, goalDiff, points).

Attributes