Fixing game to working state

This commit is contained in:
Chris Proctor
2026-03-19 12:15:22 -04:00
parent 98f6f2716c
commit 9276ed9aa0
10 changed files with 131 additions and 140 deletions

18
fruit_catcher/manager.py Normal file
View File

@@ -0,0 +1,18 @@
from .fruit import Fruit, SHAPE_DEFINITIONS
from random import choice, randint
from retro.errors import AgentNotFoundByName
class FruitManager:
display = False
def play_turn(self, game):
try:
game.get_agent_by_name("fruit")
except AgentNotFoundByName:
self.create_piece(game)
def create_piece(self, game):
x = randint(0, 25)
fruit = Fruit((x, 1), game, choice(SHAPE_DEFINITIONS))
game.add_agent(fruit)