本文整理汇总了Python中card.Card.prime_product_from_hand方法的典型用法代码示例。如果您正苦于以下问题:Python Card.prime_product_from_hand方法的具体用法?Python Card.prime_product_from_hand怎么用?Python Card.prime_product_from_hand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类card.Card
的用法示例。
在下文中一共展示了Card.prime_product_from_hand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _five
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import prime_product_from_hand [as 别名]
def _five(self, cards):
"""
Performs an evalution given cards in integer form, mapping them to
a rank in the range [1, 7462], with lower ranks being more powerful.
Variant of Cactus Kev's 5 card evaluator, though I saved a lot of memory
space using a hash table and condensing some of the calculations.
"""
# if flush
if cards[0] & cards[1] & cards[2] & cards[3] & cards[4] & 0xf000:
handOR = (cards[0] | cards[1] | cards[2] | cards[3] | cards[4]) >> 16
prime = Card.prime_product_from_rankbits(handOR)
return self.table.flush_lookup[prime]
# otherwise
else:
prime = Card.prime_product_from_hand(cards)
return self.table.unsuited_lookup[prime]