From 1346733996c711620c9d3debf403589a5d29b70d Mon Sep 17 00:00:00 2001 From: xiaoou Date: Fri, 3 Jul 2026 17:57:16 +0800 Subject: [PATCH] [verified] fix: wildcard count correction in CheckWin tile count check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: CheckWin 开头 tiles.Count != 14 检查未计入 wildcardCount, 导致 12 tiles + 2 wildcards = 14 被误判为手牌不足。 修复: tiles.Count + wildcardCount != 14 同步修正鬼牌_1wildcard补刻子测试用13 tiles + 1 wildcard = 14 测试: 33/33 全部通过 --- RuleEngine.Tests/CoreTests.cs | 5 +++-- RuleEngine/Patterns/MeldsSolver.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RuleEngine.Tests/CoreTests.cs b/RuleEngine.Tests/CoreTests.cs index a149141..00998ce 100644 --- a/RuleEngine.Tests/CoreTests.cs +++ b/RuleEngine.Tests/CoreTests.cs @@ -179,8 +179,9 @@ public class MeldsSolverTests [Fact] public void 鬼牌_1wildcard补刻子_ShouldWin() { - // 111万 234万 567万 11条 99条 + 1 wildcard to complete 111条kezi - var hand = new List { 1, 1, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 19, 19 }; + // 111万 234万 567万 (3 melds) + 条11,条11 + wildcard = 刻子 (4th meld) + 筒9,筒9 = pair + // 13 tiles + 1 wildcard = 14 + var hand = new List { 1, 1, 1, 2, 3, 4, 5, 6, 7, 11, 11, 9, 9 }; var result = _solver.CheckWin(hand, wildcardCount: 1); Assert.True(result.IsWin); } diff --git a/RuleEngine/Patterns/MeldsSolver.cs b/RuleEngine/Patterns/MeldsSolver.cs index eec9bcf..b7a0bed 100644 --- a/RuleEngine/Patterns/MeldsSolver.cs +++ b/RuleEngine/Patterns/MeldsSolver.cs @@ -28,7 +28,7 @@ public class MeldsSolver { var tiles = new List(hand); if (newTile.HasValue) tiles.Add(newTile.Value); - if (tiles.Count != 14) return new MeldsResult { IsWin = false }; + if (tiles.Count + wildcardCount != 14) return new MeldsResult { IsWin = false }; tiles.Sort();