# e-neo/doudizhu architecture

> Architecture diagram of the GitHub repository e-neo/doudizhu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/e-neo/doudizhu
- Repository: https://github.com/e-neo/doudizhu

## Overview

This is a small command-line landlord-game card counter. The user enters their hand, then enters played hands; the program validates and removes each hand from a full deck and displays the remaining card counts. Parsing, compact card-count state, and display are all implemented in the single sampled source file, so they are represented as focused components rather than separate subsystems. The README mentions possible future additions, but no other product capability is present. Evidence is limited to the README and src/main.rs.

Main entry points: [`src/main.rs`](https://github.com/e-neo/doudizhu/blob/master/src/main.rs) (Interactive CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Card Counter"]
  node_cli["Interactive CLI<br/>[main.rs]"]
  node_parser["Hand Parser<br/>[main.rs]"]
  node_deck["Deck State<br/>[main.rs]"]
  node_display["Count Display<br/>[main.rs]"]
end

node_user(("Player"))

node_user -->|"enters hands"| node_cli
node_cli -->|"parses input"| node_parser
node_cli -->|"removes hand"| node_deck
node_cli -->|"prints counts"| node_display
node_parser -->|"provides cards"| node_deck
node_deck -->|"provides counts"| node_display

click node_cli "https://github.com/e-neo/doudizhu/blob/master/src/main.rs"
click node_parser "https://github.com/e-neo/doudizhu/blob/master/src/main.rs"
click node_deck "https://github.com/e-neo/doudizhu/blob/master/src/main.rs"
click node_display "https://github.com/e-neo/doudizhu/blob/master/src/main.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_parser,node_deck,node_display toneBlue
class node_user toneIndigo
```

## Components

### Card Counter

- [Interactive CLI](https://github.com/e-neo/doudizhu/blob/master/src/main.rs): `src/main.rs`
- [Hand Parser](https://github.com/e-neo/doudizhu/blob/master/src/main.rs): `src/main.rs`
- [Deck State](https://github.com/e-neo/doudizhu/blob/master/src/main.rs): `src/main.rs`
- [Count Display](https://github.com/e-neo/doudizhu/blob/master/src/main.rs): `src/main.rs`

### Other components

- **Player**

## Connections

- Player → Interactive CLI: enters hands (evidence: `src/main.rs`)
- Interactive CLI → Hand Parser: parses input (evidence: `src/main.rs`)
- Interactive CLI → Deck State: removes hand (evidence: `src/main.rs`)
- Interactive CLI → Count Display: prints counts (evidence: `src/main.rs`)
- Hand Parser → Deck State: provides cards (evidence: `src/main.rs`)
- Deck State → Count Display: provides counts (evidence: `src/main.rs`)
