31 lines
671 B
Python
31 lines
671 B
Python
from .Observer import Observer
|
|
|
|
class ConsoleView(Observer):
|
|
|
|
def update(self, event):
|
|
print("[событие]", event)
|
|
|
|
def render(self, maze, path = None):
|
|
path = set(path or [])
|
|
|
|
for row in maze.grid:
|
|
line = ""
|
|
|
|
for cell in row:
|
|
|
|
if cell in path:
|
|
line += "*"
|
|
|
|
elif cell.is_wall:
|
|
line += "#"
|
|
|
|
elif cell.is_start:
|
|
line += "S"
|
|
|
|
elif cell.is_exit:
|
|
line += "E"
|
|
|
|
else:
|
|
line += " "
|
|
|
|
print(line) |