2021-03-13 21:16:35 +01:00
|
|
|
import pygame
|
2021-03-15 19:04:51 +01:00
|
|
|
from Constants import SQUARE_SIZE, GREEN, RIGHT, LEFT, UP, DOWN
|
2021-03-13 21:16:35 +01:00
|
|
|
import Board
|
2021-03-15 19:04:51 +01:00
|
|
|
import Agent
|
2021-03-13 21:16:35 +01:00
|
|
|
|
|
|
|
class Game:
|
|
|
|
def __init__(self, win):
|
|
|
|
self._init()
|
|
|
|
self.win = win
|
|
|
|
|
|
|
|
def _init(self):
|
|
|
|
self.selected = None
|
2021-03-15 19:04:51 +01:00
|
|
|
self.board = Board
|
|
|
|
self.agent = Agent(0, 0)
|
2021-03-13 21:16:35 +01:00
|
|
|
self.turn = GREEN
|
|
|
|
self.valid_moves = {}
|
|
|
|
|
|
|
|
def update(self):
|
|
|
|
self.board.draw(self.win)
|
|
|
|
self.draw_valid_moves(self.valid_moves)
|
|
|
|
pygame.display.update()
|
|
|
|
|
2021-03-15 19:04:51 +01:00
|
|
|
def move(self, destination):
|
|
|
|
if destination == UP && self.agent.ifNotOnEdge(UP):
|
|
|
|
self.agent.row -= 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|