fix: 听牌检测wc重复计数→部分可胡牌丢失
根因: GetTingTiles传了hand+fullHand+wc=CountWildcards(hand) → CheckWin内部又计wildcardsInTiles→双重计数→total%3≠2→guard拒绝 修复: wc固定为0(configured wildcards已在tiles中被CheckWin统计) wildcardCount参数仅用于encoding 50+的额外wildcard tiles 效果: 听牌检测不再遗漏可胡牌,显示完整的可胡张数
This commit is contained in:
@ -123,19 +123,17 @@ public class HumanMahjongPlayer
|
||||
{
|
||||
var result = new List<int>();
|
||||
var hand = state.Hands.GetValueOrDefault(Name, new List<int>());
|
||||
// Combine with exposed melds
|
||||
var fullHand = new List<int>(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;
|
||||
|
||||
Reference in New Issue
Block a user