-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.py
56 lines (34 loc) · 1.01 KB
/
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
49
50
51
52
53
54
55
56
from layout import Layout
from graphicsDisplay import PacmanGraphics
class GameStateData:
def __init__(self):
pass
def initialize(self, layout):
self.layout = layout
class GameState:
def __init__(self):
self.data = GameStateData()
def initialize(self, layout):
self.data.initialize(layout)
class Game:
def __init__(self, display):
self.state = GameState()
self.display = display
def run(self):
self.display.initialize(self.state.data)
self.display.mainloop()
class GameRules:
def __init__(self):
pass
def newGame(self, layout, display):
initState = GameState()
initState.initialize(layout)
game = Game(display)
game.state = initState
return game
layout = Layout('layout/dasha.lay') #Layout('layout/big.lay')
#layout = Layout('layout/small.lay') #Layout('layout/big.lay')
display = PacmanGraphics()
rules = GameRules()
game = rules.newGame(layout, display)
game.run()