movement_planning #2

Merged
s473585 merged 13 commits from movement_planning into master 2023-05-24 14:28:17 +02:00
2 changed files with 32 additions and 2 deletions
Showing only changes of commit 1e88149789 - Show all commits

View File

@ -8,10 +8,12 @@ class Engine:
self.power = power #HP
class GarbageTruck:
def __init__(self, dump_location, fuel_capacity, start_pos):
def __init__(self, dump_location, fuel_capacity, xpos, ypos, orientation):
self.dump_location = dump_location
self.tank = GarbageTank(15, 18000)
self.engine = Engine(400)
self.fuel = fuel_capacity
self.pos = start_pos
self.xpos = xpos
self.ypos = ypos
self.orientation = orientation
self.houses = [] #lista domów do odwiedzenia

28
succ.py Normal file
View File

@ -0,0 +1,28 @@
def succ(xpos, ypos, orientation):
successors = []
if orientation == 'N':
successors.append(['LEFT', xpos, ypos, 'W'])
successors.append(['RIGHT', xpos, ypos, 'E'])
if ypos > 0:
successors.append(['FORWARD', xpos, ypos - 50, 'N'])
if orientation == 'S':
successors.append(['LEFT', xpos, ypos, 'E'])
successors.append(['RIGHT', xpos, ypos, 'W'])
if ypos < 750:
successors.append(['FORWARD', xpos, ypos + 50, 'S'])
if orientation == 'W':
successors.append(['LEFT', xpos, ypos, 'S'])
successors.append(['RIGHT', xpos, ypos, 'N'])
if xpos > 0:
successors.append(['FORWARD', xpos - 50, ypos, 'W'])
if orientation == 'E':
successors.append(['LEFT',xpos, ypos, 'N'])
successors.append(['RIGHT', xpos, ypos, 'S'])
if xpos < 750:
successors.append(['FORWARD', xpos + 50, ypos, 'E'])
return successors