dou_dizhu 0.1.0

Toolkit for the Chinese card game Dou Dizhu
Documentation
  • Coverage
  • 14.89%
    14 out of 94 items documented0 out of 31 items with examples
  • Size
  • Source code size: 34.51 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.27 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 18s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • zhangheqi/dou_dizhu
    5 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • zhangheqi

dou_dizhu

Crates.io Documentation License

This crate is a Rust toolkit for the Chinese card game Dou Dizhu. It provides hand representation, category recognition, ordering, and validation at both compile time and runtime.

Features

  • Hand representation
  • All standard Dou Dizhu combinations
  • Hand comparison by game rules
  • Compile-time and runtime validation

Usage

Add this to your Cargo.toml:

[dependencies]
dou_dizhu = "0.1"

Then:

use dou_dizhu::{hand, Hand};

fn main() {
    // Compile-time evaluated hand
    let four_with_dual_solo: Hand = hand!(const {
        King: 4,
        Four,
        Five,
    });

    // Runtime evaluated hand
    let bomb: Hand = hand!({
        Three: {
            println!("evaluating bomb");
            4
        },
    }).unwrap();

    // A bomb beats four with dual solo
    assert!(four_with_dual_solo < bomb);
}

License

Licensed under either of:

at your option.