Unified board & card game rules foundation for MoonBit: Go, Xiangqi, International Chess and generic poker behind one engine interface
| Package | What it provides | Backed by |
|---|---|---|
| core | Unified game model: GameId, Player, Outcome, EngineError and the Engine facade with apply / legal_moves / undo / turn / is_over / outcome / render | wbgxiaosu/moonbaduk (Go), wbgxiaosu/xiangqi (Xiangqi), L76148/moonchess (chess) |
| cards | Original generic poker: 52-card deck, seeded deterministic shuffle, dealing, 5-card evaluation and best-of-5..7 comparison (high card → straight flush) | — (original) |
// one interface, four games
let c : @core.Engine = @core.Engine::make(@core.Chess)
let _ = c.apply("e2e4")
let moves : Array[String] = c.legal_moves()
let g : @core.Engine = @core.Engine::make(@core.Go(19, 7.5))
let _ = g.apply("Q16")
let _ = g.apply("pass")
// terminal result in game-conventional notation
let outcome : @core.Outcome? = c.outcome() // e.g. Winner(P2) → "0-1"
// poker
let deck : @cards.Deck = @cards.Deck::shuffled(42UL) // deterministic
let hand : Array[@cards.Card] = deck.deal(5)
let value : @cards.HandValue? = @cards.evaluate_five(hand)| Outcome | Go | Xiangqi / Chess |
|---|---|---|
| first player wins | B+24.5 (margin) | 1-0 |
| second player wins | W+7.5 (margin) | 0-1 |
| draw | 0 | 1/2-1/2 |
| Capability | Go | Xiangqi | Chess |
|---|---|---|---|
| legal-move enumeration | ✓ | ✓ | ✓ |
| undo | ✓ | ✓ | ✓ |
| terminal-state detection | double pass | checkmate / stalemate (a loss) | checkmate / stalemate / fifty-move rule |
| scoring | Chinese area rules with komi | decisive only | decisive only |
moon check
moon test
moon run cmd/mainInstall
Download zipUnified board & card game rules foundation for MoonBit: Go, Xiangqi, International Chess and generic poker behind one engine interface