1
This commit is contained in:
@@ -67,13 +67,23 @@ def is_seven_pairs(hand):
|
||||
return sum(1 for count in hand if count == 2) == 7
|
||||
|
||||
|
||||
def is_cleared(hand):
|
||||
def is_cleared(hand, melds):
|
||||
"""
|
||||
检查手牌是否是清一色。
|
||||
"""
|
||||
suits = [tile // 36 for tile, count in enumerate(hand) if count > 0]
|
||||
return len(set(suits)) == 1
|
||||
检查手牌和明牌是否是清一色。
|
||||
|
||||
参数:
|
||||
- hand: 当前胡牌的手牌(长度为108的列表,表示每张牌的数量)。
|
||||
- melds: 碰杠等明牌列表。
|
||||
|
||||
返回:
|
||||
- bool: 是否为清一色。
|
||||
"""
|
||||
# 获取所有牌的花色
|
||||
all_tiles = hand + [tile for meld in melds for tile in meld]
|
||||
suits = [tile // 36 for tile in all_tiles if tile > 0]
|
||||
|
||||
# 检查是否有多种花色
|
||||
return len(set(suits)) == 1
|
||||
|
||||
def is_big_pairs(hand):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user