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


Python Actions.getPossibleActions方法代码示例

本文整理汇总了Python中game.Actions.getPossibleActions方法的典型用法代码示例。如果您正苦于以下问题:Python Actions.getPossibleActions方法的具体用法?Python Actions.getPossibleActions怎么用?Python Actions.getPossibleActions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在game.Actions的用法示例。


在下文中一共展示了Actions.getPossibleActions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: calculateSuccessorSet

# 需要导入模块: from game import Actions [as 别名]
# 或者: from game.Actions import getPossibleActions [as 别名]
def calculateSuccessorSet(self, agentIndex, state, layout):

        """
        ratio = 0.3
        import random
        if random.random() < ratio:
            return AstarPursuer().getAction(state, agentIndex)
        """
        # max value for pursuer-set
        maxValue = 0
        values = []
        successors = Actions.getPossibleActions(state.data.agentStates[agentIndex].getPosition(), 1.0, layout.obstacles)
        
        # Frome 4 possible successors, choose one with best value 
        for successor in successors:
            tempGameState = state.deepCopy()
            tempGameState.data.agentStates[agentIndex].setPosition(successor)
            import time
            startTime = time.time()
            res = self.calculateCover(agentIndex, tempGameState, layout)

            endTime = time.time()
            writeStepTimeLog('cra.csv', endTime - startTime)
            values.append(res)
        return successors[values.index(max(values))] 
开发者ID:namidairo777,项目名称:xiao_multiagent,代码行数:27,代码来源:pursuerAgents.py

示例2: getLegalActions

# 需要导入模块: from game import Actions [as 别名]
# 或者: from game.Actions import getPossibleActions [as 别名]
def getLegalActions( state ):
        """
        Returns a list of possible actions.
        """
        return Actions.getPossibleActions( state.getPacmanState().configuration, state.data.layout.walls ) 
开发者ID:AUTBS,项目名称:AI-Pacman,代码行数:7,代码来源:pacman.py

示例3: getLegalActions

# 需要导入模块: from game import Actions [as 别名]
# 或者: from game.Actions import getPossibleActions [as 别名]
def getLegalActions( state, agentIndex ):
    """
    Returns a list of legal actions (which are both possible & allowed)
    """
    agentState = state.getAgentState(agentIndex)
    conf = agentState.configuration
    possibleActions = Actions.getPossibleActions( conf, state.data.layout.walls )
    return AgentRules.filterForAllowedActions( agentState, possibleActions) 
开发者ID:AUTBS,项目名称:AI-Pacman,代码行数:10,代码来源:capture.py

示例4: getLegalActions

# 需要导入模块: from game import Actions [as 别名]
# 或者: from game.Actions import getPossibleActions [as 别名]
def getLegalActions( state):
        """
        returns a list of possible actions
        """
        return Actions.getPossibleActions(state.getTargetState().getPosition(), TargetRules.TARGET_SPEED, state.data.layout.obstacles) 
开发者ID:namidairo777,项目名称:xiao_multiagent,代码行数:7,代码来源:multiAgent.py

示例5: getLegalActions

# 需要导入模块: from game import Actions [as 别名]
# 或者: from game.Actions import getPossibleActions [as 别名]
def getLegalActions( state ):
    """
    Returns a list of possible actions.
    """
    return Actions.getPossibleActions( state.getPacmanState().configuration, state.data.layout.walls ) 
开发者ID:jrios6,项目名称:Berkeley-AI-PacMan-Lab-1,代码行数:7,代码来源:pacman.py


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