# wazwaztime/aksolver architecture

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

## Overview

AKsolver is a river-only poker solver. Its principal workflow reads a run file, loads board and player ranges, constructs a betting tree, iterates counterfactual-regret minimization, then writes strategy and expected-value reports. The tree and evaluator are distinct domain stages; card encoding and hand-strength calculation support range preparation and showdown EVs. The tree, range, and board data files are present, but their exact run-file format and wiring are only partly visible, so the graph does not infer links to individual data files. CFR action logic is represented by the indexed source file, whose implementation was read but not excerpted.

Main entry points: [`include/RiverTree.h`](https://github.com/wazwaztime/aksolver/blob/master/include/RiverTree.h) (River tree), [`main.cpp`](https://github.com/wazwaztime/aksolver/blob/master/main.cpp) (CLI runner), [`include/TreeNode.h`](https://github.com/wazwaztime/aksolver/blob/master/include/TreeNode.h) (Node mechanics), [`src/EVCaculator.cpp`](https://github.com/wazwaztime/aksolver/blob/master/src/EVCaculator.cpp) (Showdown EV calculator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Solver entry"]
  node_main["CLI runner<br/>[main.cpp]"]
end

subgraph group_cards["Cards and ranges"]
  node_rangefiles["Range and board data"]
  node_codec["Card and range codec<br/>[CardCodec.cpp]"]
  node_evaluator["Hand evaluator<br/>[HandEvaluator.cpp]"]
end

subgraph group_strategy["Tree and strategy"]
  node_treefile["Betting tree data<br/>[strategy_tree.txt]"]
  node_river["River tree<br/>[RiverTree.h]"]
  node_gametree["Tree iteration<br/>[GameTree.h]"]
  node_treenode["Node mechanics<br/>[TreeNode.h]"]
  node_actionedge["CFR actions<br/>[ActionEdge.h]"]
  node_cfrsolver["CFR strategy updates<br/>[CFRsolver.cpp]"]
end

subgraph group_results["Evaluation and results"]
  node_evcalc["Showdown EV calculator<br/>[EVCaculator.cpp]"]
  node_reports["Strategy and EV reports"]
end

node_user(("Solver user"))
node_runfile["Run input"]

node_user -->|"starts"| node_main
node_main -->|"reads"| node_runfile
node_main -->|"configures and runs"| node_river
node_river -->|"loads ranges and board"| node_rangefiles
node_river -->|"loads betting tree"| node_treefile
node_river -->|"extends"| node_gametree
node_gametree -->|"operates on nodes"| node_treenode
node_treenode -->|"updates action state"| node_actionedge
node_treenode -->|"calls strategy updates"| node_cfrsolver
node_river -->|"calculates leaf EV"| node_evcalc
node_river -->|"decodes hands"| node_codec
node_codec -->|"evaluates hand strength"| node_evaluator
node_evcalc -->|"encodes hand IDs"| node_codec
node_evcalc -->|"ranks hands"| node_evaluator
node_river -->|"writes reports"| node_reports

click node_rangefiles "https://github.com/wazwaztime/aksolver/tree/master/files"
click node_treefile "https://github.com/wazwaztime/aksolver/blob/master/files/strategy_tree.txt"
click node_main "https://github.com/wazwaztime/aksolver/blob/master/main.cpp"
click node_river "https://github.com/wazwaztime/aksolver/blob/master/include/RiverTree.h"
click node_gametree "https://github.com/wazwaztime/aksolver/blob/master/include/GameTree.h"
click node_treenode "https://github.com/wazwaztime/aksolver/blob/master/include/TreeNode.h"
click node_actionedge "https://github.com/wazwaztime/aksolver/blob/master/include/ActionEdge.h"
click node_cfrsolver "https://github.com/wazwaztime/aksolver/blob/master/src/CFRsolver.cpp"
click node_codec "https://github.com/wazwaztime/aksolver/blob/master/src/CardCodec.cpp"
click node_evaluator "https://github.com/wazwaztime/aksolver/blob/master/src/HandEvaluator.cpp"
click node_evcalc "https://github.com/wazwaztime/aksolver/blob/master/src/EVCaculator.cpp"

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_main,node_user toneBlue
class node_rangefiles,node_codec,node_evaluator toneAmber
class node_treefile,node_river,node_gametree,node_treenode,node_actionedge,node_cfrsolver toneMint
class node_evcalc,node_reports toneRose
class node_runfile toneIndigo
```

## Components

### Solver entry

- [CLI runner](https://github.com/wazwaztime/aksolver/blob/master/main.cpp): `main.cpp`

### Cards and ranges

- [Range and board data](https://github.com/wazwaztime/aksolver/tree/master/files): `files`
- [Card and range codec](https://github.com/wazwaztime/aksolver/blob/master/src/CardCodec.cpp): `src/CardCodec.cpp`
- [Hand evaluator](https://github.com/wazwaztime/aksolver/blob/master/src/HandEvaluator.cpp): `src/HandEvaluator.cpp`

### Tree and strategy

- [Betting tree data](https://github.com/wazwaztime/aksolver/blob/master/files/strategy_tree.txt): `files/strategy_tree.txt`
- [River tree](https://github.com/wazwaztime/aksolver/blob/master/include/RiverTree.h): `include/RiverTree.h`
- [Tree iteration](https://github.com/wazwaztime/aksolver/blob/master/include/GameTree.h): `include/GameTree.h`
- [Node mechanics](https://github.com/wazwaztime/aksolver/blob/master/include/TreeNode.h): `include/TreeNode.h`
- [CFR actions](https://github.com/wazwaztime/aksolver/blob/master/include/ActionEdge.h): `include/ActionEdge.h`
- [CFR strategy updates](https://github.com/wazwaztime/aksolver/blob/master/src/CFRsolver.cpp): `src/CFRsolver.cpp`

### Evaluation and results

- [Showdown EV calculator](https://github.com/wazwaztime/aksolver/blob/master/src/EVCaculator.cpp): `src/EVCaculator.cpp`
- **Strategy and EV reports**

### Other components

- **Solver user**
- **Run input**

## Connections

- Solver user → CLI runner: starts (evidence: `main.cpp`)
- CLI runner → Run input: reads (evidence: `main.cpp`)
- CLI runner → River tree: configures and runs (evidence: `main.cpp`)
- River tree → Range and board data: loads ranges and board (evidence: `include/RiverTree.h`)
- River tree → Betting tree data: loads betting tree (evidence: `include/RiverTree.h`)
- River tree → Tree iteration: extends (evidence: `include/RiverTree.h`)
- Tree iteration → Node mechanics: operates on nodes (evidence: `include/GameTree.h`)
- Node mechanics → CFR actions: updates action state (evidence: `include/TreeNode.h`)
- Node mechanics → CFR strategy updates: calls strategy updates (evidence: `include/TreeNode.h`)
- River tree → Showdown EV calculator: calculates leaf EV (evidence: `include/RiverTree.h`)
- River tree → Card and range codec: decodes hands (evidence: `include/RiverTree.h`)
- Card and range codec → Hand evaluator: evaluates hand strength
- Showdown EV calculator → Card and range codec: encodes hand IDs (evidence: `src/EVCaculator.cpp`)
- Showdown EV calculator → Hand evaluator: ranks hands (evidence: `src/EVCaculator.cpp`)
- River tree → Strategy and EV reports: writes reports (evidence: `include/RiverTree.h`)
