movement_planning #2
@ -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
28
succ.py
Normal 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
|
Loading…
Reference in New Issue
Block a user