mirror of
https://github.com/maoakeEnterprise/amazing.git
synced 2026-04-28 16:04:35 +02:00
fix 42 logo adapt with size
This commit is contained in:
+3
-2
@@ -7,9 +7,10 @@ import src.amaz_lib as g
|
||||
def main(maze_gen: MazeGenerator) -> None:
|
||||
# try:
|
||||
maze = Maze(maze=None)
|
||||
for alg in maze_gen.generator(10, 10):
|
||||
for alg in maze_gen.generator(21, 21):
|
||||
maze.set_maze(alg)
|
||||
os.system("clear")
|
||||
maze.ascii_print()
|
||||
maze.ascii_print()
|
||||
# solver = AStar((1, 1), (14, 18))
|
||||
# print(solver.solve(maze))
|
||||
@@ -20,4 +21,4 @@ def main(maze_gen: MazeGenerator) -> None:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(g.DepthFirstSearch())
|
||||
main(g.Kruskal())
|
||||
|
||||
@@ -108,8 +108,8 @@ class Kruskal(MazeGenerator):
|
||||
) -> bool:
|
||||
if cells_ft is None:
|
||||
return False
|
||||
s1 = (wall[0] / width, wall[0] % width)
|
||||
s2 = (wall[1] / width, wall[1] % width)
|
||||
s1 = (math.trunc(wall[0] / width), wall[0] % width)
|
||||
s2 = (math.trunc(wall[1] / width), wall[1] % width)
|
||||
return s1 in cells_ft or s2 in cells_ft
|
||||
|
||||
def generator(
|
||||
@@ -133,7 +133,9 @@ class Kruskal(MazeGenerator):
|
||||
np.random.shuffle(walls)
|
||||
|
||||
yield self.walls_to_maze(walls, height, width)
|
||||
while len(sets.sets) != 1 and (len(sets.sets) != 19 and cells_ft not None):
|
||||
while (len(sets.sets) != 1 and cells_ft is None) or (
|
||||
len(sets.sets) != 19 and cells_ft is not None
|
||||
):
|
||||
for wall in walls:
|
||||
if not self.is_in_same_set(sets, wall) and not self.touch_ft(
|
||||
width, wall, cells_ft
|
||||
@@ -141,7 +143,9 @@ class Kruskal(MazeGenerator):
|
||||
self.merge_sets(sets, wall)
|
||||
walls.remove(wall)
|
||||
yield self.walls_to_maze(walls, height, width)
|
||||
if len(sets.sets) == 19:
|
||||
if (len(sets.sets) == 1 and cells_ft is None) or (
|
||||
len(sets.sets) == 19 and cells_ft is not None
|
||||
):
|
||||
break
|
||||
print(f"nb sets: {len(sets.sets)}")
|
||||
return self.walls_to_maze(walls, height, width)
|
||||
|
||||
Reference in New Issue
Block a user