# kmurf1999/rust_poker architecture

> Architecture diagram of the GitHub repository kmurf1999/rust_poker, 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/kmurf1999/rust_poker
- Repository: https://github.com/kmurf1999/rust_poker

## Overview

RustPoker is a Rust poker library whose principal workflow parses player ranges and public cards, combines compatible hole-card assignments, then calculates range-versus-range equity by simulation or exact enumeration. It also provides standalone hand evaluation, range filtering, and optional hand indexing. The graph reflects README capabilities and sampled references; several internal calls and the Rust-to-C indexer boundary were not shown, so uncertain links are omitted.

Main entry points: [`src/hand_range.rs`](https://github.com/kmurf1999/rust_poker/blob/master/src/hand_range.rs) (Range parser), [`src/equity_calculator/simulator.rs`](https://github.com/kmurf1999/rust_poker/blob/master/src/equity_calculator/simulator.rs) (Equity simulator), [`hand_indexer/c_hand_indexer/src/hand_index.h`](https://github.com/kmurf1999/rust_poker/blob/master/hand_indexer/c_hand_indexer/src/hand_index.h) (Indexer interface), [`src/equity_calculator/mod.rs`](https://github.com/kmurf1999/rust_poker/blob/master/src/equity_calculator/mod.rs) (Equity API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ranges["Range inputs"]
  node_range_parser["Range parser<br/>[hand_range.rs]"]
  node_range_filter["Range filters<br/>[mod.rs]"]
end

subgraph group_equity["Equity calculation"]
  node_combined_ranges["Combined ranges<br/>[combined_range.rs]"]
  node_equity_api["Equity API<br/>[mod.rs]"]
  node_simulator["Equity simulator<br/>[simulator.rs]"]
end

subgraph group_evaluation["Hand evaluation"]
  node_hand["Hand representation<br/>[hand.rs]"]
  node_evaluator["Hand evaluator<br/>[evaluator.rs]"]
  node_constants["Card constants<br/>[constants.rs]"]
end

subgraph group_indexing["Hand indexing"]
  node_index_wrapper["Rust indexer API<br/>[hand_indexer.rs]"]
  node_index_engine["C index engine<br/>[hand_index.c]"]
  node_index_header["Indexer interface<br/>[hand_index.h]"]
  node_deck["Deck utilities<br/>[deck.h]"]
  node_index_impl["Indexer internals<br/>[hand_index-impl.h]"]
end

node_developer(("Library caller"))

node_developer -->|"parses ranges"| node_range_parser
node_developer -->|"requests equity"| node_equity_api
node_developer -->|"evaluates hands"| node_evaluator
node_developer -.->|"indexes hands"| node_index_wrapper
node_range_filter -->|"filters ranges"| node_range_parser
node_equity_api -->|"builds assignments"| node_combined_ranges
node_equity_api -->|"runs calculations"| node_simulator
node_combined_ranges -->|"reads ranges"| node_range_parser
node_simulator -->|"uses assignments"| node_combined_ranges
node_simulator -->|"reads ranges"| node_range_parser
node_simulator -->|"scores hands"| node_evaluator
node_evaluator -->|"evaluates hand"| node_hand
node_hand -->|"uses card tables"| node_constants
node_range_parser -->|"uses card tables"| node_constants
node_index_engine -->|"implements interface"| node_index_header
node_index_header -->|"includes deck"| node_deck
node_index_header -->|"includes internals"| node_index_impl
node_index_wrapper -.->|"uses interface"| node_index_header

click node_range_parser "https://github.com/kmurf1999/rust_poker/blob/master/src/hand_range.rs"
click node_range_filter "https://github.com/kmurf1999/rust_poker/blob/master/src/range_filter/mod.rs"
click node_combined_ranges "https://github.com/kmurf1999/rust_poker/blob/master/src/equity_calculator/combined_range.rs"
click node_equity_api "https://github.com/kmurf1999/rust_poker/blob/master/src/equity_calculator/mod.rs"
click node_simulator "https://github.com/kmurf1999/rust_poker/blob/master/src/equity_calculator/simulator.rs"
click node_hand "https://github.com/kmurf1999/rust_poker/blob/master/src/hand_evaluator/hand.rs"
click node_evaluator "https://github.com/kmurf1999/rust_poker/blob/master/src/hand_evaluator/evaluator.rs"
click node_constants "https://github.com/kmurf1999/rust_poker/blob/master/src/constants.rs"
click node_index_wrapper "https://github.com/kmurf1999/rust_poker/blob/master/hand_indexer/src/hand_indexer.rs"
click node_index_engine "https://github.com/kmurf1999/rust_poker/blob/master/hand_indexer/c_hand_indexer/src/hand_index.c"
click node_index_header "https://github.com/kmurf1999/rust_poker/blob/master/hand_indexer/c_hand_indexer/src/hand_index.h"
click node_deck "https://github.com/kmurf1999/rust_poker/blob/master/hand_indexer/c_hand_indexer/src/deck.h"
click node_index_impl "https://github.com/kmurf1999/rust_poker/blob/master/hand_indexer/c_hand_indexer/src/hand_index-impl.h"

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_range_parser,node_range_filter toneBlue
class node_combined_ranges,node_equity_api,node_simulator toneAmber
class node_hand,node_evaluator,node_constants toneMint
class node_index_wrapper,node_index_engine,node_index_header,node_deck,node_index_impl toneRose
class node_developer toneIndigo
```

## Components

### Range inputs

- [Range parser](https://github.com/kmurf1999/rust_poker/blob/master/src/hand_range.rs): `src/hand_range.rs`
- [Range filters](https://github.com/kmurf1999/rust_poker/blob/master/src/range_filter/mod.rs): `src/range_filter/mod.rs`

### Equity calculation

- [Combined ranges](https://github.com/kmurf1999/rust_poker/blob/master/src/equity_calculator/combined_range.rs): `src/equity_calculator/combined_range.rs`
- [Equity API](https://github.com/kmurf1999/rust_poker/blob/master/src/equity_calculator/mod.rs): `src/equity_calculator/mod.rs`
- [Equity simulator](https://github.com/kmurf1999/rust_poker/blob/master/src/equity_calculator/simulator.rs): `src/equity_calculator/simulator.rs`

### Hand evaluation

- [Hand representation](https://github.com/kmurf1999/rust_poker/blob/master/src/hand_evaluator/hand.rs): `src/hand_evaluator/hand.rs`
- [Hand evaluator](https://github.com/kmurf1999/rust_poker/blob/master/src/hand_evaluator/evaluator.rs): `src/hand_evaluator/evaluator.rs`
- [Card constants](https://github.com/kmurf1999/rust_poker/blob/master/src/constants.rs): `src/constants.rs`

### Hand indexing

- [Rust indexer API](https://github.com/kmurf1999/rust_poker/blob/master/hand_indexer/src/hand_indexer.rs): `hand_indexer/src/hand_indexer.rs`
- [C index engine](https://github.com/kmurf1999/rust_poker/blob/master/hand_indexer/c_hand_indexer/src/hand_index.c): `hand_indexer/c_hand_indexer/src/hand_index.c`
- [Indexer interface](https://github.com/kmurf1999/rust_poker/blob/master/hand_indexer/c_hand_indexer/src/hand_index.h): `hand_indexer/c_hand_indexer/src/hand_index.h`
- [Deck utilities](https://github.com/kmurf1999/rust_poker/blob/master/hand_indexer/c_hand_indexer/src/deck.h): `hand_indexer/c_hand_indexer/src/deck.h`
- [Indexer internals](https://github.com/kmurf1999/rust_poker/blob/master/hand_indexer/c_hand_indexer/src/hand_index-impl.h): `hand_indexer/c_hand_indexer/src/hand_index-impl.h`

### Other components

- **Library caller**

## Connections

- Library caller → Range parser: parses ranges (evidence: `README.md`)
- Library caller → Equity API: requests equity (evidence: `README.md`)
- Library caller → Hand evaluator: evaluates hands (evidence: `README.md`)
- Library caller → Rust indexer API: indexes hands (evidence: `README.md`)
- Range filters → Range parser: filters ranges (evidence: `src/range_filter/mod.rs`)
- Equity API → Combined ranges: builds assignments (evidence: `src/equity_calculator/mod.rs`)
- Equity API → Equity simulator: runs calculations (evidence: `src/equity_calculator/mod.rs`)
- Combined ranges → Range parser: reads ranges (evidence: `src/equity_calculator/combined_range.rs`)
- Equity simulator → Combined ranges: uses assignments (evidence: `src/equity_calculator/simulator.rs`)
- Equity simulator → Range parser: reads ranges (evidence: `src/equity_calculator/simulator.rs`)
- Equity simulator → Hand evaluator: scores hands (evidence: `src/equity_calculator/simulator.rs`)
- Hand evaluator → Hand representation: evaluates hand (evidence: `src/hand_evaluator/evaluator.rs`)
- Hand representation → Card constants: uses card tables (evidence: `src/hand_evaluator/hand.rs`)
- Range parser → Card constants: uses card tables (evidence: `src/hand_range.rs`)
- C index engine → Indexer interface: implements interface (evidence: `hand_indexer/c_hand_indexer/src/hand_index.c`)
- Indexer interface → Deck utilities: includes deck (evidence: `hand_indexer/c_hand_indexer/src/hand_index.h`)
- Indexer interface → Indexer internals: includes internals (evidence: `hand_indexer/c_hand_indexer/src/hand_index.h`)
- Rust indexer API → Indexer interface: uses interface
