示例#1
0
 def chooseAction(self, gameState):
     print("Agent " + str(self.index) + " choosing an action")
     minimaxMod = MinimaxModule(self)
     minimaxMod.setImpatience(float(self.heuristicWeights['attackModule_percentImpatience'])/100.0)
     minimaxVals = minimaxMod.getMinimaxValues(gameState, self.index, self.isRed, 0.1)
     bestActions = []
     bestVal = 0
     for pair in minimaxVals:
         if(bestVal < pair[1]):
             bestActions = []
         if(len(bestActions) == 0 or (bestVal == pair[1])):
             bestActions.append(pair[0])
             bestVal = pair[1]
     
     if(len(bestActions) == 0):
         return gameState.getLegalActions(self.index)[0]
     return random.choice(bestActions)
示例#2
0
  def chooseAction(self, gameState):
    self.updateInference(gameState)

    minimaxMod = MinimaxModule(self)
    minimaxMod.setImpatience(0.1)
    minimaxVals = minimaxMod.getMinimaxValues(gameState, self.index, self.isRed, 0.8)

    bestActions = []
    bestVal = 0
    for pair in minimaxVals:
      if(bestVal < pair[1]):
        bestActions = []
      if(len(bestActions) == 0 or (bestVal == pair[1])):
        bestActions.append(pair[0])
        bestVal = pair[1]

    if(len(bestActions) == 0):
      return gameState.getLegalActions(self.index)[0]
    return random.choice(bestActions)
示例#3
0
    def chooseAction(self, gameState):
        self.updateInference(gameState)

        minimaxMod = MinimaxModule(self)
        minimaxMod.setImpatience(0.1)
        minimaxVals = minimaxMod.getMinimaxValues(gameState, self.index,
                                                  self.isRed, 0.8)

        bestActions = []
        bestVal = 0
        for pair in minimaxVals:
            if (bestVal < pair[1]):
                bestActions = []
            if (len(bestActions) == 0 or (bestVal == pair[1])):
                bestActions.append(pair[0])
                bestVal = pair[1]

        if (len(bestActions) == 0):
            return gameState.getLegalActions(self.index)[0]
        return random.choice(bestActions)
示例#4
0
    def chooseAction(self, gameState):
        print("Agent " + str(self.index) + " choosing an action")
        minimaxMod = MinimaxModule(self)
        minimaxMod.setImpatience(
            float(self.heuristicWeights['attackModule_percentImpatience']) /
            100.0)
        minimaxVals = minimaxMod.getMinimaxValues(gameState, self.index,
                                                  self.isRed, 0.1)
        bestActions = []
        bestVal = 0
        for pair in minimaxVals:
            if (bestVal < pair[1]):
                bestActions = []
            if (len(bestActions) == 0 or (bestVal == pair[1])):
                bestActions.append(pair[0])
                bestVal = pair[1]

        if (len(bestActions) == 0):
            return gameState.getLegalActions(self.index)[0]
        return random.choice(bestActions)