-
Notifications
You must be signed in to change notification settings - Fork 6
GameStats
Gabriël edited this page Nov 1, 2021
·
1 revision
The GameStats class holds statistics for a Game instance and all players in it.
-
scores: list[int]- A shorthand for collecting all scores of all individual players. -
alives: list[bool]- A shorthand for collecting all alive-states of all individual players.
-
elapsed_game_time: int- How much in-game seconds have elapsed before this game was ended (either due to victory of a player / team, the game time limit being reached or a crash). -
player_stats: dict[int, PlayerStats]- A dictionary that holds the individual player statistics. The keys are the indexes of the players. The values are instances of the PlayerStats class.
GameStats(settings) - Instantiate a new instance of this class.
Required Parameters
-
settings: GameSettings- An instance of the GameSettings class.
Returns
A new instance of the GameStats class, ready to be updated.
GameStats.update_player(index, score, alive) - Update the stats for an individual player.
Required Parameters
-
index: int- The index of the player to be updated. -
scores int- The new score of the player. -
alive: int- Whether the player is still alive in the game.
Returns
Nothing.