xiaoou afce77cca4 [verified] review fixes: priority arbitration, wildcard config, dead code
- CheckReactions: collect all claims, pick highest priority (win>kong>pung>chi)
- Deal(): read wildcardCount from DSL config instead of hardcoded 4
- CheckTing(): propagate wildcardCount + require258Pair to CheckWin
- ThirteenOrphans: fix neededForPair formula (extra>0?0:1)
- Remove FanConfig.Get() dead code
- Fill empty 全不靠 test body
2026-07-03 18:02:13 +08:00

Card Game Engine — 麻将规则引擎

YAML DSL 驱动的麻将规则引擎。目标:一份 DSL 配置文件 = 一种麻将玩法, 引擎加载后自动运行,不需要写玩法特定代码。

项目结构

card-game-engine/
├── docs/
│   ├── architecture-plan.md        # 架构设计文档
│   └── demo-implementation-plan.md # Demo 实施计划
├── RuleEngine/                     # C# 规则引擎核心
├── RuleEngine.Tests/               # 单元测试 (78个用例)
├── ai-companion/                   # Python AI 陪打服务
├── dsl-examples/                   # 玩法 DSL 配置 (YAML)
│   ├── xuezhandaodi.yaml           # 四川麻将血战到底
│   └── guangdong_jipinghu.yaml     # 广东麻将鸡平胡
└── Demo/                           # 控制台 Demo

核心设计

  • 规则引擎 ≠ 游戏引擎:纯逻辑库,不依赖图形框架
  • 扑克/麻将引擎分离:各自 100% 覆盖,共享基础层
  • int 编码性能优先4 bytes/tile
  • 加载时能力检查DSL 声明 requires引擎自动验证

开源参考

  • q_algorithm (C# 胡牌算法库)
  • majiang_algorithm (Java 麻将引擎 + AI)
  • MahjongKit (Python 牌谱分析)

状态

📋 架构设计完成 → 待开始编码

Description
YAML DSL 驱动的棋牌规则引擎 — 麻将 + 扑克,玩法即配置
Readme 1 MiB
Languages
C# 100%