本文整理汇总了Python中captureAgents.CaptureAgent.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python CaptureAgent.__init__方法的具体用法?Python CaptureAgent.__init__怎么用?Python CaptureAgent.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类captureAgents.CaptureAgent
的用法示例。
在下文中一共展示了CaptureAgent.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__(self, index):
CaptureAgent.__init__(self, index)
self.firstTurnComplete = False
self.startingFood = 0
self.theirStartingFood = 0
self.legalPositions = None
self.estimate = util.Counter()
示例2: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__(self, index):
CaptureAgent.__init__(self, index)
self.legalPositions = []
"tuple with (boolean, belief distribution, actual/most probable position)"
"TODO: Assumes 6 agents, will not always work"
self.positions = [None, None, None, None, None, None]
self.firstMove = True
示例3: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__(self, index, timeForComputing = .1):
CaptureAgent.__init__(self, index, timeForComputing)
self.depth = 4
self.numParticles = 10
self.steps = [(0, 0), (0, 1), (1, 0), (-1, 0), (0, -1)]
self.teammateLocations = {}
self.enemyParticles = {}
self.lastAction = None
示例4: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__(self, index, timeForComputing=.1):
CaptureAgent.__init__(self, index, timeForComputing)
team.append(self)
if self.index % 2 == 0:
self.isRed = True
self.middle = (ReflexCaptureAgent.MAP_WIDTH / 4, ReflexCaptureAgent.MAP_HEIGHT / 2)
else:
self.isRed = False
self.middle = (ReflexCaptureAgent.MAP_WIDTH * 3 / 4), (ReflexCaptureAgent.MAP_HEIGHT / 2)
示例5: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__( self, index, timeForComputing = .1 ):
CaptureAgent.__init__( self, index, timeForComputing)
print self.red, index, timeForComputing
self.visibleAgents = []
self.foodLeft = 0
self.foodEaten = 0
self.isPacman = False
self.a = []
self.first = True
self.size = 0
示例6: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__(self, index):
CaptureAgent.__init__(self, index)
self.firstTurnComplete = False
self.startingFood = 0
self.theirStartingFood = 0
self.discount = .9
self.alpha = 0.002
self.featureHandler = FeatureHandler()
self.agentType = 'basicQLearningAgent'
self.weights = None
self.explorationRate = 0.3
示例7: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__(self, index, alpha, epsilon):
CaptureAgent.__init__(self, index)
# self.weights = util.Counter()
self.alpha = alpha #learning rate--higher means learn in larger steps
self.epsilon = epsilon #exploration rate--higher means explore more
self.firstTurnComplete = False
self.startingFood = 0
self.theirStartingFood = 0
#used for estimating the enemy pos
self.legalPositions = None
self.estimate = util.Counter()
示例8: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__(self, index, timeForComputing = .1, numTraining=0, epsilon=0.5, alpha=0.5, gamma=1, **args):
"""
actionFn: Function which takes a state and returns the list of legal actions - REMOVED
alpha - learning rate
epsilon - exploration rate
gamma - discount factor
numTraining - number of training episodes, i.e. no learning after these many episodes
"""
CaptureAgent.__init__(self, index, timeForComputing)
self.episodesSoFar = 0
self.accumTrainRewards = 0.0
self.accumTestRewards = 0.0
self.numTraining = int(numTraining)
self.epsilon = float(epsilon)
self.alpha = float(alpha)
self.discount = float(gamma)
self.qValues = util.Counter()
示例9: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__(self, index,actionFn = None, numTraining=100, epsilon=0.07, alpha=0.2, gamma=0.7):
"""
actionFn: Function which takes a state and returns the list of legal actions
alpha - learning rate
epsilon - exploration rate
gamma - discount factor
numTraining - number of training episodes, i.e. no learning after these many episodes
"""
CaptureAgent.__init__(self, index)
if actionFn == None:
actionFn = lambda state: state.getLegalActions()
self.actionFn = actionFn
self.episodesSoFar = 0
self.accumTrainRewards = 0.0
self.accumTestRewards = 0.0
self.numTraining = int(numTraining)
self.epsilon = float(epsilon)
self.alpha = float(alpha)
self.discount = float(gamma)
self.startEpisode()
示例10: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__( self, index, timeForComputing = .1 ):
CaptureAgent.__init__(self, index, timeForComputing)
self.discount = 0.9
self.noise = 0
self.alpha = 0.01
self.epsilon = 0.05
self.preScore = 0
self.preState = None
self.preAction = None
self.weights = util.Counter()
self.weights = util.Counter()
self.weights['distanceToFood'] = -1
self.weights['successorScore'] = 100
#self.weights['onOffence'] = 0
#self.weights['numDefenders'] = 0
#self.weights['defenderDistance'] = 0
#self.weights['attackerDistance'] = 0
self.weights['foodsLeft'] = -1
self.weights['foodsRemained'] = 1
self.weights = util.normalize(self.weights)
示例11: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__(self,index):
CaptureAgent.__init__(self,index)
self.firstMove = True
self.visitedPositions = util.Counter()
self.numEnemiesEaten = 0
self.firstTurnComplete = False
self.scaredEnemies = []
# Create a new QLearning Agent
self.learning = LearningAgent("testReflexAgent_" + str(self.index) + ".p")
# Flag indicating if the enemy's capsule has been eaten
self.eatenEnemyCapsule = False
# Flag indicating if enemy has been scared before
self.beenScaredBefore = False
# Timers used to calculate when we are no longer scared
self.enemyScaredTimer = 0
self.learning.setWeights()#self.getWeights())
self.lastFoodList = util.Counter()
self.numDeaths = 0
示例12: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__(self, index):
CaptureAgent.__init__(self, index)
示例13: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__(self, index):
#initialize values
CaptureAgent.__init__(self, index)
self.firstTurnComplete = False
self.startingFood = 0
self.theirStartingFood = 0
示例14: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__(self, index, teamData):
CaptureAgent.__init__(self, index)
self.firstTurnComplete = False
self.startingFood = 0
self.theirStartingFood = 0
self.teamData = teamData
示例15: __init__
# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
def __init__(self, index, timeForComputing = 0.1):
CaptureAgent.__init__(self, index, timeForComputing)
self.hmm_list = {}