Aller au contenu

tournament.py

Tournament

Model for tournament. All tournaments have rounds associated with them, these rounds have matches associated with them.

Attributes:

Name Type Description
name str

Tournament's name.

location str

Tournament's physical location.

date str

Tournament's date.

number_of_rounds int

Number of rounds to be played.

time_control str

Type of time control chosen.

description str

Tournament's description.

id_num int

Tournament's unique id.

is_finished bool

Is the tournament finished ?

players list[Player]

List of participating players.

leaderboard dict

Tournament's leaderboard.

rounds dict

All rounds associated with this tournament.

__init__(self, name, location, date, number_of_rounds, time_control, description, id_num, is_finished, players, leaderboard) special

Constructor for Tournament.

Parameters:

Name Type Description Default
name str

Tournament's name.

required
location str

Tournament's physical location.

required
date str

Tournament's date.

required
number_of_rounds int

Number of rounds to be played.

required
time_control str

Type of time control chosen.

required
description str

Tournament's description.

required
id_num int

Tournament's unique id.

required
is_finished bool

Is the tournament finished ?

required
players list

List of participating players.

required
leaderboard dict

Tournament's leaderboard.

required
Source code in models/tournament.py
def __init__(
    self,
    name: str,
    location: str,
    date: str,
    number_of_rounds: int,
    time_control: str,
    description: str,
    id_num: int,
    is_finished: bool,
    players: list,
    leaderboard: dict,
):
    """Constructor for Tournament.

    Args:
        name (str): Tournament's name.
        location (str): Tournament's physical location.
        date (str): Tournament's date.
        number_of_rounds (int): Number of rounds to be played.
        time_control (str): Type of time control chosen.
        description (str): Tournament's description.
        id_num (int): Tournament's unique id.
        is_finished (bool): Is the tournament finished ?
        players (list[Player]): List of participating players.
        leaderboard (dict): Tournament's leaderboard.
    """

    self.name = name
    self.location = location
    self.date = date
    self.number_of_rounds = number_of_rounds
    self.time_control = time_control
    self.description = description
    self.id_num = id_num
    self.is_finished = is_finished
    self.players = players
    self.leaderboard = leaderboard

    self.rounds = {}