示例#1
0
    def check_borders(cls, point: Cell) -> Cell:
        new_point = point.copy()
        if point.x > Map.get_width() - 1:
            new_point.x = 0
        elif point.x < 0:
            new_point.x = Map.get_width() - 1

        if point.y > Map.get_height() - 1:
            new_point.y = 0
        elif point.y < 0:
            new_point.y = Map.get_height() - 1

        return new_point