-
Notifications
You must be signed in to change notification settings - Fork 162
/
Game.py
30 lines (25 loc) · 937 Bytes
/
Game.py
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
import pandas as pd
from Event import Event
from Team import Team
from Constant import Constant
class Game:
"""A class for keeping info about the games"""
def __init__(self, path_to_json, event_index):
# self.events = None
self.home_team = None
self.guest_team = None
self.event = None
self.path_to_json = path_to_json
self.event_index = event_index
def read_json(self):
data_frame = pd.read_json(self.path_to_json)
last_default_index = len(data_frame) - 1
self.event_index = min(self.event_index, last_default_index)
index = self.event_index
print(Constant.MESSAGE + str(last_default_index))
event = data_frame['events'][index]
self.event = Event(event)
self.home_team = Team(event['home']['teamid'])
self.guest_team = Team(event['visitor']['teamid'])
def start(self):
self.event.show()