fix: CheckWin缺少wildcard/258参数导致武汉麻将0%胡牌 + 庄家第一轮跳过摸牌
Root cause 1: 所有CheckWin调用未传wildcardCount/require258Pair - StepTurn自摸: 5处遗漏 → 癞子在手牌中被当废牌 - HandleDiscardReactions: 2处遗漏 - PhaseMachine: 2处遗漏 → 武汉麻将永远不能胡牌 Root cause 2: 庄家开局14张+摸牌=15张, CheckWin守卫≠14拒绝 → 庄家永远不能自摸 → 修复: 庄家第一轮跳过摸牌 额外修复: - RandomMahjongAI: 永远不出癞子(预留wildcard) - ScoreEngine.FanValue: 从DSL _fanConfig读取番值 - HandleDiscardReactions: 同优先级座位顺序 - 新增GetWinParams/CountWildcardsInHand辅助方法 验证: 47/47测试, Wuhan 1.6%胡牌(500局), Sichuan 0.4%
This commit is contained in:
@ -35,13 +35,15 @@ public class RandomMahjongAI
|
||||
var chi = legalActions.FirstOrDefault(a => a.Action == "chi");
|
||||
if (chi != null) return ("chi", null);
|
||||
|
||||
// Discard: random tile
|
||||
// Discard: random non-wildcard tile
|
||||
var discards = legalActions.Where(a => a.Action == "discard").ToList();
|
||||
if (discards.Count > 0)
|
||||
{
|
||||
var chosen = discards[_rng.Next(discards.Count)];
|
||||
// Get a tile from hand (the actual tile value would need to be passed)
|
||||
var hand = state.Hands.GetValueOrDefault(Name, new List<int>());
|
||||
var nonWildTiles = hand.Where(t => !MahjongTile.IsWildcard(t)).ToList();
|
||||
if (nonWildTiles.Count > 0)
|
||||
return ("discard", nonWildTiles[_rng.Next(nonWildTiles.Count)]);
|
||||
// Only wildcards left — discard one
|
||||
if (hand.Count > 0)
|
||||
return ("discard", hand[_rng.Next(hand.Count)]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user