This commit is contained in:
Franciszka Jedraszak 2024-05-12 21:08:03 +02:00
parent d1501c1ddc
commit 041fdf41db
3 changed files with 2 additions and 2 deletions

View File

@ -103,7 +103,7 @@ def take_food(self):
house_x = 3
house_y = 1
if self.x == house_x and self.y == house_y:
if self._dryfood == 0 and self._wetfood == 0:
if self._dryfood == 0 or self._wetfood == 0:
self._dryfood = 50
self._wetfood = 50
print("Agent took food and current food level is", self._dryfood, self._wetfood)

View File

@ -114,7 +114,7 @@ def main():
agent.move(action, const.GRID_WIDTH, const.GRID_HEIGHT, obstacles, Animals, goal,const)
pygame.time.wait(200)
else:
if agent._dryfood != 0 or agent._wetfood != 0 :
if agent._dryfood != 0 and agent._wetfood != 0 :
animal = random.choice(Animals)
goal = (animal.x, animal.y)
draw_goal(const, goal)

BIN
tree.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 662 KiB

After

Width:  |  Height:  |  Size: 745 KiB