本文整理汇总了Python中deuces.Card.get_suit_int方法的典型用法代码示例。如果您正苦于以下问题:Python Card.get_suit_int方法的具体用法?Python Card.get_suit_int怎么用?Python Card.get_suit_int使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类deuces.Card
的用法示例。
在下文中一共展示了Card.get_suit_int方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cards_to_suits
# 需要导入模块: from deuces import Card [as 别名]
# 或者: from deuces.Card import get_suit_int [as 别名]
def cards_to_suits(cards):
suit_dummy = np.zeros(4)
suit_binaries = np.array([Card.get_suit_int(x) for x in cards])
suit_dummy[0] = sum(suit_binaries == 1)
suit_dummy[1] = sum(suit_binaries == 2)
suit_dummy[2] = sum(suit_binaries == 4)
suit_dummy[3] = sum(suit_binaries == 8)
suit_dummy_std = (suit_dummy - 1.5) / 2 # Hacky "standardisation"
return suit_dummy_std
示例2: get_lowest_unpairing_card
# 需要导入模块: from deuces import Card [as 别名]
# 或者: from deuces.Card import get_suit_int [as 别名]
def get_lowest_unpairing_card(hand):
"""Add the worst possible card to an incomplete hand. Something
that cannot pair up or make a flush or make a straight."""
existing_ranks = set([Card.get_rank_int(x) for x in hand])
remaining_ranks = list(set(range(12)) - existing_ranks)
selected_rank = remaining_ranks[0]
would_be_hand = hand + [Card.new(Card.STR_RANKS[selected_rank] + 'h')]
if is_straight(would_be_hand):
selected_rank = remaining_ranks[1] # Don't make a straight
selected_rank_str = Card.STR_RANKS[selected_rank]
last_suit = Card.get_suit_int(hand[-1])
last_suit_index = [1, 2, 4, 8].index(last_suit)
selected_suit = [1, 2, 4, 8][(last_suit_index + 1) % 4]
selected_suit_str = Card.INT_SUIT_TO_CHAR_SUIT[selected_suit]
selected_card_str = selected_rank_str + str(selected_suit_str)
return Card.new(selected_card_str)