2026-rff_mp/pomelovsd/ExitMaze/Observer_Command/ConsoleView.py
2026-05-23 13:37:43 +03:00

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)