本文整理匯總了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))]
示例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 )
示例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)
示例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)
示例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 )