| Crates.io | dou_dizhu |
| lib.rs | dou_dizhu |
| version | 0.2.0 |
| created_at | 2025-08-15 11:23:17.062165+00 |
| updated_at | 2025-08-24 14:44:23.719112+00 |
| description | Rust toolkit for the Chinese card game Dou Dizhu (斗地主) |
| homepage | |
| repository | https://github.com/zhangheqi/dou_dizhu |
| max_upload_size | |
| id | 1796589 |
| size | 67,484 |
A Rust toolkit for the Chinese card game Dou Dizhu (斗地主).
This crate implements Dou Dizhu strictly following the Pagat rules, though it uses different terminology.
Add this to your Cargo.toml:
[dependencies]
dou_dizhu = "0.2"
Then:
use dou_dizhu::*;
fn main() {
// Construct a play
let airplane_with_solos = play!(const {
Queen: 3,
King: 3,
Three,
Four,
})
.unwrap();
// Count how many stronger plays of the same kind exist in a full deck
assert_eq!(
Hand::FULL_DECK
.plays(airplane_with_solos.kind())
.filter(|p| p > &airplane_with_solos)
.count(),
77,
);
}
Licensed under either of:
at your option.