feat: 集成测试 + 手动出牌模式 + discart pool幽灵牌修复

集成测试 (10个):
- 发牌: 庄14闲13, 牌墙55
- 回合流转: 庄家第一轮不摸牌, 非庄家摸牌后出牌
- 数据完整性: 10回合后手牌+副露+牌墙+弃牌=108
- 对局完整性: 4种DSL全部不出错完成
- 构造听牌: 完整手牌第一轮自摸

手动出牌 (--human):
- HumanMahjongPlayer: 显示手牌/可选操作/h=胡/p=碰/k=杠/1-N=出牌
- MahjongRoom: humanPlayer参数

修复: DiscardPool碰/胡后不移除→幽灵牌→总牌数溢出
This commit is contained in:
xiaoou
2026-07-04 11:45:54 +08:00
parent bb43ed7c89
commit 4302ec2fd5
4 changed files with 285 additions and 4 deletions

View File

@ -4,6 +4,7 @@ using RuleEngine.Dsl;
// Parse arguments
bool autoMode = args.Contains("--auto");
bool humanMode = args.Contains("--human");
string dslPath = "dsl-examples/xuezhandaodi.yaml";
int dslIdx = Array.IndexOf(args, "--dsl");
if (dslIdx >= 0 && dslIdx + 1 < args.Length)
@ -54,7 +55,8 @@ if (autoMode)
{
try
{
var room = new MahjongRoom(rules, new[] { "AI-东", "AI-南", "AI-西", "AI-北" }, autoMode: true);
var room = new MahjongRoom(rules, new[] { "AI-东", "AI-南", "AI-西", "AI-北" }, autoMode: true,
humanPlayer: humanMode ? "AI-东" : null);
room.Run();
if (room.State.HuPlayers.Count > 0)
wins++;
@ -80,7 +82,8 @@ else
Console.WriteLine($"=== 麻将规则引擎 Demo — {rules.Game.Name} === (交互模式,按 Enter 继续下一步)");
Console.WriteLine();
var room = new MahjongRoom(rules, new[] { "AI-东", "AI-南", "AI-西", "AI-北" }, autoMode: false);
var room = new MahjongRoom(rules, new[] { "AI-东", "AI-南", "AI-西", "AI-北" }, autoMode: false,
humanPlayer: humanMode ? "AI-东" : null);
room.Deal();
// Show dealt hands