id: 9a176440044b45f4ad0c545c7a7456f9
parent_id: f9726477e2bb458fa2bf19090ad3eea6
item_type: 1
item_id: 659da65d964344fc89e6b4eafac0098c
item_updated_time: 1781251946520
title_diff: "[]"
body_diff: "[{\"diffs\":[[1,\"# Bot Framework Architecture\\\nID: 659da65d964344fc89e6b4eafac0098c\\\nNotebook ID: 2c8da247905946c3aa19eb4936e16323\\\nCreated: 1780223822827\\\nUpdated: 1780223822827\\\nIs Todo: No\\\nTags: poker, project-plan, active-project\\\n\\\n---\\\n\\\n\"],[0,\"Module archi\"]],\"start1\":0,\"start2\":0,\"length1\":12,\"length2\":230},{\"diffs\":[[0,\"```\\\n\"],[-1,\"rusty-\"],[1,\"super_\"],[0,\"marvin/\"],[1,\"                    # project root\"],[0,\"\\\n├──\"]],\"start1\":910,\"start2\":910,\"length1\":21,\"length2\":55},{\"diffs\":[[0,\"        \"],[-1,\" \"],[0,\"# worksp\"]],\"start1\":987,\"start2\":987,\"length1\":17,\"length2\":16},{\"diffs\":[[0,\"rkspace \"],[-1,\"root\"],[1,\"(holdem_bots + holdem_gui)\"],[0,\"\\\n├── hol\"]],\"start1\":999,\"start2\":999,\"length1\":20,\"length2\":42},{\"diffs\":[[0,\" holdem_\"],[-1,\"core\"],[1,\"bots\"],[0,\"/       \"]],\"start1\":1037,\"start2\":1037,\"length1\":20,\"length2\":20},{\"diffs\":[[0,\" # P\"],[-1,\"UBLIC\"],[1,\"RIVATE\"],[0,\" cra\"]],\"start1\":1067,\"start2\":1067,\"length1\":13,\"length2\":14},{\"diffs\":[[0,\"e — \"],[-1,\"framework + simple bot\"],[1,\"advanced bots + strategie\"],[0,\"s\\\n│ \"]],\"start1\":1082,\"start2\":1082,\"length1\":30,\"length2\":33},{\"diffs\":[[0,\"├── \"],[-1,\"card.rs, deck.rs, board.rs, hand.rs, hole_cards.rs\"],[1,\"lib.rs                # register_bots()\"],[0,\"\\\n│  \"]],\"start1\":1134,\"start2\":1134,\"length1\":58,\"length2\":47},{\"diffs\":[[0,\"    ├── \"],[-1,\"evaluator\"],[1,\"assembly\"],[0,\"/       \"]],\"start1\":1182,\"start2\":1182,\"length1\":25,\"length2\":24},{\"diffs\":[[0,\"    \"],[1,\" \"],[0,\"# \"],[-1,\"3-tier: Supersonic → Cactus Kev → Algorithmic\"],[1,\"strategy registry, config parsing, bot assembly\"],[0,\"\\\n│  \"]],\"start1\":1207,\"start2\":1207,\"length1\":55,\"length2\":58},{\"diffs\":[[0,\"    \"],[-1,\"└── game/\\\n│\"],[1,\"├── cash/    \"],[0,\"    \"]],\"start1\":1266,\"start2\":1266,\"length1\":19,\"length2\":21},{\"diffs\":[[0,\"    \"],[-1,\"├── player.rs         # HoldemPlayer trait + Seat\"],[1,\"  # preflop + postflop strategies (Gen 1 + Gen 2)\\\n│       │   ├── rollout_postflop_base.rs   # shared base (thresholds, 17 determine_* methods)\"],[0,\"\\\n│  \"]],\"start1\":1290,\"start2\":1290,\"length1\":57,\"length2\":151},{\"diffs\":[[0,\"    \"],[-1,\" \"],[1,\"│\"],[0,\"   ├── \"],[-1,\"bot_factory\"],[1,\"rollout_postflop_v3\"],[0,\".rs    \"],[1,\" \"],[0,\"# \"],[-1,\"Plugin-style regi\"],[1,\"production V3 \"],[0,\"strat\"],[-1,\"ion\"],[1,\"egy\"],[0,\"\\\n│  \"]],\"start1\":1442,\"start2\":1442,\"length1\":61,\"length2\":67},{\"diffs\":[[0,\"    \"],[-1,\"    ├── bots/\"],[1,\"│   └── thresholds.rs \"],[0,\"    \"]],\"start1\":1510,\"start2\":1510,\"length1\":21,\"length2\":30},{\"diffs\":[[0,\"  # \"],[-1,\"CallBot, FoldBot, RaiseBot, RandomBot, FlockBot, ChumpBot, StrategyBot\\\n│           └── strategy/         # Strategy trait, ModularStrategy, Context, Analyzer, Helper, Recorder\"],[1,\"PostflopThresholds (79 configurable f64 fields)\\\n│       ├── sng/                  # SNG/tournament strategies\\\n│       └── common/               # shared utilities (hand_potential, etc.)\"],[0,\"\\\n├──\"]],\"start1\":1547,\"start2\":1547,\"length1\":183,\"length2\":193},{\"diffs\":[[0,\"tc.)\\\n├── holdem_\"],[-1,\"bots/\"],[1,\"gui/ \"],[0,\"                \"]],\"start1\":1732,\"start2\":1732,\"length1\":37,\"length2\":37},{\"diffs\":[[0,\"  # \"],[-1,\"PRIVATE crate — advanced bo\"],[1,\"Web GUI for parameter sweeps & experimen\"],[0,\"ts\\\n│\"]],\"start1\":1769,\"start2\":1769,\"length1\":35,\"length2\":48},{\"diffs\":[[0,\"rc/\\\n│       ├── \"],[-1,\"lib\"],[1,\"main\"],[0,\".rs             \"]],\"start1\":1825,\"start2\":1825,\"length1\":35,\"length2\":36},{\"diffs\":[[0,\"        \"],[-1,\" # register_bo\"],[1,\"# axum server on 127.0.0.1:3000\\\n│       ├── api.rs                # REST API (11 endpoin\"],[0,\"ts\"],[-1,\"(\"],[0,\")\\\n│     \"]],\"start1\":1855,\"start2\":1855,\"length1\":33,\"length2\":106},{\"diffs\":[[0,\"    \"],[-1,\"└\"],[1,\"├\"],[0,\"── c\"],[-1,\"ash/                 # BigStackBot, ShortStackBot, PostFlopStrategy\\\n├── holdem_sim/\"],[1,\"onfig_gen.rs         # dynamic TOML generation\\\n│       ├── runner.rs             # subprocess simulation runner\\\n│       ├── types.rs              # shared data types\\\n│       └── static/index.html     # SPA frontend (dark theme, Chart.js)\\\n└── configs/\\\n    ├── bots/                     # bot assembly TOML configs\\\n    └── *.toml \"],[0,\"    \"]],\"start1\":1959,\"start2\":1959,\"length1\":96,\"length2\":341},{\"diffs\":[[0,\"ion \"],[-1,\"runner\\\n└── docs/\"],[1,\"configs\"],[0,\"\\\n```\"]],\"start1\":2324,\"start2\":2324,\"length1\":24,\"length2\":15},{\"diffs\":[[0,\".\\\n\\\n---\\\n\\\n\"],[1,\"## Strategy Registry (14 types)\\\n\\\n| Registration Name | Generation | Description |\\\n|---|---|---|\\\n| `g1_short_stack_preflop` | Gen 1 | Push/fold preflop (≤25 BB) |\\\n| `g1_big_stack_preflop` | Gen 1 | Hand-grouping preflop (≥25 BB) |\\\n| `g1_short_stack_preflop_sng` | Gen 1 | SNG-specific push/fold |\\\n| `g1_fold_micro_stack` | Gen 1 | Fold when micro-stacked in SNG |\\\n| `g1_steal_from_inactive` | Gen 1 | Steal blinds from sitting-out players |\\\n| `g1_sage_endgame` | Gen 1 | Nash HU push/fold (13×13 tables) |\\\n| `g1_push_or_fold` | Gen 1 | Push or fold preflop |\\\n| `g1_blind_steal` | Gen 1 | Blind steal preflop |\\\n| `g1_blind_resteal` | Gen 1 | Blind resteal preflop |\\\n| `g1_postflop_rules` | Gen 1 | Static rules postflop |\\\n| `g2_postflop_rollout` | Gen 2 | Original EHS postflop baseline |\\\n| `g2_postflop_rollout_v2` | Gen 2 | Nut-aware postflop (preserved) |\\\n| `g2_postflop_rollout_v3` | Gen 2 | V2 + F1 (trap) + F4 (draw call) — **production** |\\\n| `g2_nash_icm` | Gen 2 | Nash/ICM push/fold for SNG |\\\n\\\n---\\\n\\\n## Configurable Thresholds\\\n\\\n`PostflopThresholds` has 79 configurable fields covering: draw quality, bet thresholds (V11+OTB), call thresholds (V11+OTB+HU), raise thresholds, check-raise, rope-a-dope, all-in, bet adjustments, raise sizing.\\\n\\\n- **Defaults** in code via `Default` impl\\\n- **TOML overrides** via `from_config_map()` — accepts both integer and float TOML values\\\n- **Runtime sweeps** via `holdem_gui` — generates temp bot configs with inline overrides\\\n\\\n---\\\n\\\n## holdem_gui — Experiment GUI\\\n\\\nWeb-based tool for parameter sweeps running on `http://127.0.0.1:3000`.\\\n\\\n### Architecture\\\n- **Backend**: axum REST API, spawns `holdem_bots` binary as subprocess\\\n- **Frontend**: single-page HTML/JS app with Chart.js for result visualization\\\n- **No recompilation needed** — parameter overrides are injected into dynamically generated TOML configs\\\n\\\n### Features\\\n- Load/edit/save bot and simulation TOML configs\\\n- Two sweep modes: VsBaseline (tuned vs baseline + filler) and RoundRobin (different values compete)\\\n- Parameter selection from 83 configurable fields, grouped by category\\\n- Range input: steps mode or ±% mode with preview\\\n- Flexible table composition: pick any bots for any seats\\\n- Full game settings editor (seats, hands, blinds, ante, etc.)\\\n- Live progress tracking with auto-polling\\\n- Results table with delta coloring + Chart.js line chart\\\n\\\n### API Endpoints\\\n| Endpoint | Method | Description |\\\n|----------|--------|-------------|\\\n| `/api/bots` | GET | List bot configs |\\\n| `/api/bots/{name}` | GET/POST | Get/save bot config |\\\n| `/api/sim-configs` | GET | List sim configs |\\\n| `/api/strategies` | GET | List registered strategies |\\\n| `/api/params` | GET | List configurable parameters (83 fields) |\\\n| `/api/experiments` | GET/POST | List/create experiments |\\\n| `/api/experiments/{id}` | GET | Get experiment details + results |\\\n| `/api/experiments/{id}/cancel` | POST | Cancel running experiment |\\\n\\\n---\\\n\\\n\"],[0,\"## Java \"]],\"start1\":3134,\"start2\":3134,\"length1\":16,\"length2\":2939},{\"diffs\":[[0,\"3. `\"],[-1,\"holdem_sim` calls `holdem_bots::register_bots()` behind `#[cfg(feature = \\\"advanced-bots\\\")]`\"],[1,\"--bot-dir` flag loads additional `.toml` bot definitions from a directory\"],[0,\"\\\n\\\nDe\"]],\"start1\":6859,\"start2\":6859,\"length1\":99,\"length2\":81},{\"diffs\":[[0,\"`holdem_\"],[-1,\"sim\"],[1,\"gui\"],[0,\"` → `hol\"]],\"start1\":6966,\"start2\":6966,\"length1\":19,\"length2\":19},{\"diffs\":[[0,\"gy, \"],[-1,\"future proprietary bots\\\n\\\nConditional compilation via `#[cfg(feature = \\\"advanced-bots\\\")]` i\"],[1,\"configurable thresholds\\\n\\\n**Tooling (holdem_gui):** Experiment GUI, parameter sweep engine, results visualization — depends o\"],[0,\"n \"],[1,\"`\"],[0,\"holdem_\"],[-1,\"sim.\"],[1,\"bots` for config types and binary path\"],[0,\"\\\n\\\n--\"]],\"start1\":7290,\"start2\":7290,\"length1\":111,\"length2\":180},{\"diffs\":[[0,\"- **\"],[-1,\"OnceLock over Lazy:** Already in std::sync, no extra dependency needed\"],[1,\"Subprocess over library call for GUI:** The GUI spawns the `holdem_bots` binary as a subprocess rather than calling `run_cash_game()` directly. This decouples the GUI from engine internals and avoids blocking the async runtime.\\\n- **Dynamic TOML generation over static config files:** Parameter overrides are injected into dynamically generated TOML configs stored in temp directories. No manual config file management needed.\\\n- **toml::Value construction over format! templates:** Config generation uses the `toml` crate's value types instead of string formatting, preventing TOML injection attacks\"],[0,\".\"]],\"start1\":7906,\"start2\":7906,\"length1\":75,\"length2\":603}]"
metadata_diff: {"new":{},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2026-06-12T08:16:35.116Z
created_time: 2026-06-12T08:16:35.116Z
type_: 13