2026-rff_mp/volkovim/task2/core/cell.py
2026-05-24 21:48:59 +03:00

40 lines
822 B
Python

class Cell:
def __init__(
self,
x: int,
y: int,
isWall: bool = False,
isStart: bool = False,
isExit: bool = False
):
self.x = x
self.y = y
self.isWall = isWall
self.isStart = isStart
self.isExit = isExit
def isPassable(self) -> bool:
return self.isWall is False
def getPosition(self):
return self.x, self.y
def __str__(self):
if self.isStart:
return "S"
if self.isExit:
return "E"
if self.isWall:
return "#"
return " "
def __repr__(self):
return (
f"Cell(x={self.x}, y={self.y}, "
f"wall={self.isWall}, "
f"start={self.isStart}, "
f"exit={self.isExit})"
)