Projekt_AI-Automatyczny_saper/Engine/Board.py

17 lines
566 B
Python
Raw Normal View History

2021-03-13 21:16:35 +01:00
import pygame
2021-03-15 19:58:20 +01:00
from Constants import ROWS, COLS, SQUARE_SIZE, GREEN, BLACK, WIDTH
2021-03-13 21:16:35 +01:00
class Board:
def __init__(self):
self.board = []
2021-03-15 19:58:20 +01:00
def drawSquares(self, win):
2021-03-13 21:16:35 +01:00
win.fill(GREEN)
for row in range(ROWS):
for col in range(COLS):
2021-03-15 19:04:51 +01:00
pygame.draw.rect(win, BLACK, pygame.Rect(row * SQUARE_SIZE, col * SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE), 2)
2021-03-15 19:58:20 +01:00
def drawAgent(self, win, agent):
dis = WIDTH // ROWS
pygame.draw.rect(win, self.color, (agent.row * dis + 1, agent.column * dis + 1, dis - 2, dis - 2))