diff --git a/main.py b/main.py index e402baa..5be9157 100644 --- a/main.py +++ b/main.py @@ -51,7 +51,17 @@ if __name__ == "__main__": [9, 3], [9, 6], [9, 9], [11, 3], [11, 8]] plateArr = [] + + def changePlate(): + if plateArr and len(plateArr) > 0: + if randrange(30) == 17: + plate = random.choice(plateArr) + if not plate.empty: + randomPlate = randrange(5)+10 + plate.changePlate('plate-empty.png', 'test-{}'.format(randomPlate)) + while True: + changePlate() for event in pygame.event.get(): # rabbit.check(waiter.matrix, waiter.X, waiter.Y) @@ -87,7 +97,7 @@ if __name__ == "__main__": rand = randrange(9) # if this plate is exists - print('check{}{}{}'.format(plateArr, len(plateArr), rand)) + print(rand) if plateArr and len(plateArr) >= rand and plateArr[rand] in plateArr: randGo = rand goal = (plateArr[randGo].table[0], plateArr[randGo].table[1]) @@ -118,12 +128,16 @@ if __name__ == "__main__": print('sec-2') go = 1 else: - predict = use_model_to_predict(plateArr[randGo].pictureAI) - - if predict == 1: - predict = 'EMPTY' + if plateArr[randGo].checked: + predict = 'CHECKED' else: - predict = 'FOOD' + 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) diff --git a/src/SubprojectMaksymilianKierski/Data/TestData/test-11.jpg b/src/SubprojectMaksymilianKierski/Data/TestData/test-11.jpg new file mode 100644 index 0000000..b6b8bf4 Binary files /dev/null and b/src/SubprojectMaksymilianKierski/Data/TestData/test-11.jpg differ diff --git a/src/SubprojectMaksymilianKierski/Data/TestData/test-12.jpg b/src/SubprojectMaksymilianKierski/Data/TestData/test-12.jpg new file mode 100644 index 0000000..1ad4fc1 Binary files /dev/null and b/src/SubprojectMaksymilianKierski/Data/TestData/test-12.jpg differ diff --git a/src/SubprojectMaksymilianKierski/Data/TestData/test-13.jpg b/src/SubprojectMaksymilianKierski/Data/TestData/test-13.jpg new file mode 100644 index 0000000..fba88bd Binary files /dev/null and b/src/SubprojectMaksymilianKierski/Data/TestData/test-13.jpg differ diff --git a/src/SubprojectMaksymilianKierski/Data/TestData/test-14.jpg b/src/SubprojectMaksymilianKierski/Data/TestData/test-14.jpg new file mode 100644 index 0000000..38ac217 Binary files /dev/null and b/src/SubprojectMaksymilianKierski/Data/TestData/test-14.jpg differ diff --git a/src/SubprojectMaksymilianKierski/Data/TestData/test-15.jpg b/src/SubprojectMaksymilianKierski/Data/TestData/test-15.jpg new file mode 100644 index 0000000..b6763a6 Binary files /dev/null and b/src/SubprojectMaksymilianKierski/Data/TestData/test-15.jpg differ diff --git a/src/SubprojectMaksymilianKierski/Data/TestData/test-2.jpg b/src/SubprojectMaksymilianKierski/Data/TestData/test-2.jpg index b6b8bf4..775e289 100644 Binary files a/src/SubprojectMaksymilianKierski/Data/TestData/test-2.jpg and b/src/SubprojectMaksymilianKierski/Data/TestData/test-2.jpg differ diff --git a/src/SubprojectMaksymilianKierski/Data/TestData/test-4.jpg b/src/SubprojectMaksymilianKierski/Data/TestData/test-4.jpg index b6763a6..c3f8aea 100644 Binary files a/src/SubprojectMaksymilianKierski/Data/TestData/test-4.jpg and b/src/SubprojectMaksymilianKierski/Data/TestData/test-4.jpg differ diff --git a/src/SubprojectMaksymilianKierski/Data/TestData/test-5.jpg b/src/SubprojectMaksymilianKierski/Data/TestData/test-5.jpg index 38ac217..eddd3c0 100644 Binary files a/src/SubprojectMaksymilianKierski/Data/TestData/test-5.jpg and b/src/SubprojectMaksymilianKierski/Data/TestData/test-5.jpg differ diff --git a/src/SubprojectMaksymilianKierski/Data/TestData/test-8.jpg b/src/SubprojectMaksymilianKierski/Data/TestData/test-8.jpg index 1ad4fc1..34088b3 100644 Binary files a/src/SubprojectMaksymilianKierski/Data/TestData/test-8.jpg and b/src/SubprojectMaksymilianKierski/Data/TestData/test-8.jpg differ diff --git a/src/SubprojectMaksymilianKierski/Data/TestData/test-9.jpg b/src/SubprojectMaksymilianKierski/Data/TestData/test-9.jpg index fba88bd..4b85639 100644 Binary files a/src/SubprojectMaksymilianKierski/Data/TestData/test-9.jpg and b/src/SubprojectMaksymilianKierski/Data/TestData/test-9.jpg differ diff --git a/src/__pycache__/graphics.cpython-37.pyc b/src/__pycache__/graphics.cpython-37.pyc index fd5f6b8..e29c972 100644 Binary files a/src/__pycache__/graphics.cpython-37.pyc and b/src/__pycache__/graphics.cpython-37.pyc differ diff --git a/src/graphics.py b/src/graphics.py index 599035d..b7be597 100644 --- a/src/graphics.py +++ b/src/graphics.py @@ -80,10 +80,12 @@ class Graphics: def drawFullPlate(self, x, y, picture): self.screen.blit(pygame.image.load(relative_path + picture), (x * self.block_size, y * self.block_size)) - def drawEmptyPlate(self, x, y): + def drawEmptyPlate(self, x, y, picture): + self.screen.blit(self.image['floor'], + (x * self.block_size, y * self.block_size)) self.screen.blit(self.image['table'], (x * self.block_size, y * self.block_size)) - self.screen.blit(self.image['plate-full'], + self.screen.blit(pygame.image.load(relative_path + picture), (x * self.block_size, y * self.block_size)) def clearPlate(self, x, y): self.screen.blit(self.image['table'], diff --git a/src/plate.py b/src/plate.py index 989fcf7..9d87f59 100644 --- a/src/plate.py +++ b/src/plate.py @@ -1,13 +1,19 @@ - class Plate: def __init__(self, graphics, plate, table, picture, pictureAI): self.plate = plate self.table = table self.picture = picture self.pictureAI = pictureAI + self.graphics = graphics + self.empty = False + self.checked = False graphics.drawFullPlate(self.plate[0], self.plate[1], picture) + def changePlate(self, newPicture, newPictureAI): + self.graphics.drawEmptyPlate(self.plate[0], self.plate[1], newPicture) + self.picture = newPicture + self.pictureAI = newPictureAI + self.empty = True - def changePlate(self): - print('keep') - + def checkPlate(self): + self.checked = True