From a338dac13989028039f91053a35ed50b83ac8dd8 Mon Sep 17 00:00:00 2001 From: xiaoou Date: Sat, 4 Jul 2026 22:09:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20--check=20=E6=A0=87=E5=BF=97=E5=8F=AA?= =?UTF-8?q?=E9=AA=8C=E8=AF=81DSL=E8=A6=86=E7=9B=96=E7=8E=87=E4=B8=8D?= =?UTF-8?q?=E8=B7=91=E7=89=8C=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用法: dotnet run --project Demo -- --check --dsl new_variant 输出: 能力覆盖率 + 合规检查 + 仅验证模式退出 文档: README + dsl-specification 更新创建流程 --- Demo/Program.cs | 7 +++++++ README.md | 4 ++++ docs/dsl-specification.md | 17 +++++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Demo/Program.cs b/Demo/Program.cs index 3473e81..4f0bfa6 100644 --- a/Demo/Program.cs +++ b/Demo/Program.cs @@ -5,6 +5,7 @@ using RuleEngine.Dsl; // Parse arguments bool autoMode = args.Contains("--auto"); bool humanMode = args.Contains("--human"); +bool checkOnly = args.Contains("--check"); string dslPath = "dsl-examples/xuezhandaodi.yaml"; int dslIdx = Array.IndexOf(args, "--dsl"); if (dslIdx >= 0 && dslIdx + 1 < args.Length) @@ -64,6 +65,12 @@ catch (Exception ex) return 1; } +if (checkOnly) +{ + Console.WriteLine($"✅ 仅验证模式 — 未运行牌局"); + return 0; +} + if (autoMode) { // Batch mode: run N rounds silently diff --git a/README.md b/README.md index 29b164f..e08df16 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,10 @@ card-game-engine/ ## 用法 ```bash +# DSL 覆盖验证 (只加载不跑牌局) +dotnet run --project Demo -- --check --dsl your_variant +dotnet run --project Demo -- --check # 默认血战 + # 交互模式 (逐局展示) dotnet run --project Demo dotnet run --project Demo -- --dsl wuhan diff --git a/docs/dsl-specification.md b/docs/dsl-specification.md index 99084a8..9081f09 100644 --- a/docs/dsl-specification.md +++ b/docs/dsl-specification.md @@ -284,8 +284,21 @@ flower_rules: 4. 选择 `fan_types` (仅使用上表格中的番型名,其他名称得分为0) 5. 选择 `fan_stacking` 策略 6. 选择 `phases` 中的 actions (不列出=不可用) -7. 如果需要 wildcard/花牌/fu_flag,添加对应段 -8. 运行 `dotnet run --project Demo -- --dsl your_file --count 5` 验证 +7. 如果需要 wildcard/花牌/fu_flag/计分倍数,添加对应段 +8. **仅验证加载覆盖率** (不跑牌局): + ```bash + dotnet run --project Demo -- --check --dsl your_file + ``` + 输出示例: + ``` + ✅ DSL 适配率: 7/7 (100%) — 南昌麻将 + ✅ 仅验证模式 — 未运行牌局 + ``` + 如果有合规警告会在适配率下方显示 +9. **验证玩法可运行** (100 局压测): + ```bash + dotnet run --project Demo -- --dsl your_file --auto --count 100 + ``` ### 快速检查清单 - [ ] `deck.total` 与 `include_honors/include_flowers` 匹配