Algorytm_genetyczny #3

Merged
s481832 merged 18 commits from Algorytm_genetyczny into master 2024-06-10 13:30:20 +02:00
6 changed files with 12 additions and 5 deletions
Showing only changes of commit 71e9bea0ba - Show all commits

View File

@ -3,5 +3,5 @@
<component name="Black">
<option name="sdkName" value="Python 3.9" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (PROJEKT)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (pythonProject)" project-jdk-type="Python SDK" />
</project>

View File

@ -4,7 +4,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.12 (PROJEKT)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.10 (pythonProject)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)