def chooseAction(self, gameState): # First of all, we update the real distances updateDistances(gameState) move = KeyboardAgent.getAction(self, gameState) printFile(move, gameState, 'training_keyboardAgent.txt') global lastMove lastMove = move return move
def getAction( self, state): action = KeyboardAgent.getAction(self, state); # First time through, initialize the filter if self.initialized == False: self.initFilter(state) self.initialized = True # On all movement, step the filter and take an observation if action != Directions.STOP: print state.getLegalActions(self.index) print state.getPacmanPosition() self.moveStep() self.observeAndResample(state) self.computeWeightedMeanPosition() return action
def chooseAction(self, gameState): # First of all, we update the real distances updateDistances(gameState) t0 = time.clock() move = KeyboardAgent.getAction(self, gameState) t1 = time.clock() - t0 livingGhostsAndPacman = gameState.getLivingGhosts() printStatistics(livingGhostsAndPacman, t1, 'statistics_keyboard.txt') printFile(move, gameState, 'training_keyboard.arff', None) global lastMove global travelledDistance lastMove = move travelledDistance += 1 return move
def chooseAction(self, gameState): return KeyboardAgent.getAction(self, gameState)
def __init__(self, index = 0, inference = "ExactInference", ghostAgents = None): KeyboardAgent.__init__(self, index) BustersAgent.__init__(self, index, inference, ghostAgents)
def getMove(self, legal): return KeyboardAgent.getMove(self, legal);
def __init__( self, index = 0 ): KeyboardAgent.__init__(self, index) self.initialized = False;
def chooseAction(self, gameState): action = KeyboardAgent.getAction(self, gameState) self.prevAction = action return action
def __init__(self, index = 0, inference = "SLAMParticleFilter", ghostAgents = None): KeyboardAgent.__init__(self, index) SLAMAgent.__init__(self, index, inference, ghostAgents)
def __init__(self, index=0, inference="KeyboardInference", ghostAgents=None): KeyboardAgent.__init__(self, index) BustersAgent.__init__(self, index, inference, ghostAgents)
def chooseAction(self, gameState): move = KeyboardAgent.getAction(self, gameState) self.f.write(BustersAgent.printLineData(self, gameState, move)) return move