本文整理汇总了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 )