def main():
    x = int(argv[1])
    y = int(argv[2])
    maze = Maze()
    maze.generator = BacktrackingGenerator(x, y)
    maze.generate()

    aux = maze.tostring().split('\n')
    print(len(aux), len(aux[0]))
    for i, l in enumerate(aux):
        if i == 1:
            print('S' + l[1:])
        elif i == x * 2 - 1:
            print(l[:-1] + 'E')
        else:
            print(l)
Esempio n. 2
0
screen_height = 880
screen_width = int(screen_height * 1.0)

mx = 11
my = 11  # width and height of the maze
size = screen_height / mx

colors = [(0, 0, 0), (0, 200, 0), (255, 0, 0),
          (255, 255, 0)]  # RGB colors of the maze

m = Maze()
m.generator = Prims(5, 5)
m.generate()
m.generate_entrances(True, True)
print(m.tostring(True))
m.grid[m.start[0]][m.start[1]] = 2
m.grid[m.end[0]][m.end[1]] = 3

py.init()

screen = py.display
screen_surf = screen.set_mode((screen_width, screen_height))


class Player(object):
    def __init__(self, pos):
        self.rect = py.Rect(pos[1] * size, pos[0] * size, size - 1, size - 1)

    def move(self, dx, dy):