Match

The Match class is the top-level entity representing a padel match. It encapsulates both the metadata (teams, duration, location) and the state management logic by holding a MatchScoreHistory instance.

Properties

  • Name
    history
    Type
    MatchScoreHistory
    Description

    The underlying MatchScoreHistory engine driving the score logic.

  • Name
    winner
    Type
    Team | None
    Description

    Returns the Team that won the match based on best_of_sets, or None if incomplete.

  • Name
    is_completed
    Type
    bool
    Description

    Returns True if a winner has been decided.


Initialization

You can create a Match by providing optional parameters. If no teams are provided, default generic teams will be instantiated.

Keyword Arguments

  • Name
    teams
    Type
    dict[TeamId, Team]
    Description

    A dictionary mapping a TeamId to a Team object.

  • Name
    best_of_sets
    Type
    int
    Description

    The number of sets to determine a winner (e.g., 3 means the first to win 2 sets wins).

  • Name
    duration_minutes
    Type
    int | None
    Description

    Total duration of the match in minutes.

  • Name
    date
    Type
    datetime | None
    Description

    The date and time of the match.

  • Name
    location
    Type
    str | None
    Description

    The venue or location.

  • Name
    court_type
    Type
    str | None
    Description

    E.g., "Indoor", "Outdoor".

Instantiation

class
Match
from padelkit import Match
from datetime import datetime

match = Match(
    best_of_sets=3,
    location="Club Padel",
    date=datetime.now()
)

Output structure

Match(
  teams=...,
  best_of_sets=3,
  duration_minutes=None,
  date=datetime.datetime(...),
  location='Club Padel',
  court_type=None
)

Was this page helpful?