当前位置: 首页>>代码示例>>Python>>正文


Python Deck.allSets方法代码示例

本文整理汇总了Python中Deck.Deck.allSets方法的典型用法代码示例。如果您正苦于以下问题:Python Deck.allSets方法的具体用法?Python Deck.allSets怎么用?Python Deck.allSets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Deck.Deck的用法示例。


在下文中一共展示了Deck.allSets方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: suggestion

# 需要导入模块: from Deck import Deck [as 别名]
# 或者: from Deck.Deck import allSets [as 别名]
    def suggestion(self, table):
        all_sets = Deck.allSets(table)
        set_difficulties = []

        for the_set in all_sets:
            set_difficulties.append(self.get_difficulties(the_set))

        time, index = self.get_time(set_difficulties)
        set_cards1, set_cards2, set_cards3 = all_sets[index]

        return time, (set_cards1, set_cards2, set_cards3)
开发者ID:IsabellKonrad,项目名称:Shugou,代码行数:13,代码来源:AI.py

示例2: updateRatingsAI

# 需要导入模块: from Deck import Deck [as 别名]
# 或者: from Deck.Deck import allSets [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()
开发者ID:IsabellKonrad,项目名称:Shugou,代码行数:15,代码来源:AI.py

示例3: updateRatingsHuman

# 需要导入模块: from Deck import Deck [as 别名]
# 或者: from Deck.Deck import allSets [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()
开发者ID:IsabellKonrad,项目名称:Shugou,代码行数:25,代码来源:AI.py


注:本文中的Deck.Deck.allSets方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。