Code readability

This commit is contained in:
Mateusz Dokowicz 2023-03-16 21:38:42 +01:00
parent d080b04763
commit 3696636245
2 changed files with 16 additions and 5 deletions

View File

@ -4,10 +4,21 @@ import pygame
from Interface.movement import moving_cleaner from Interface.movement import moving_cleaner
def initial_draw(grid_width, grid_height): 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) grid = GridDraw(grid_width, grid_height)
tile_width = grid_width / 10 tile_width = grid_width / board_size
tile_height = grid_height / 10 tile_height = grid_height / board_size
x = tile_width / 2 x = tile_width / 2
y = tile_height / 2 y = tile_height / 2
radius = 15 radius = 15
@ -15,7 +26,7 @@ def initial_draw(grid_width, grid_height):
# rendering loop # rendering loop
while True: while True:
grid.start_draw() grid.start_draw()
grid.board(10, 10) grid.board(board_size, board_size)
(x, y) = moving_cleaner(grid_width, grid_height, tile_width, tile_height, x, y) (x, y) = moving_cleaner(grid_width, grid_height, tile_width, tile_height, x, y)
grid.circle(x, y, 20, color=Colors.RED) grid.circle(x, y, 20, color=Colors.RED)
grid.end_draw() grid.end_draw()

View File

@ -1,3 +1,3 @@
from Interface.vacuum_render import initial_draw from Interface.vacuum_render import initial_draw
initial_draw(500, 500) initial_draw(500, 10)