generated from mwc/project_game
Rename state values to lowercase
This commit is contained in:
@@ -55,8 +55,8 @@ class Fruit:
|
||||
game.remove_agent(piece)
|
||||
game.remove_agent(self)
|
||||
self.alive = False
|
||||
game.state['Lives'] -= 1
|
||||
if game.state['Lives'] <= 0:
|
||||
game.state['lives'] -= 1
|
||||
if game.state['lives'] <= 0:
|
||||
game.end()
|
||||
else:
|
||||
self.position = (new_x, new_y)
|
||||
@@ -81,7 +81,7 @@ class Fruit:
|
||||
catcher_positions = {p.position for p in catcher.pieces}
|
||||
for piece in self.pieces.values():
|
||||
if piece.position in catcher_positions:
|
||||
game.state['Score'] += 1
|
||||
game.state['score'] += 1
|
||||
for p in self.pieces.values():
|
||||
game.remove_agent(p)
|
||||
game.remove_agent(self)
|
||||
|
||||
@@ -12,6 +12,6 @@ def play():
|
||||
Catcher((11, 29)),
|
||||
FruitManager(),
|
||||
]
|
||||
state = {'Score': 0, 'Lives': 5}
|
||||
state = {'score': 0, 'lives': 5}
|
||||
game = Game(agents, state, board_size=(WIDTH, HEIGHT), framerate=24, color="white_on_indigo", dump_state="result.json")
|
||||
game.play()
|
||||
|
||||
Reference in New Issue
Block a user