From 181696f93a1f721a3c75f0409a83b386da85028d Mon Sep 17 00:00:00 2001 From: xiaoou Date: Sun, 5 Jul 2026 01:18:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=AC=E7=89=8C=E6=A3=80=E6=B5=8Bwc?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E8=AE=A1=E6=95=B0=E2=86=92=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=8F=AF=E8=83=A1=E7=89=8C=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: GetTingTiles传了hand+fullHand+wc=CountWildcards(hand) → CheckWin内部又计wildcardsInTiles→双重计数→total%3≠2→guard拒绝 修复: wc固定为0(configured wildcards已在tiles中被CheckWin统计) wildcardCount参数仅用于encoding 50+的额外wildcard tiles 效果: 听牌检测不再遗漏可胡牌,显示完整的可胡张数 --- RuleEngine/AI/HumanMahjongPlayer.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/RuleEngine/AI/HumanMahjongPlayer.cs b/RuleEngine/AI/HumanMahjongPlayer.cs index 509de4c..2bf22c6 100644 --- a/RuleEngine/AI/HumanMahjongPlayer.cs +++ b/RuleEngine/AI/HumanMahjongPlayer.cs @@ -123,19 +123,17 @@ public class HumanMahjongPlayer { var result = new List(); var hand = state.Hands.GetValueOrDefault(Name, new List()); - // Combine with exposed melds - var fullHand = new List(hand); - if (state.Exposed.TryGetValue(Name, out var melds)) - foreach (var m in melds) - fullHand.AddRange(m.Tiles.Where(t => t != -1)); + // CheckWin internally counts wildcards in tiles → wildcardCount is for EXTRA wildcards (encoding 50+) + // Configured wildcards in hand/exposed are already counted by _wildcards.IsWildcard inside CheckWin + // So wildcardCount=0 for Nanchang-type variants, or _rules.Deck.WildcardCount for fixed-extra variants + int wc = 0; // Check all possible tiles for win potential var allTiles = MahjongTile.AllTiles(_includeHonors, false); - int wc = state.Wildcards.CountWildcards(fullHand); foreach (var tile in allTiles) { if (hand.Count(t => t == tile) >= 4) continue; - var r = _solver.CheckWin(fullHand, newTile: tile, wildcardCount: wc); + var r = _solver.CheckWin(hand, newTile: tile, wildcardCount: wc); if (r != null && r.IsWin) result.Add(tile); } return result;