Add mark_adjacent function

This commit is contained in:
Garmelon 2016-02-12 21:26:39 +01:00
parent e012faa8c6
commit 59ec1cbb64

17
maze.py
View file

@ -42,7 +42,8 @@ class Maze:
""" """
-> str -> str
Convert the maze to string representation Convert the maze to string representation.
This function shows boundary walls around the maze.
""" """
s = "".join([self.SYMBOLS["x"] for i in range(self.x + 2)]) + "\n" s = "".join([self.SYMBOLS["x"] for i in range(self.x + 2)]) + "\n"
for row in self.maze: for row in self.maze:
@ -74,6 +75,14 @@ class Maze:
""" """
self.maze[y][x] = val self.maze[y][x] = val
def mark_adjacent(self, x, y):
"""
-> None
Marks all cells adjacent to x, y as "?" and add them to the queue.
"""
pass
def replace(self, val1, val2): def replace(self, val1, val2):
""" """
-> None -> None
@ -131,11 +140,15 @@ class Maze:
self.count = 0 # gif image file names self.count = 0 # gif image file names
self.maze = [[" " for y in range(self.x)] for x in range(self.y)] self.maze = [[" " for y in range(self.x)] for x in range(self.y)]
def fill(self): def fill(self, points=None):
""" """
-> None -> None
Add the start and the end point and a few random seeds to the maze. Add the start and the end point and a few random seeds to the maze.
To manually add seed points (for example starting or end points)
in addition to the randomly generated seed points, specify their
coordinates as tuples in the points list:
fill([(x1, y1), (x2, y2)])
""" """
pass pass