Add good checking plates
This commit is contained in:
parent
575a2def45
commit
5be76f9a4b
61
main.py
61
main.py
@ -43,7 +43,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# Maksymilian
|
# Maksymilian
|
||||||
go = 0
|
go = 0
|
||||||
randGo = 0
|
randomPlate = None
|
||||||
plate = 0
|
plate = 0
|
||||||
waitPos = [[1, 2], [1, 5], [1, 8], [5, 4], [5, 8],
|
waitPos = [[1, 2], [1, 5], [1, 8], [5, 4], [5, 8],
|
||||||
[8, 2], [8, 5], [8, 8], [12, 3], [12, 7]]
|
[8, 2], [8, 5], [8, 8], [12, 3], [12, 7]]
|
||||||
@ -62,9 +62,10 @@ if __name__ == "__main__":
|
|||||||
if randrange(30) == 17:
|
if randrange(30) == 17:
|
||||||
plate = random.choice(plateArr)
|
plate = random.choice(plateArr)
|
||||||
if not plate.empty:
|
if not plate.empty:
|
||||||
randomPlate = randrange(5) + 10
|
randomPlate = randrange(4) + 11
|
||||||
plate.changePlate('plate-empty.png', 'test-{}'.format(randomPlate))
|
plate.changePlate('plate-empty.png', 'test-{}'.format(randomPlate))
|
||||||
|
|
||||||
|
|
||||||
def addGuest():
|
def addGuest():
|
||||||
if randrange(10) == 5 and path == '':
|
if randrange(10) == 5 and path == '':
|
||||||
newGuests.append(Guest(graphics))
|
newGuests.append(Guest(graphics))
|
||||||
@ -76,7 +77,6 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
tree.TasksList('order', goal, [waiter.X, waiter.Y])
|
tree.TasksList('order', goal, [waiter.X, waiter.Y])
|
||||||
|
|
||||||
|
|
||||||
tree.print()
|
tree.print()
|
||||||
print(actions)
|
print(actions)
|
||||||
return tree.ReturnQueueList()
|
return tree.ReturnQueueList()
|
||||||
@ -156,30 +156,49 @@ if __name__ == "__main__":
|
|||||||
tree.TasksList('goToBar', goalList, [waiter.X, waiter.Y])
|
tree.TasksList('goToBar', goalList, [waiter.X, waiter.Y])
|
||||||
queue = tree.ReturnQueueList()
|
queue = tree.ReturnQueueList()
|
||||||
|
|
||||||
if plate == 1 and (goalList == [waiter.X-1, waiter.Y] or goalList == [waiter.X+1, waiter.Y]):
|
if plateArr and event.key == pygame.K_m:
|
||||||
if (not [waiter.X, waiter.Y] in waitPos) or go == 0:
|
randomPlate = random.choice(plateArr)
|
||||||
|
if (not [waiter.X, waiter.Y] == randomPlate.table) or go == 0:
|
||||||
|
print(waiter.X, waiter.Y)
|
||||||
|
print(randomPlate.table)
|
||||||
|
print(go)
|
||||||
|
print([waiter.X, waiter.Y] in randomPlate.table)
|
||||||
if [waiter.X, waiter.Y] in waitPos:
|
if [waiter.X, waiter.Y] in waitPos:
|
||||||
model = 'waiter_' + waiter.direction
|
model = 'waiter_' + waiter.direction
|
||||||
for x in range(-1, 2):
|
for x in range(-1, 2):
|
||||||
waiterX = waiter.X + (x * 0.1)
|
waiterX = waiter.X + (x * 0.1)
|
||||||
graphics.clear(waiterX, waiter.Y - 1)
|
graphics.clear(waiterX, waiter.Y - 1)
|
||||||
rand = randrange(9)
|
print(randomPlate)
|
||||||
|
|
||||||
# if this plate is exists
|
# if this plate is exists
|
||||||
print(rand)
|
goal = (randomPlate.table[0], randomPlate.table[1])
|
||||||
if plateArr and len(plateArr) > rand and plateArr[rand] in plateArr:
|
|
||||||
randGo = rand
|
|
||||||
goal = (plateArr[randGo].table[0], plateArr[randGo].table[1])
|
|
||||||
path = waiter.findPath(goal)
|
path = waiter.findPath(goal)
|
||||||
path = waiter.translatePath(path)
|
path = waiter.translatePath(path)
|
||||||
print('sec-1')
|
print('sec-1')
|
||||||
|
|
||||||
go = 1
|
go = 1
|
||||||
plate = 0
|
plate = 0
|
||||||
|
|
||||||
# if this plate is not exists
|
|
||||||
else:
|
else:
|
||||||
|
if randomPlate.checked:
|
||||||
|
predict = 'CHECKED'
|
||||||
|
else:
|
||||||
|
predict = use_model_to_predict(randomPlate.pictureAI)
|
||||||
|
|
||||||
|
if predict == 1:
|
||||||
|
predict = 'EMPTY'
|
||||||
|
|
||||||
|
randomPlate.clearTable()
|
||||||
|
plateArr.remove(randomPlate)
|
||||||
|
|
||||||
|
else:
|
||||||
|
predict = 'FOOD'
|
||||||
|
print('sec-3')
|
||||||
|
text_speech('arialnarrow.ttf', 25, predict, (255, 255, 255), (0, 128, 0),
|
||||||
|
(waiter.X * 50 + 25), (waiter.Y * 50 - 25), False, False, screen=graphics.screen)
|
||||||
|
pygame.display.flip()
|
||||||
|
go = 0
|
||||||
|
plate = 0
|
||||||
|
|
||||||
|
if plate == 1 and (goalList == [waiter.X - 1, waiter.Y] or goalList == [waiter.X + 1, waiter.Y]):
|
||||||
randTable = goalList
|
randTable = goalList
|
||||||
randIndex = pltPos.index(goalList)
|
randIndex = pltPos.index(goalList)
|
||||||
tableCord = tabPos[randIndex]
|
tableCord = tabPos[randIndex]
|
||||||
@ -198,23 +217,7 @@ if __name__ == "__main__":
|
|||||||
print('sec-2')
|
print('sec-2')
|
||||||
go = 1
|
go = 1
|
||||||
plate = 0
|
plate = 0
|
||||||
else:
|
|
||||||
if plateArr[randGo].checked:
|
|
||||||
predict = 'CHECKED'
|
|
||||||
else:
|
|
||||||
predict = use_model_to_predict(plateArr[randGo].pictureAI)
|
|
||||||
|
|
||||||
if predict == 1:
|
|
||||||
predict = 'EMPTY'
|
|
||||||
plateArr[randGo].checkPlate()
|
|
||||||
else:
|
|
||||||
predict = 'FOOD'
|
|
||||||
print('sec-3')
|
|
||||||
text_speech('arialnarrow.ttf', 25, predict, (255, 255, 255), (0, 128, 0),
|
|
||||||
(waiter.X * 50 + 25), (waiter.Y * 50 - 25), False, False, screen=graphics.screen)
|
|
||||||
pygame.display.flip()
|
|
||||||
go = 0
|
|
||||||
plate = 0
|
|
||||||
|
|
||||||
# Dominik
|
# Dominik
|
||||||
if queue and path == '' and fromBar == 0:
|
if queue and path == '' and fromBar == 0:
|
||||||
|
@ -15,5 +15,5 @@ class Plate:
|
|||||||
self.pictureAI = newPictureAI
|
self.pictureAI = newPictureAI
|
||||||
self.empty = True
|
self.empty = True
|
||||||
|
|
||||||
def checkPlate(self):
|
def clearTable(self):
|
||||||
self.checked = True
|
self.graphics.clearPlate(self.plate[0], self.plate[1])
|
||||||
|
Loading…
Reference in New Issue
Block a user