-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.py
48 lines (36 loc) · 973 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import Mansion
import Robot
class Game:
"""
Main class for the mansion cleaning game.
"""
instance = None
mansion = None
robot = None
# Game
def __init__(self):
if not self.instance:
self.instance = self
def get_game(self):
if not self.instance:
self.__init__()
return self.instance
# Mansion
def get_current_mansion(self):
if not self.mansion:
self.create_new_mansion()
return self.mansion
def create_new_mansion(self):
self.mansion = Mansion.Mansion()
# Robot
def create_new_robot(self, mansion):
self.robot = Robot.Robot(mansion)
return self.robot
def get_robot(self):
if not self.robot:
if not self.mansion:
self.create_new_mansion()
self.create_new_robot(self.mansion)
return self.robot
def start_robot(self):
self.robot.live()