guan-dan
2026The Chinese card game Guandan, in your terminal — fair shuffle, open rules, written in Rust. Practice against bots or play four-player rooms over WebSocket.
- Year
- 2026
- Stack
- Code
- GitHub ↗


掼蛋 (Guandan) is a four-player partnership card game from Huai’an, Jiangsu, hugely popular across the Yangtze delta. guan-dan brings it to the terminal — clean, fair, and open source, the way fight-the-landlord did for 斗地主.
Fair first
- True random dealing — no card manipulation, no “new-player protection” tricks. Skill and luck, not algorithms and wallets.
- Transparent rules — the engine and protocol are open source and auditable (MIT).
- Server-authoritative — the pure engine crate validates every play; clients are thin.
What’s inside
- Full core rules — level cards, wild cards (逢人配), the bomb ladder, tribute and anti-tribute, playing up through A.
- Four players, two teams — classic partnership seating (0+2 vs 1+3).
- Bot practice — one human plus three heuristic bots, no network needed beyond a local server.
- Online rooms — create, join, or quick-match over WebSocket.
- Keyboard and mouse — rank shortcuts, arrow selection, click to select, double-click to play, right-click to pass.
- Bilingual UI — Chinese-first, with English where it matters.
Install
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/SihanTeng/guan-dan/main/install.sh | bash
# then
guandan # default ws://127.0.0.1:9100
guandan --server ws://host:9100
# Windows
irm https://raw.githubusercontent.com/SihanTeng/guan-dan/main/install.ps1 | iex
From source (Rust 1.75+):
cargo run -p guandan-server -- --bind 0.0.0.0:9100
cargo run -p guandan-client -- --server ws://127.0.0.1:9100
Controls (short list)
| Input | Action |
|---|---|
← → / click |
Move hand cursor / select card |
Space |
Toggle card selection |
Double-click / Enter |
Play |
Right-click / P |
Pass |
Rank keys 3–A, B/R |
Multi-select by rank |
C |
Card counter |
H |
Help |
Esc |
Back / clear |
Under the hood
Rust throughout: guandan-core (pure rules), guandan-protocol, guandan-server, guandan-client, plus guandan-bot heuristics. Installers and CI live on GitHub Releases.