pull/1/head
parent
5d660ff39a
commit
6e0c8a80f3
|
|
@ -1 +1,4 @@
|
|||
pytest tests/
|
||||
loguru~=0.7.2
|
||||
pytest~=8.3.3
|
||||
gym~=0.26.2
|
||||
numpy~=2.1.3
|
||||
|
|
@ -11,7 +11,7 @@ def calculate_score(fan: int, base_score: int, is_self_draw: bool, is_dealer: bo
|
|||
返回:
|
||||
- scores: 字典,包含赢家得分和输家扣分。
|
||||
"""
|
||||
# 翻倍计算总分
|
||||
# 翻倍计算基础分
|
||||
total_score = base_score * (2 ** fan)
|
||||
|
||||
if is_self_draw:
|
||||
|
|
@ -19,7 +19,7 @@ def calculate_score(fan: int, base_score: int, is_self_draw: bool, is_dealer: bo
|
|||
if is_dealer:
|
||||
# 庄家自摸:每家付单倍总分
|
||||
per_loser_score = -total_score
|
||||
winner_score = -3 * per_loser_score
|
||||
winner_score = total_score * 3 # 三家支付的总和
|
||||
return {
|
||||
"winner": winner_score,
|
||||
"loser": [per_loser_score] * 3
|
||||
|
|
@ -28,26 +28,25 @@ def calculate_score(fan: int, base_score: int, is_self_draw: bool, is_dealer: bo
|
|||
# 闲家自摸:庄家付双倍,其他两家付单倍
|
||||
dealer_loss = -total_score * 2
|
||||
other_loss = -total_score
|
||||
winner_score = -dealer_loss + 2 * other_loss
|
||||
winner_score = -dealer_loss + 2 * -other_loss # 庄家和两闲家支付总和
|
||||
return {
|
||||
"winner": winner_score,
|
||||
"loser": [dealer_loss, other_loss, other_loss]
|
||||
}
|
||||
else:
|
||||
# 点炮,点炮者独付
|
||||
loser_score = -total_score
|
||||
winner_score = total_score
|
||||
if is_dealer:
|
||||
# 庄家点炮
|
||||
loser_score = -total_score
|
||||
winner_score = -loser_score
|
||||
return {
|
||||
"winner": winner_score,
|
||||
"loser": [loser_score, 0, 0]
|
||||
}
|
||||
else:
|
||||
# 闲家点炮
|
||||
loser_score = -total_score
|
||||
winner_score = -loser_score
|
||||
return {
|
||||
"winner": winner_score,
|
||||
"loser": [loser_score, 0, 0]
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue