Files
project_game/game.py
2025-12-08 09:49:26 -05:00

32 lines
832 B
Python

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