1
0
forked from s444417/ProjektAI

working version that was presented

This commit is contained in:
= 2020-06-15 17:43:52 +02:00
parent a7d3f0b356
commit 21021ea59a
2 changed files with 26 additions and 18 deletions

View File

@ -106,4 +106,4 @@ while running:
if not kitchenManager.is_running(): if not kitchenManager.is_running():
gridBoard.reinitialize() gridBoard.reinitialize()
gridBoard.draw(drawableManager) gridBoard.draw(drawableManager)
gridBoard.udpdate() gridBoard.udpdate()

View File

@ -84,23 +84,19 @@ class Table(Drawable):
# self.__tableLock.release() # self.__tableLock.release()
# return order # return order
# def get_order(self):
# return self.__order
def get_order(self): def get_order(self):
order = None return self.__order
if self.__tableLock.acquire(False):
try: # def getOrder(self):
if self.isStatus(Status.Ready) and self.hasOrder(): # order = None
# Generates order # if self.__tableLock.acquire(False):
order = [] # try:
for a in range(0, len(self.__guests)): # if self.isStatus(Status.Ready) and self.hasOrder():
order.append(Tree_Builder.zgadnij(self.__zainteresowania[a], self.Decision_Tree)) # order = self.__order
print("Zamowienie: " + str(order)) # self.setOrder([])
self.setOrder([]) # finally:
finally: # self.__tableLock.release()
self.__tableLock.release() # return order
return order
def setOrder(self, order): def setOrder(self, order):
self.__order = order self.__order = order
@ -115,7 +111,7 @@ class Table(Drawable):
self.__status = status self.__status = status
def __getImage(self, imageKind): def __getImage(self, imageKind):
if imageKind in [Images.Guest1, Images.Guest2, Images.Guest3, Images.Plate]: if imageKind in [Images.Guest1, Images.Guest2, Images.Guest3, Images.Plate, Images.Chicken]:
size = int(self.getCellSize() / 3) size = int(self.getCellSize() / 3)
else: else:
size = int(1.4 * self.getCellSize()) size = int(1.4 * self.getCellSize())
@ -168,3 +164,15 @@ class Table(Drawable):
screen.blit(imagePlate, (xBase + guest1XOffset, yBase + platesYOffset)) screen.blit(imagePlate, (xBase + guest1XOffset, yBase + platesYOffset))
screen.blit(imagePlate, (xBase + guest2XOffset, yBase + platesYOffset)) screen.blit(imagePlate, (xBase + guest2XOffset, yBase + platesYOffset))
screen.blit(imagePlate, (xBase + guest3XOffset, yBase + platesYOffset)) screen.blit(imagePlate, (xBase + guest3XOffset, yBase + platesYOffset))
elif self.isStatus(Status.Served):
platesYOffset = int(0.3 * self.getCellSize())
imageChicken = self.__getImage(Images.Chicken)
if len(self.__guests) == 1:
screen.blit(imageChicken, (xBase + guest2XOffset, yBase + platesYOffset))
elif len(self.__guests) == 2:
screen.blit(imageChicken, (xBase + guest4XOffset, yBase + platesYOffset))
screen.blit(imageChicken, (xBase + guest5XOffset, yBase + platesYOffset))
elif len(self.__guests) == 3:
screen.blit(imageChicken, (xBase + guest1XOffset, yBase + platesYOffset))
screen.blit(imageChicken, (xBase + guest2XOffset, yBase + platesYOffset))
screen.blit(imageChicken, (xBase + guest3XOffset, yBase + platesYOffset))