當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。