diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/qlearningAgents.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qlearningAgents.py b/src/qlearningAgents.py index fa23890..fda03eb 100644 --- a/src/qlearningAgents.py +++ b/src/qlearningAgents.py @@ -106,7 +106,10 @@ class QLearningAgent(ReinforcementAgent): legalActions = self.getLegalActions(state) action = None "*** YOUR CODE HERE ***" - util.raiseNotDefined() + if util.flipCoin(self.epsilon): + action = random.choice(legalActions) + else: + action = self.computeActionFromQValues(state) return action |