ruch_traktora_po_bfs #14
2
App.py
2
App.py
@ -41,7 +41,7 @@ def init_demo(): #Demo purpose
|
||||
bfsRoot.reverse()
|
||||
print(bfsRoot)
|
||||
# ui.render_text(string_to_print="traktor porusza się ścieżką bfs")
|
||||
traktor.move_by_root(bfsRoot, pole, traktor.irrigateSlot)
|
||||
traktor.move_by_root(bfsRoot, pole, [traktor.irrigateSlot])
|
||||
start_flag=False
|
||||
# demo_move()
|
||||
old_info=get_info(old_info)
|
||||
|
@ -207,15 +207,18 @@ class Tractor:
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
quit()
|
||||
def move_by_root(self, root, pole, action):
|
||||
def move_by_root(self, root, pole, actions = None):
|
||||
for move in root:
|
||||
self.slot.redraw_image()
|
||||
if move == 'forward':
|
||||
self.move_forward(pole)
|
||||
if move == 'right':
|
||||
self.turn_right()
|
||||
if move == 'left':
|
||||
self.turn_left()
|
||||
action()
|
||||
for a in actions:
|
||||
a()
|
||||
|
||||
self.clock.tick(3)
|
||||
|
||||
#to tak zrobiłam już na później, może się przyda
|
||||
|
Loading…
Reference in New Issue
Block a user