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


Python Analyzer._order方法代码示例

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


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

示例1: TestAnalyzer

# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import _order [as 别名]

#.........这里部分代码省略.........

        result = self.analyzer._compare(players)
        expected = [self.p3]
        self.assertEqual(expected, result)

    def test_compare_multiple(self):
        """if there are multiple winners do we
        return all of them?"""
        players = self.analyzer._setup()

        self.p0.hand = [0, 14, 12, 11, 10, 8]
        self.p1.hand = [1, 14, 12, 11, 8]
        self.p2.hand = [7, 10, 2]
        self.p3.hand = [7, 10, 2]
        self.p4.hand = [0]
        self.p5.hand = [0]

        result = self.analyzer._compare(players)
        expected = [self.p2, self.p3]
        self.assertEqual(expected, result)

    def test_hi_card(self):
        """can we identify a hi card hand?"""
        players = self.analyzer._setup()

        self.p4.hole[0].value = 12
        self.p4.hole[1].value = 11
        self.p4.hole[2].value = 9
        self.p4.hole[3].value = 14
        self.p4.hole[4].value = 13
        self.p4.hole[5].value = 3
        self.p4.hole[6].value = 2

        players = self.analyzer._order(players)

        self.analyzer._matching(players)

        expected = [0, 14, 13, 12, 11, 9]
        self.assertEqual(self.p4.hand, expected)

    def test_matching_hands(self):
        """can we find matching number hands
         eg.  pairs through quads??"""
        players = self.analyzer._setup()

        # quads
        self.p0.hole[0].value = 14
        self.p0.hole[1].value = 14

        # boat
        self.p1.hole[0].value = 14
        self.p1.hole[1].value = 13

        # trips
        self.p2.hole[0].value = 14
        self.p2.hole[1].value = 12

        # two pair
        self.p3.hole[0].value = 12
        self.p3.hole[1].value = 12

        # pair
        self.p4.hole[0].value = 12
        self.p4.hole[1].value = 11

        self.p4.hole[2].value = 14
开发者ID:mrbubba,项目名称:Poker,代码行数:70,代码来源:test_analyzer.py


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