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


Python Card.get_suit_int方法代码示例

本文整理汇总了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
开发者ID:DexGroves,项目名称:rl-ofc,代码行数:11,代码来源:gamestate_encoder.py

示例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)
开发者ID:DexGroves,项目名称:rl-ofc,代码行数:22,代码来源:generate_front_lookup.py


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