34 lines
1008 B
Python
34 lines
1008 B
Python
from Interface.grid_draw import GridDraw, Colors
|
|
import sys
|
|
import pygame
|
|
from Interface.movement import robot_movement
|
|
|
|
|
|
def initial_draw(grid_dimensions, board_size):
|
|
# window name
|
|
pygame.display.set_caption("AI Vacuum Cleaner")
|
|
|
|
# define array for grid
|
|
border_array = [["" for j in range(board_size)] for i in range(board_size)]
|
|
|
|
# set window dimension
|
|
grid_width = grid_dimensions
|
|
grid_height = grid_dimensions
|
|
|
|
# FIXME @countingthedots: please tell me what is going on there and why???
|
|
grid = GridDraw(grid_width, grid_height)
|
|
tile_width = grid_width / board_size
|
|
tile_height = grid_height / board_size
|
|
x = tile_width / 2
|
|
y = tile_height / 2
|
|
radius = 20
|
|
|
|
# rendering loop
|
|
while True:
|
|
grid.start_draw()
|
|
grid.board(board_size, board_size)
|
|
(x, y) = robot_movement(grid_width, grid_height, tile_width, tile_height, x, y)
|
|
grid.circle(x, y, color=Colors.RED)
|
|
grid.end_draw()
|
|
pygame.time.delay(10)
|