refactor: 移除 maxRounds=500 安全阀, 牌局自然终止
牌局终止路径: - 胡牌 → IsFinished=true (HandleDiscardReactions/ExecuteWinClaim/StepTurn) - 牌墙耗尽 → Settle() → IsFinished=true - 只剩一人(血战) → AdvancePlayer → IsFinished=true - 所有路径都通过 IsFinished 控制, 不需要额外安全阀 500局×5种玩法压测 0 错误, 证明牌局能自然结束。
This commit is contained in:
@ -123,23 +123,12 @@ public class MahjongRoom
|
||||
Deal();
|
||||
IsFinished = false;
|
||||
|
||||
// Safety valve: prevent infinite loops from edge-case game states
|
||||
const int maxRounds = 500;
|
||||
int round = 0;
|
||||
|
||||
while (!IsFinished && round < maxRounds)
|
||||
while (!IsFinished)
|
||||
{
|
||||
if (State.Phase == "deal") { State.Phase = "play"; continue; }
|
||||
if (State.Phase == "settle" || IsFinished) break;
|
||||
|
||||
StepTurn();
|
||||
round++;
|
||||
}
|
||||
|
||||
if (!IsFinished)
|
||||
{
|
||||
State.AddEvent("max_rounds", "", null, $"超过最大回合数({maxRounds}),强制流局");
|
||||
Settle();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user