moving
This commit is contained in:
parent
a18927bfb4
commit
74af28c7c2
29
main.py
29
main.py
@ -64,9 +64,31 @@ if __name__ == "__main__":
|
||||
randomPlate = randrange(5) + 10
|
||||
plate.changePlate('plate-empty.png', 'test-{}'.format(randomPlate))
|
||||
|
||||
def addGuest():
|
||||
if randrange(15) == 8:
|
||||
newGuests.append(Guest(graphics))
|
||||
|
||||
guest = newGuests[0]
|
||||
goal = [0, 0]
|
||||
|
||||
if guest.cord[0] == 2 or guest.cord[1] == 9:
|
||||
goal[0] = guest.cord[0] - 1
|
||||
goal[1] = guest.cord[1]
|
||||
else:
|
||||
goal[0] = guest.cord[0] + 1
|
||||
goal[1] = guest.cord[1]
|
||||
|
||||
tree.TasksList('order', goal, [waiter.X, waiter.Y])
|
||||
|
||||
tree.print()
|
||||
check = 1
|
||||
print(actions)
|
||||
return tree.ReturnQueueList()
|
||||
|
||||
|
||||
while True:
|
||||
changePlate()
|
||||
queue = addGuest()
|
||||
|
||||
for event in pygame.event.get():
|
||||
# rabbit.check(waiter.matrix, waiter.X, waiter.Y)
|
||||
@ -81,6 +103,8 @@ if __name__ == "__main__":
|
||||
sys.exit()
|
||||
break
|
||||
|
||||
if event.key == pygame.K_d:
|
||||
print(queue)
|
||||
if event.key == pygame.K_s:
|
||||
waitPosition = [waiter.X, waiter.Y]
|
||||
tree.TasksList('check', [2, 3], waitPosition)
|
||||
@ -185,7 +209,8 @@ if __name__ == "__main__":
|
||||
path = waiter.translatePath(path)
|
||||
|
||||
# Dominik
|
||||
if path == '' and fromBar == 0 and check == 1:
|
||||
if queue and path == '' and fromBar == 0:
|
||||
print('dsads{}'.format(queue))
|
||||
task = queue.pop(0)
|
||||
tree.RemoveTask()
|
||||
node = (task[2][0], task[2][1])
|
||||
@ -208,7 +233,7 @@ if __name__ == "__main__":
|
||||
path = path[1:]
|
||||
waiter.travel(nextStep, graphics)
|
||||
|
||||
if len(queue) != 0 and check == 0 and path == '' and fromBar == 0:
|
||||
if queue and len(queue) != 0 and check == 0 and path == '' and fromBar == 0:
|
||||
check = 1
|
||||
|
||||
# AStar
|
||||
|
Loading…
Reference in New Issue
Block a user