-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame_session.py
More file actions
95 lines (72 loc) · 2.91 KB
/
game_session.py
File metadata and controls
95 lines (72 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
class Game_Session():
"""
Represents a game session for the Type Racer Flask app.
This class manages the game session, including starting the race, checking for winners,
and ending the race.
:param id: The unique identifier for the game session.
:type id: int or str
:param players: The list of players participating in the game session.
:type players: list
:param scores: A dictionary mapping player IDs to their scores in the game session.
:type scores: dict
"""
def __init__(self, id, players = None, scores = None):
"""
Initialize a new game session.
:param id: The unique identifier for the game session.
:type id: int or str
:param players: Optional. The list of players participating in the game session.
:type players: list, optional
:param scores: Optional. A dictionary mapping player IDs to their scores in the game session.
:type scores: dict, optional
"""
pass
def start_race(self):
"""
Start the race for the game session.
This method initializes the race and sets up the necessary components for the race to begin.
:return: None
"""
pass
def check_win(self):
"""
Check for winners in the game session.
This method examines the scores of all players and determines if any player has won the race.
:return: A list of winning player IDs. Returns an empty list if there are no winners yet.
:rtype: list
"""
pass
def end_race(self):
"""
End the race for the game session.
This method concludes the race and performs any necessary cleanup or post-race actions.
:return: None
"""
pass
def add_player(self, player):
"""
Add a player to the game session.
This method adds a new player to the game session.
:param player: The object of player
:type player: player
:return: None
"""
pass
def rm_player(self, player):
"""
Remove a player from the game session.
This method removes a player from the game session.
:param player: The object of player
:type player: player
:return: None
"""
pass
def analyze_errors(self,freq_mistyped_chars:list[str])->str:
"""
Generates a report for the user based on the letters they frequently mistyped, the hardest letters to type adjacent in sequence to those letters and to each other
:param freq_mistyped_chars : list of the three letters the user most frequently mistyped in the game
"""
return f"Your most frequently mistyped letters are {freq_mistyped_chars[0]}, {freq_mistyped_chars[1]}, and {freq_mistyped_chars[2]}."
if __name__=="__main__":
gs = Game_Session(0)
print(gs.analyze_errors(["a","b","c"]))