Machine_learning_2023/Interface/vacuum_render.py
2023-03-12 19:33:57 +01:00

39 lines
1010 B
Python

from Interface.grid_draw import GridDraw, Colors
import sys
import pygame
GRID_SIZE_X = 10
GRID_SIZE_Y = 10
# dummy function
def initial_draw():
grid = GridDraw(500, 500, GRID_SIZE_X, GRID_SIZE_Y)
x = 2
y = 2
while True:
grid.start_draw()
grid.board()
grid.draw_wall(0, 0)
grid.draw_vacuum(x, y)
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
if event.type == pygame.KEYDOWN:
match event.key:
case pygame.K_LEFT:
x = (x - 1 + GRID_SIZE_X) % GRID_SIZE_X
case pygame.K_RIGHT:
x = (x + 1 + GRID_SIZE_X) % GRID_SIZE_X
case pygame.K_UP:
y = (y - 1 + GRID_SIZE_Y) % GRID_SIZE_Y
case pygame.K_DOWN:
y = (y + 1 + GRID_SIZE_Y) % GRID_SIZE_Y
grid.end_draw(delay=10)