This commit is contained in:
kdang
2025-12-08 09:49:26 -05:00
parent 8ae74e0c7a
commit d61dc6ff89
6 changed files with 714 additions and 0 deletions

32
game.py Normal file
View File

@@ -0,0 +1,32 @@
from random import randint
from retro.game import Game
class Agent:
RIGHT = (1, 0)
UP = (0, -1)
LEFT = (-1, 0)
DOWN = (0, 1)
character = ">"
direction = RIGHT
position = (15, 0)
name = "agent"
color = "white_on_black"
display = True
def handle_keystroke(self, keystroke, game):
x, y = self.position
if keystroke.name == "M":
self.direction = self.RIGHT
self.character = '>'
elif keystroke.name == "I":
self.direction = self.LEFT
self.character = '<'
def can_move(self, position, game):
on_board = game.on_board(position)
empty = game.is_empty(position)
if __name__ == '__main__':
player = Agent()
game = Game([Agent], {'score': 0}, board_size:=(24, 20), framerate:=12)
game.play()