Skip to content
Snippets Groups Projects
Commit f72bf22c authored by Daniel Rafeh's avatar Daniel Rafeh
Browse files

Implementing a Plateau class that sets a specific size, add obstacles, get...

Implementing a Plateau class that sets a specific size, add obstacles, get rover position and an ods in order to recognize obstacles and bounds of the plateau
parent a7596680
No related branches found
No related tags found
Loading
Checking pipeline status
class Plateau:
def __init__(self, size_x:int, size_y:int):
# Gesamtgröße des Plateaus
self.size_x = size_x
self.size_y = size_y
# Initialisiere das Plateau mit der angegebenen Größe
self.grid = [[None for _ in range(size_x)] for _ in range(size_y)]
# Einfügen von Hindernissen
self.obstacles = []
# Initialisierung der Rover-Position
self.rover_position = None
# Funktion zur Erkennung wo sich der Rover befindet
def move(self, x: int, y: int) -> None:
self.rover_position = (x, y)
# Funktion zur Erkennung von Hindernissen und Kanten des Plateaus
def obstacle_detection_system(self, x: int, y: int) -> bool:
if x < 0 or x >= self.size_x or y < 0 or y >= self.size_y:
return False
if (x, y) in self.obstacles:
return False
return True
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment