2023-03-12 16:22:51 +01:00
|
|
|
from Interface.grid_draw import GridDraw, Colors
|
2023-03-12 18:11:31 +01:00
|
|
|
import sys
|
|
|
|
import pygame
|
2023-03-16 21:55:05 +01:00
|
|
|
from Interface.movement import robot_movement
|
2023-03-11 19:31:43 +01:00
|
|
|
|
2023-03-16 20:33:22 +01:00
|
|
|
|
2023-03-16 21:38:42 +01:00
|
|
|
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???
|
2023-03-12 20:10:18 +01:00
|
|
|
grid = GridDraw(grid_width, grid_height)
|
2023-03-16 21:38:42 +01:00
|
|
|
tile_width = grid_width / board_size
|
|
|
|
tile_height = grid_height / board_size
|
2023-03-12 18:11:31 +01:00
|
|
|
x = tile_width / 2
|
|
|
|
y = tile_height / 2
|
2023-03-16 21:50:27 +01:00
|
|
|
radius = 20
|
2023-03-16 20:33:22 +01:00
|
|
|
|
|
|
|
# rendering loop
|
2023-03-12 16:22:51 +01:00
|
|
|
while True:
|
|
|
|
grid.start_draw()
|
2023-03-16 21:38:42 +01:00
|
|
|
grid.board(board_size, board_size)
|
2023-03-16 21:55:05 +01:00
|
|
|
(x, y) = robot_movement(grid_width, grid_height, tile_width, tile_height, x, y)
|
2023-03-16 21:50:27 +01:00
|
|
|
grid.circle(x, y, color=Colors.RED)
|
2023-03-16 20:33:22 +01:00
|
|
|
grid.end_draw()
|
|
|
|
pygame.time.delay(10)
|