qlearningAgents.py
def computeActionFromQValues(self, state):
        """
          Compute the best action to take in a state.  Note that if there
          are no legal actions, which is the case at the terminal state,
          you should return None.
        """

        actionVals = self.getLegalActions(state)

        if len(actionVals) == 0:
            return None


        tempVals = util.Counter() # store q-values in here


        for action in actionVals:
            tempVals[action] = self.getQValue(state, action)
        return tempVals.argMax()

          Compute the best action to take in a state.  Note that if there
          are no legal actions, which is the case at the terminal state,
          you should return None.
        
Compute the best action to take in a state.  Note that if there
are no legal actions, which is the case at the terminal state,
you should return None.
Compute the best action to take in a state . Note that if there are no legal actions which is the case at the terminal state you should return None .
def computeActionFromQValues(self, state):
        actionVals = self.getLegalActions(state)
        if len(actionVals) == 0:
            return None
        tempVals = util.Counter() 
        for action in actionVals:
            tempVals[action] = self.getQValue(state, action)
        return tempVals.argMax()
def computeActionFromQValues ( self , state ) : actionVals = self . getLegalActions ( state ) if len ( actionVals ) == 0 : return None tempVals = util . Counter ( ) for action in actionVals : tempVals [ action ] = self . getQValue ( state , action ) return tempVals . argMax ( )
Compute the best action to take in a state.
Compute the best action to take in a state .
"""
          Compute the best action to take in a state.  Note that if there
          are no legal actions, which is the case at the terminal state,
          you should return None.
        """ # store q-values in here
self
state