poprawki
This commit is contained in:
parent
d1501c1ddc
commit
041fdf41db
2
agent.py
2
agent.py
@ -103,7 +103,7 @@ def take_food(self):
|
|||||||
house_x = 3
|
house_x = 3
|
||||||
house_y = 1
|
house_y = 1
|
||||||
if self.x == house_x and self.y == house_y:
|
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._dryfood = 50
|
||||||
self._wetfood = 50
|
self._wetfood = 50
|
||||||
print("Agent took food and current food level is", self._dryfood, self._wetfood)
|
print("Agent took food and current food level is", self._dryfood, self._wetfood)
|
||||||
|
2
main.py
2
main.py
@ -114,7 +114,7 @@ def main():
|
|||||||
agent.move(action, const.GRID_WIDTH, const.GRID_HEIGHT, obstacles, Animals, goal,const)
|
agent.move(action, const.GRID_WIDTH, const.GRID_HEIGHT, obstacles, Animals, goal,const)
|
||||||
pygame.time.wait(200)
|
pygame.time.wait(200)
|
||||||
else:
|
else:
|
||||||
if agent._dryfood != 0 or agent._wetfood != 0 :
|
if agent._dryfood != 0 and agent._wetfood != 0 :
|
||||||
animal = random.choice(Animals)
|
animal = random.choice(Animals)
|
||||||
goal = (animal.x, animal.y)
|
goal = (animal.x, animal.y)
|
||||||
draw_goal(const, goal)
|
draw_goal(const, goal)
|
||||||
|
Loading…
Reference in New Issue
Block a user