mirror of
https://github.com/maoakeEnterprise/amazing.git
synced 2026-04-29 00:14:34 +02:00
ascii print + fix maze generator kruskal
This commit is contained in:
@@ -19,13 +19,23 @@ class MazeGenerator:
|
||||
case 1:
|
||||
maze[math.trunc((x / width))][x % width].set_est(True)
|
||||
maze[math.trunc((y / width))][y % width].set_west(True)
|
||||
case 5:
|
||||
case width:
|
||||
maze[math.trunc((x / width))][x % width].set_south(
|
||||
True
|
||||
)
|
||||
maze[math.trunc((y / width))][y % width].set_north(
|
||||
True
|
||||
)
|
||||
for x in range(height):
|
||||
for y in range(width):
|
||||
if x == 0:
|
||||
maze[x][y].set_north(True)
|
||||
if x == height - 1:
|
||||
maze[x][y].set_south(True)
|
||||
if y == 0:
|
||||
maze[x][y].set_est(True)
|
||||
if y == width - 1:
|
||||
maze[x][y].set_west(True)
|
||||
return maze
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -35,3 +35,26 @@ class Maze:
|
||||
|
||||
def solver(self) -> str:
|
||||
pass
|
||||
|
||||
def ascii_print(self) -> None:
|
||||
for line in self.maze:
|
||||
if line is self.maze[0]:
|
||||
for cell in line:
|
||||
print("_", end="")
|
||||
if cell.get_north():
|
||||
print("__", end="")
|
||||
else:
|
||||
print(" ", end="")
|
||||
print()
|
||||
for cell in line:
|
||||
if cell is line[0] and cell.get_west():
|
||||
print("|", end="")
|
||||
if cell.get_south() is True:
|
||||
print("__", end="")
|
||||
else:
|
||||
print(" ", end="")
|
||||
if cell.get_est() is True:
|
||||
print("|", end="")
|
||||
else:
|
||||
print("_", end="")
|
||||
print()
|
||||
|
||||
Reference in New Issue
Block a user