45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
import pygame
|
|
import sys
|
|
|
|
pygame.init()
|
|
|
|
width, height = 1900, 1000
|
|
screen = pygame.display.set_mode((width, height))
|
|
pygame.display.set_caption('Labirints')
|
|
|
|
BLACK = (0, 0, 0)
|
|
BLUE = (0, 0, 255)
|
|
|
|
maze = [
|
|
"############################################################",
|
|
"#.....###########.....###########........#####.............#",
|
|
"#.###..#####.......##############.........##......###......#",
|
|
"#........####..............................##.#####.......##",
|
|
"######.####.##.############################...##############",
|
|
"#......#...........###..........#######................#...#",
|
|
"#.##########.........................................##.##.#",
|
|
"#.......########################################.....#.....#",
|
|
"####..........##..........###..................#########..##",
|
|
"#....###........................................###......###",
|
|
"############################################################"
|
|
]
|
|
|
|
def draw_maze(maze):
|
|
for y, row in enumerate(maze):
|
|
for x, char in enumerate(row):
|
|
if char == '#':
|
|
pygame.draw.rect(screen, BLUE, (x*32, y*32, 32, 32))
|
|
|
|
running = True
|
|
while running:
|
|
for event in pygame.event.get():
|
|
if event.type == pygame.QUIT:
|
|
running = False
|
|
|
|
screen.fill(BLACK)
|
|
draw_maze(maze)
|
|
pygame.display.flip()
|
|
|
|
pygame.quit()
|
|
sys.exit()
|