fix: HumanMahjongPlayer听牌检测不含字牌 + wildcard显示优化

1. CheckTing硬编码AllTiles(false,false)→漏字牌(武汉/国标等)
   修复: 构造函数传includeHonors, MahjongRoom传_rules.Deck.IncludeHonors
2. wildcard显示: 翻牌定精时显示翻到的牌+精牌(带🀫前缀)
This commit is contained in:
xiaoou
2026-07-04 22:28:29 +08:00
parent 8d8403ee4e
commit d08eddda28
2 changed files with 14 additions and 6 deletions

View File

@ -12,11 +12,13 @@ public class HumanMahjongPlayer
{
public string Name { get; }
private readonly MeldsSolver _solver;
private readonly bool _includeHonors;
public HumanMahjongPlayer(string name, MeldsSolver solver)
public HumanMahjongPlayer(string name, MeldsSolver solver, bool includeHonors = false)
{
Name = name;
_solver = solver;
_includeHonors = includeHonors;
}
public (string action, int? tile) Decide(List<ActionOption> legalActions, MahjongGameState state)
@ -34,9 +36,15 @@ public class HumanMahjongPlayer
Console.WriteLine($" 牌墙: {state.Deck.Count}张 | 弃牌堆: {state.DiscardPool.Count}张");
// Show wildcard info
var wcTiles = state.Wildcards.ConfiguredWildcards;
if (wcTiles.Count > 0)
Console.WriteLine($" 🀫 宝牌(癞子): {string.Join(" ", wcTiles.Select(MahjongTile.ToString))}");
var wcTiles = state.Wildcards.ConfiguredWildcards;
if (wcTiles.Count > 0)
{
var wcDisplay = string.Join(" ", wcTiles.Select(t => MahjongTile.ToString(t, state.Wildcards)));
if (state.Wildcards.RevealedTile.HasValue)
Console.WriteLine($" 🀫 精: {wcDisplay} (翻牌: {MahjongTile.ToString(state.Wildcards.RevealedTile.Value)})");
else
Console.WriteLine($" 🀫 宝牌(癞子): {wcDisplay}");
}
// Show opponent summary
Console.Write(" 对手: ");
@ -117,7 +125,7 @@ public class HumanMahjongPlayer
fullHand.AddRange(m.Tiles.Where(t => t != -1));
// Check all possible tiles for win potential
var allTiles = MahjongTile.AllTiles(false, false);
var allTiles = MahjongTile.AllTiles(_includeHonors, false);
int wc = state.Wildcards.CountWildcards(fullHand);
foreach (var tile in allTiles)
{

View File

@ -32,7 +32,7 @@ public class MahjongRoom
_solver = new MeldsSolver(fanConfig, State.Wildcards);
if (humanPlayer != null)
_human = new HumanMahjongPlayer(humanPlayer, _solver);
_human = new HumanMahjongPlayer(humanPlayer, _solver, includeHonors: _rules.Deck.IncludeHonors);
var phases = BuildPhases();
_playPhase = phases.FirstOrDefault(p => p.Name == "play") ?? new PhaseConfig();