Skip to content
Snippets Groups Projects
Commit d70ed1d3 authored by Tessaris Sergio's avatar Tessaris Sergio
Browse files

Enable multiple gold objects

parent ce12d020
No related branches found
No related tags found
No related merge requests found
......@@ -70,7 +70,7 @@ WUMPUS_WORLD = '''
"pits": [[4, 0], [3, 1], [2, 2], [6, 2], [4, 4], [3, 5], [4, 6], [5, 6]],
"wumpuses": [[1, 2]],
"exits": [[0, 0]],
"golds": [[6, 3]],
"golds": [[6, 3], [3, 3]],
"blocks": []
}
'''
......
......@@ -91,7 +91,7 @@ class Hunter(Agent):
self._arrow: bool = True
self._done: bool = False
self._bump: bool = False
self._has_gold: bool = False
self._has_gold: int = 0
@property
def world(self) -> 'WumpusWorld':
......@@ -214,14 +214,13 @@ class Hunter(Agent):
reward -= 1
gold = self.world.isGold(self.location)
if gold:
self._has_gold = True
self._has_gold += 1
self.world.removeObject(gold)
elif action == self.Actions.CLIMB:
reward -= 1
if self.world.isExit(self.location):
self._done = True
if self._has_gold:
reward += 1000
reward += 1000 * self._has_gold
else:
raise ValueError('Unrecognised action {}'.format(action))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment