本文整理汇总了Python中Action.Action.createPlayAction方法的典型用法代码示例。如果您正苦于以下问题:Python Action.createPlayAction方法的具体用法?Python Action.createPlayAction怎么用?Python Action.createPlayAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Action.Action
的用法示例。
在下文中一共展示了Action.createPlayAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeMove
# 需要导入模块: from Action import Action [as 别名]
# 或者: from Action.Action import createPlayAction [as 别名]
def makeMove(self):
possibleActions = []
# add possible PLAYs, DISCARDs
for cardPos in range(0, len(self.agentStates[self].getCards())):
possibleActions.append(Action.createPlayAction(self,cardPos))
possibleActions.append(Action.createDiscardAction(self,cardPos))
# add possible HINTs
if self.gameState.getHintsRemaining():
for key in self.agentStates:
# can't hint myself
if self is key:
continue
else:
objectAgent = key
colors = {}
numbers = {}
for cardPos in range(0, self.agentStates[key].getNumCards()):
card = self.agentStates[key].getCard(cardPos)
color = card.getColor()
if not color in colors:
colors[color] = []
colors[color].append(cardPos)
number = card.getNumber()
if not number in numbers:
numbers[number] = []
numbers[number].append(cardPos)
for key in colors:
possibleActions.append(Action.createHintAction(self,objectAgent,Hint.createColorHint(colors[key],key)))
for key in numbers:
possibleActions.append(Action.createHintAction(self,objectAgent,Hint.createNumberHint(numbers[key],key)))
move = random.choice(possibleActions)
return move