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


Python Hand.one_pair方法代码示例

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


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

示例1: test_three_of_a_kind

# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import one_pair [as 别名]
    def test_three_of_a_kind(self):
        deck = Deck()
        deck.get_new_deck()

        community_cards = []
        community_cards.append (Card('2', 'D'))
        community_cards.append (Card('2', 'C'))
        community_cards.append (Card('4', 'D'))

        my_hand = Hand(community_cards)
        my_hand.add (Card('2', 'S'))
        my_hand.add (Card('6', 'D'))

        assert my_hand.three_of_a_kind() and not my_hand.one_pair()
开发者ID:evan82,项目名称:poker-probability,代码行数:16,代码来源:test_hands.py

示例2: test_one_pair

# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import one_pair [as 别名]
    def test_one_pair(self):
        deck = Deck()
        deck.get_new_deck()

        community_cards = []
        community_cards.append (Card('2', 'D'))
        community_cards.append (Card('3', 'D'))
        community_cards.append (Card('4', 'D'))

        my_hand = Hand(community_cards)
        my_hand.add (Card('2', 'S'))
        my_hand.add (Card('6', 'D'))

        assert my_hand.one_pair() and not my_hand.is_flush()
开发者ID:evan82,项目名称:poker-probability,代码行数:16,代码来源:test_hands.py

示例3: Hand

# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import one_pair [as 别名]
        community_cards = []
        community_cards.append (community_cards1 or deck.deal())
        community_cards.append (community_cards2 or deck.deal())
        community_cards.append (community_cards3 or deck.deal())
        community_cards.append (community_cards4 or deck.deal())
        community_cards.append (community_cards5 or deck.deal())

        my_hand = Hand(community_cards)
        my_hand.add (my_cards1)
        my_hand.add (my_cards2)

        if my_hand.is_flush(): count_my_flushes += 1.0
        if my_hand.is_straight(): count_my_straights += 1.0
        if my_hand.four_of_a_kind(): count_my_four_of_a_kind += 1.0
        if my_hand.three_of_a_kind(): count_my_three_of_a_kind += 1.0
        if my_hand.one_pair(): count_my_one_pair += 1.0
        count_my_hand_strength += my_hand.get_strength()

    count_their_straights = 0
    count_their_flushes = 0
    count_their_four_of_a_kind = 0
    count_their_three_of_a_kind = 0
    count_their_one_pair = 0
    count_their_hand_strength = 0
    deck = Deck()

    for i in xrange(int(total)):
        deck.get_new_deck()

        community_cards = []
        community_cards.append (community_cards1 or deck.deal())
开发者ID:evan82,项目名称:poker-probability,代码行数:33,代码来源:prob.py


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