1
1
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
def calculate_score(fan: int, base_score: int, is_self_draw: bool, is_dealer: bool) -> dict:
|
||||
"""
|
||||
根据番数和底分计算总分。
|
||||
根据规则计算得分。
|
||||
|
||||
参数:
|
||||
- fan: 总番数。
|
||||
@@ -9,17 +9,15 @@ def calculate_score(fan: int, base_score: int, is_self_draw: bool, is_dealer: bo
|
||||
- is_dealer: 是否为庄家。
|
||||
|
||||
返回:
|
||||
- scores: 一个字典,包含所有玩家的得分。
|
||||
- "winner": 胜利者的得分(正数)。
|
||||
- "loser": 输家们的得分(负数)。
|
||||
- scores: 字典,包含赢家得分和输家扣分。
|
||||
"""
|
||||
# 计算总分 = 底分 * (2 ** 番数)
|
||||
# 翻倍计算总分
|
||||
total_score = base_score * (2 ** fan)
|
||||
|
||||
if is_self_draw:
|
||||
# 自摸,其他三家平摊
|
||||
if is_dealer:
|
||||
# 庄家自摸,三家平摊且输家每人付总分
|
||||
# 庄家自摸:每家付总分
|
||||
loser_score = -total_score
|
||||
winner_score = total_score * 3
|
||||
return {
|
||||
@@ -27,7 +25,7 @@ def calculate_score(fan: int, base_score: int, is_self_draw: bool, is_dealer: bo
|
||||
"loser": [loser_score] * 3
|
||||
}
|
||||
else:
|
||||
# 闲家自摸,庄家付双倍,其他两家付单倍
|
||||
# 闲家自摸:庄家付双倍,其他两家付单倍
|
||||
dealer_loss = -total_score * 2
|
||||
other_loss = -total_score
|
||||
winner_score = total_score * 4
|
||||
|
||||
Reference in New Issue
Block a user