feat: --check 标志只验证DSL覆盖率不跑牌局

用法: dotnet run --project Demo -- --check --dsl new_variant
输出: 能力覆盖率 + 合规检查 + 仅验证模式退出

文档: README + dsl-specification 更新创建流程
This commit is contained in:
xiaoou
2026-07-04 22:09:39 +08:00
parent 2ef8583180
commit a338dac139
3 changed files with 26 additions and 2 deletions

View File

@ -5,6 +5,7 @@ using RuleEngine.Dsl;
// Parse arguments // Parse arguments
bool autoMode = args.Contains("--auto"); bool autoMode = args.Contains("--auto");
bool humanMode = args.Contains("--human"); bool humanMode = args.Contains("--human");
bool checkOnly = args.Contains("--check");
string dslPath = "dsl-examples/xuezhandaodi.yaml"; string dslPath = "dsl-examples/xuezhandaodi.yaml";
int dslIdx = Array.IndexOf(args, "--dsl"); int dslIdx = Array.IndexOf(args, "--dsl");
if (dslIdx >= 0 && dslIdx + 1 < args.Length) if (dslIdx >= 0 && dslIdx + 1 < args.Length)
@ -64,6 +65,12 @@ catch (Exception ex)
return 1; return 1;
} }
if (checkOnly)
{
Console.WriteLine($"✅ 仅验证模式 — 未运行牌局");
return 0;
}
if (autoMode) if (autoMode)
{ {
// Batch mode: run N rounds silently // Batch mode: run N rounds silently

View File

@ -100,6 +100,10 @@ card-game-engine/
## 用法 ## 用法
```bash ```bash
# DSL 覆盖验证 (只加载不跑牌局)
dotnet run --project Demo -- --check --dsl your_variant
dotnet run --project Demo -- --check # 默认血战
# 交互模式 (逐局展示) # 交互模式 (逐局展示)
dotnet run --project Demo dotnet run --project Demo
dotnet run --project Demo -- --dsl wuhan dotnet run --project Demo -- --dsl wuhan

View File

@ -284,8 +284,21 @@ flower_rules:
4. 选择 `fan_types` (仅使用上表格中的番型名,其他名称得分为0) 4. 选择 `fan_types` (仅使用上表格中的番型名,其他名称得分为0)
5. 选择 `fan_stacking` 策略 5. 选择 `fan_stacking` 策略
6. 选择 `phases` 中的 actions (不列出=不可用) 6. 选择 `phases` 中的 actions (不列出=不可用)
7. 如果需要 wildcard/花牌/fu_flag,添加对应段 7. 如果需要 wildcard/花牌/fu_flag/计分倍数,添加对应段
8. 运行 `dotnet run --project Demo -- --dsl your_file --count 5` 验证 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` 匹配 - [ ] `deck.total` 与 `include_honors/include_flowers` 匹配