本文整理汇总了Python中Deck.Deck.idOfSet方法的典型用法代码示例。如果您正苦于以下问题:Python Deck.idOfSet方法的具体用法?Python Deck.idOfSet怎么用?Python Deck.idOfSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Deck.Deck
的用法示例。
在下文中一共展示了Deck.idOfSet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateRatingsAI
# 需要导入模块: from Deck import Deck [as 别名]
# 或者: from Deck.Deck import idOfSet [as 别名]
def updateRatingsAI(self, table, setFound, the_time):
'''AI was faster, so all sets involved are actually harder
than we thought, ie increase their rating
Please call whenever an AI finds a set
'''
allSets = Deck.allSets(table)
for the_set in allSets:
try:
self.ratingList[Deck.idOfSet(the_set)] += 50
except:
self.ratingList[Deck.idOfSet(the_set)] = 1550
self.dumpData()
示例2: updateRatingsHuman
# 需要导入模块: from Deck import Deck [as 别名]
# 或者: from Deck.Deck import idOfSet [as 别名]
def updateRatingsHuman(self, table, setFound, the_time):
'''updates the ratings of all sets involved in this round
Please call whenever a human finds a set
'''
initialRating = 1500
setFoundKey = Deck.idOfSet(setFound)
try:
setFoundRating = self.ratingList[setFoundKey]
except KeyError: # first time this set shows up
setFoundRating = initialRating
losingSets = set(Deck.allSets(table)) - set(setFound)
for the_set in losingSets:
losingSetKey = Deck.idOfSet(the_set)
try:
losingSetRating = self.ratingList[losingSetKey]
except KeyError: # first time this set shows up
losingSetRating = initialRating
newWinnerRating, newLoserRating = self.newRatings(setFoundRating,
losingSetRating)
self.ratingList[setFoundKey] = newWinnerRating
self.ratingList[losingSetKey] = newLoserRating
self.dumpData()
示例3: get_difficulties
# 需要导入模块: from Deck import Deck [as 别名]
# 或者: from Deck.Deck import idOfSet [as 别名]
def get_difficulties(self, the_set):
try:
return self.ratingList[Deck.idOfSet(the_set)]
except KeyError:
return 1500