牌型组成
关键牌型
"鸡牌"机制
杠牌加分
明杠、暗杠、弯杠均触发额外积分(具体分值需按当地规则)
def is_win(hand):
# 检查七对(特殊牌型)
if len(hand) == 14 and len(set(hand)) == 7:
return True
# 普通胡牌:4组3张 + 1对
from collections import defaultdict
count = defaultdict(int)
for tile in hand:
count[tile] += 1
pairs = [t for t, cnt in count.items() if cnt >= 2]
for pair in pairs:
temp_count = count.copy()
temp_count[pair] -= 2
if can_form_melds(temp_count):
return True
return False
def can_form_melds(count):
# 递归检查剩余牌是否能组成顺子/刻子
for tile in count:
if count[tile] >= 3: # 刻子
count[tile] -= 3
if can_form_melds(count):
return True
count[tile] += 3
if tile[0] == '万' or tile[0] == '条' or tile[0] == '筒': # 顺子(需花色连续)
# 此处需实现顺子检测逻辑(简化示例)
pass
return sum(count.values()) == 0
必选规则
策略提示
有话要说...