def getAction(self, state): self.loadNeuronalNetwork() actions = self.getMove(getStateRepresentation(state)) return Directions.NUMBER[actions.index(max(actions))]
def getAction(self, state): from graphicsUtils import wait_for_keys legal = state.getLegalActions(self.index) stateRepresentation = getStateRepresentation(state) print "State Representation:", stateRepresentation move = None while move == None: self.keys = wait_for_keys() move = self.getMove(legal) if move == None: print "Illegal move. Try again" actionRepresentation = getActionRepresentation(move) print "Action Representation:", actionRepresentation self.saveTraining([stateRepresentation, actionRepresentation]) return move
def getAction( self, state): #from graphicsUtils import wait_for_keys legal = state.getLegalActions(self.index) stateRepresentation = getStateRepresentation(state) #print "State Representation:", stateRepresentation move = None while move == None: #self.keys = wait_for_keys() move = self.getMove(state, stateRepresentation) if move == None: print "Illegal move. Try again" actionRepresentation = getActionRepresentation(move) #print "Action Representation:", actionRepresentation self.saveTraining([self.convertState(state, stateRepresentation), self.convertAction(state, actionRepresentation)]) return move