当前位置: 首页>>代码示例>>Python>>正文


Python CaptureAgent.__init__方法代码示例

本文整理汇总了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()
开发者ID:rioleo,项目名称:Team-Radr,代码行数:10,代码来源:ninjaAgents.py

示例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
开发者ID:pabloc11,项目名称:awp-pacman,代码行数:12,代码来源:baselineAgents.py

示例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
开发者ID:keerthanakumar,项目名称:contest,代码行数:12,代码来源:theNameOfOurAgent.py

示例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)
开发者ID:dacphuc1993,项目名称:COMP90054_Pacman_contest,代码行数:12,代码来源:myTeam.py

示例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
开发者ID:Musket33rs,项目名称:Project2,代码行数:12,代码来源:cookieMonsters.py

示例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
开发者ID:stephenchiang,项目名称:pacman,代码行数:13,代码来源:qlearningAgent.py

示例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()
开发者ID:rioleo,项目名称:Team-Radr,代码行数:14,代码来源:qAgents.py

示例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()
开发者ID:chanhou,项目名称:pacmanCTF,代码行数:20,代码来源:superTeam.py

示例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()
开发者ID:chengchingwen,项目名称:pacmanCTF,代码行数:23,代码来源:learningAgents.py

示例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)
开发者ID:winaboy,项目名称:contest,代码行数:25,代码来源:FTD.py

示例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
开发者ID:drew1313,项目名称:PacmanCaptureTheFlag,代码行数:25,代码来源:yourAgent.py

示例12: __init__

# 需要导入模块: from captureAgents import CaptureAgent [as 别名]
# 或者: from captureAgents.CaptureAgent import __init__ [as 别名]
 def __init__(self, index):
   CaptureAgent.__init__(self, index)
开发者ID:kkansky,项目名称:CS-221,代码行数:4,代码来源:workingAgents.py

示例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
开发者ID:kkansky,项目名称:CS-221,代码行数:8,代码来源:expectimaxAgent.py

示例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
开发者ID:pabloc11,项目名称:awp-pacman2,代码行数:8,代码来源:greatAgents.py

示例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 = {}
开发者ID:varunkp,项目名称:BerkeleyCS,代码行数:5,代码来源:myTeam.py


注:本文中的captureAgents.CaptureAgent.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。