rendered paste bodyimport os,sys
import pygame
from grid import *
from pygame.locals import *
maze = [[1,0,0],[0,1,0],[0,0,1]]
n=len(maze)
pixels = 800/n
grid = Grid((pixels,pixels), (n,n), "Generated Maze")
blackBlock = pygame.Surface( (pixels, pixels) )
whiteBlock = pygame.Surface( (pixels, pixels) )
while True:
for event in pygame.event.get():
if event.type == QUIT or (event.type == KEYDOWN and event.key==K_ESCAPE):
pygame.quit()
sys.exit()
for row in xrange(grid.grid_size[1]):
for col in xrange(grid.grid_size[0]):
pos = col,row
if maze[pos]:
grid.screen.blit(blackSurface, (col*grid.block_size[0], row*grid.block_size[1]))
else:
grid.screen.blit(whiteSurface, (col*grid.block_size[0], row*grid.block_size[1]))