Implement fill function

This commit is contained in:
Garmelon 2016-02-12 21:32:21 +01:00
parent 59ec1cbb64
commit f407a8e2a8

15
maze.py
View file

@ -150,7 +150,20 @@ class Maze:
coordinates as tuples in the points list: coordinates as tuples in the points list:
fill([(x1, y1), (x2, y2)]) fill([(x1, y1), (x2, y2)])
""" """
pass if points is None:
points = []
for i in range((self.x//10)*(self.y//10)): # add random points
points.append((random.randrange(self.x), random.randrange(self.y)))
for i in range(len(points)): # add points to map
x, y = points[i]
self.set_cell(x, y, i)
for xn, yn in self.get_neighbours(x, y):
cell = self.get_cell(xn, yn)
if type(cell) is int and not cell == i:
self.replace(cell, i)
for x, y in points:
self.mark_adjacent(x, y)
self.points = points
def generate(self, x_start, y_start, x_end, y_end, gif_path=None): def generate(self, x_start, y_start, x_end, y_end, gif_path=None):
""" """