From 71e9bea0ba19b8e1999ccbc002c7078bf92fec1a Mon Sep 17 00:00:00 2001 From: LuminoX Date: Mon, 27 May 2024 14:17:51 +0200 Subject: [PATCH] snacks for correctly guessed animals --- .idea/misc.xml | 2 +- .idea/sztuczna.iml | 2 +- Animals/animal.py | 7 +++++++ agent.py | 3 ++- constants.py | 2 +- main.py | 1 - 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index fa62db7..dfd527a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/.idea/sztuczna.iml b/.idea/sztuczna.iml index f83ab99..c24009a 100644 --- a/.idea/sztuczna.iml +++ b/.idea/sztuczna.iml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/Animals/animal.py b/Animals/animal.py index 6df7cee..d889ba9 100644 --- a/Animals/animal.py +++ b/Animals/animal.py @@ -74,6 +74,13 @@ class Animal: illness_image = pygame.transform.scale(illness_image, (int(grid_size * scale), int(grid_size * scale))) screen.blit(illness_image, (x_blit, y * grid_size)) + def draw_snack(self, screen, grid_size, x, y): + exclamation_image = pygame.image.load(self.food_image) + exclamation_image = pygame.transform.scale(exclamation_image, (int(grid_size * 0.45), int(grid_size * 0.45))) + screen.blit(exclamation_image, (x * grid_size, y * grid_size)) + pygame.display.update() + pygame.time.wait(700) + @abstractmethod def getting_hungry(self): pass \ No newline at end of file diff --git a/agent.py b/agent.py index 4aec681..176c697 100644 --- a/agent.py +++ b/agent.py @@ -91,7 +91,8 @@ def feed_animal(self, animals, goal,const): guests = random.randint(1, 15) guess = neuron.classify(animal.image_path) if guess == animal.name: - print(f"I'm sure this is {guess}") + print(f"I'm sure this is {guess} and i give it {animal.food} as a snack") + animal.draw_snack(const.screen, const.GRID_SIZE, animal.x, animal.y) else: print(f"I was wrong, this is not a {guess} but a {animal.name}") decision = feed_decision(animal.adult, activity_time, animal.ill, const.season, guests, animal._feed, self._dryfood, self._wetfood) diff --git a/constants.py b/constants.py index fe715ee..e652659 100644 --- a/constants.py +++ b/constants.py @@ -6,7 +6,7 @@ class Constants: def __init__(self): self.BLACK = (0, 0, 0) self.RED = (255, 0, 0) - self.GRID_SIZE = 70 + self.GRID_SIZE = 75 self.GRID_WIDTH = 30 self.GRID_HEIGHT = 15 self.WINDOW_SIZE = (self.GRID_WIDTH * self.GRID_SIZE, self.GRID_HEIGHT * self.GRID_SIZE) diff --git a/main.py b/main.py index 58c6d2d..2e6692e 100644 --- a/main.py +++ b/main.py @@ -93,7 +93,6 @@ def main(): change_time(const) draw_background(const) - draw_grid(const) draw_enclosures(Enclosures, const) draw_gates(Enclosures, const) draw_house(const)