Rename state values to lowercase

This commit is contained in:
Chris Proctor
2026-03-19 12:40:35 -04:00
parent c51ee0f4a8
commit 7ccccb75ee
2 changed files with 4 additions and 4 deletions

View File

@@ -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)

View File

@@ -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()