id: ba787f867e464ac0b2aefdff458e39b6
parent_id: 5ee0e61867a04f4f8d09197a0049662c
item_type: 1
item_id: 659da65d964344fc89e6b4eafac0098c
item_updated_time: 1782623960878
title_diff: "[]"
body_diff: "[{\"diffs\":[[0,\"re\\\n\\\n\"],[-1,\"Module architecture for the bot framework in the Rust `super_marvin` project.\\\n\\\n---\"],[1,\"> Updated 2026-06-28.\\\n\\\n## Strategy Composition\\\n\\\nAll bots use the **modular strategy pattern** (ported from Java Supersonic). Strategies are composed in a tree with voting mechanisms:\\\n- **FirstApplicable**: first strategy that's applicable wins (most common)\\\n- **Democratic**: weighted majority vote\\\n- **Random**: weighted random selection\\\n\\\nA strategy is `is_applicable()` → `get_action()`. If it returns Fold/Check and `consider_fold_as_not_applicable()` is true, the chain continues to the next strategy.\"],[0,\"\\\n\\\n##\"]],\"start1\":26,\"start2\":26,\"length1\":90,\"length2\":513},{\"diffs\":[[0,\"ry (\"],[-1,\"14\"],[1,\"20\"],[0,\" typ\"]],\"start1\":555,\"start2\":555,\"length1\":10,\"length2\":10},{\"diffs\":[[0,\"ion \"],[-1,\"Name | Generatio\"],[1,\"| Ge\"],[0,\"n | \"]],\"start1\":581,\"start2\":581,\"length1\":24,\"length2\":12},{\"diffs\":[[0,\"k_preflop` |\"],[-1,\" Gen\"],[0,\" 1 | Push/fo\"]],\"start1\":637,\"start2\":637,\"length1\":28,\"length2\":24},{\"diffs\":[[0,\"eflop` |\"],[-1,\" Gen\"],[0,\" 1 | Han\"]],\"start1\":701,\"start2\":701,\"length1\":20,\"length2\":16},{\"diffs\":[[0,\"p_sng` |\"],[-1,\" Gen\"],[0,\" 1 | SNG\"]],\"start1\":771,\"start2\":771,\"length1\":20,\"length2\":16},{\"diffs\":[[0,\"stack` |\"],[-1,\" Gen\"],[0,\" 1 | Fol\"]],\"start1\":826,\"start2\":826,\"length1\":20,\"length2\":16},{\"diffs\":[[0,\"_inactive` |\"],[-1,\" Gen\"],[0,\" 1 | Steal b\"]],\"start1\":888,\"start2\":888,\"length1\":28,\"length2\":24},{\"diffs\":[[0,\"dgame` |\"],[-1,\" Gen\"],[0,\" 1 | Nas\"]],\"start1\":958,\"start2\":958,\"length1\":20,\"length2\":16},{\"diffs\":[[0,\"g1_p\"],[-1,\"ush_or_fold` | Gen 1 | Push or fold preflop |\\\n| `g1_blind_steal` | Gen 1 | Blind steal \"],[1,\"ostflop_rules` | 1 | Static rules postflop |\\\n| `ng_\"],[0,\"preflop\"],[1,\"`\"],[0,\" |\"],[-1,\"\\\n| `g1_blind_resteal` | Gen 1 | Blind resteal preflop |\\\n| `g1_postflop_rules` | Gen 1 | Static rules postflop\"],[1,\" 2/3 | 169-hand ranking table preflop (Java port)\"],[0,\" |\\\n|\"]],\"start1\":1009,\"start2\":1009,\"length1\":213,\"length2\":118},{\"diffs\":[[0,\"llout` |\"],[-1,\" Gen\"],[0,\" 2 | Ori\"]],\"start1\":1143,\"start2\":1143,\"length1\":20,\"length2\":16},{\"diffs\":[[0,\"ut_v4` |\"],[-1,\" Gen\"],[0,\" 2 | Nut\"]],\"start1\":1209,\"start2\":1209,\"length1\":20,\"length2\":16},{\"diffs\":[[0,\"are \"],[-1,\"postflop (trap + draw call + raise safety) + MC multi-way equity — **cash\"],[1,\"MC multi-way postflop (previous\"],[0,\" pro\"]],\"start1\":1228,\"start2\":1228,\"length1\":81,\"length2\":39},{\"diffs\":[[0,\"oduction\"],[-1,\"**\"],[1,\")\"],[0,\" |\\\n| `g2\"]],\"start1\":1266,\"start2\":1266,\"length1\":18,\"length2\":17},{\"diffs\":[[0,\"h_icm` |\"],[-1,\" Gen\"],[0,\" 2 | Nas\"]],\"start1\":1287,\"start2\":1287,\"length1\":20,\"length2\":16},{\"diffs\":[[0,\"d for SNG |\\\n\"],[1,\"| `g2_ke_hu_nash` | 2 | KEHU20BB Nash HU equilibrium (19 tables, Java port) |\\\n\"],[0,\"| `g3_postfl\"]],\"start1\":1317,\"start2\":1317,\"length1\":24,\"length2\":102},{\"diffs\":[[0,\"` | \"],[-1,\"**Gen 3**\"],[1,\"3\"],[0,\" | R\"]],\"start1\":1429,\"start2\":1429,\"length1\":17,\"length2\":9},{\"diffs\":[[0,\"e-aware \"],[1,\"equity \"],[0,\"postflop\"]],\"start1\":1441,\"start2\":1441,\"length1\":16,\"length2\":23},{\"diffs\":[[0,\"lop \"],[-1,\"with MC multi-way equity, weighted decision scoring |\\\n\\\n## Gen 2 V4 — Production Cash Strategy\\\n\\\n**File:** `holdem_bots/src/cash/rollout_postflop_v4.rs` (~100 lines, thin wrapper)\\\n\\\n### Equity Computation (hybrid dispatch in `RolloutPostFlopBase::compute_potential_mc`)\\\n- **Heads-up (1 opponent):** Exhaustive enumeration (exact, trie-optimized)\\\n- **Multi-way (2+ opponents):** `compute_multiway_uniform` — Monte Carlo with partial Fisher-Yates dealing, true multi-way equity against strongest opponent\\\n\\\n### Decision Logic\\\nAll decision logic lives in `R\"],[1,\"|\\\n| `g4_adaptive_preflop` | 4 | VPIP-adaptive NG preflop looseness |\\\n| `g4_adaptive_postflop` | 4 | Range-narrowing + observer-driven postflop — **current production** |\\\n| `gen5_collect` | 5 | RL data collector (Gen3 teacher + transition recorder) |\\\n| `chump_bot` | Baseline | Calling station test opponent |\\\n| `flock_bot` | Baseline | Tight-aggressive test opponent |\\\n| `sng` | Legacy | Legacy SNG composite bot |\\\n\\\n## Production Config Chain\\\n\\\n`cash_nl_g4_live.toml` (live production):\\\n```\\\nvoting_mode = \\\"first_applicable\\\"\\\n\\\n1. g2_ke_hu_nash          → HU, 15-25 BB: Nash equilibrium\\\n2. g1_short_stack_preflop  → ≤25 BB: push/fold chart\\\n3. g4_adaptive_preflop     → >25 BB: NG preflop + VPIP looseness\\\n4. g4_adaptive_postflop    → postflop: observer-driven range narrowing → Gen 3 equity → threshold decision\\\n```\\\n\\\n## Shared Postflop Base\\\n\\\nGen 2-4 postflop strategies all inherit from `r\"],[0,\"ollout\"],[-1,\"PostFlopBase` (`get_first_in_action`, `get_raised_pot_action`, `would_check_first_in`, etc.). V4 is a thin wrapper that computes equity then delegates.\\\n\\\n### Production Fixes (inherited from V3, validated via A/B testing)\\\n1. **F1: Check-raise trap protection** — rope-a-dope suppressed when `would_check_first_in()` is true\\\n2. **F4: OTB draw-based call** — `adj_ppot > 0.25` call condition, disabled in true HU (2-seat tables)\\\n3. **F7: Draw safety gate on raises** — non-nut draws blocked when `npot > npot_raise_ceiling`\"],[1,\"_postflop_base.rs` (488 lines, 27 methods):\\\n- `compute_equity()` — Monte Carlo equity\\\n- `should_call()`, `should_raise()`, `should_bet()` — threshold-based decisions\\\n- `determine_bet_fraction()` — sizing logic\\\n- `compute_potential_mc()` — MC hand potential\\\n\\\nGen 3 adds: range-aware equity (`Gen3Equity` with `range_width`)\\\nGen 4 adds: adaptive ranges (observer-driven) + config overrides\\\n\\\n## Equity Computation\\\n\\\n| Situation | Method |\\\n|---|---|\\\n| Heads-up | Exhaustive enumeration (exact, trie-optimized) |\\\n| Multi-way | Monte Carlo with partial Fisher-Yates dealing |\\\n\\\n### PotentialResult fields\\\n- `hs`: hand strength (P(best hand now))\\\n- `ppot`: positive potential (P(improve))\\\n- `npot`: negative potential (P(decline))\\\n- `nutpot`: nut potential\\\n- `rpot`: robustness\\\n- `win_prob`: EHS = hs*(1-npot) + (1-hs)*ppot\"],[0,\"\\\n\\\n##\"]],\"start1\":1461,\"start2\":1461,\"length1\":1084,\"length2\":1713},{\"diffs\":[[0,\": 10\"],[-1,\",000 default (quic\"],[0,\"k \"],[1,\"(\"],[0,\"tests)\"],[-1,\", 20,000\"],[1,\" → 20k\"],[0,\" (sw\"]],\"start1\":3204,\"start2\":3204,\"length1\":42,\"length2\":23},{\"diffs\":[[0,\"eps)\"],[-1,\", 50,000\"],[1,\" → 50k\"],[0,\" (pr\"]],\"start1\":3228,\"start2\":3228,\"length1\":16,\"length2\":14},{\"diffs\":[[0,\"tion\"],[-1,\" configs\"],[1,\"/live\"],[0,\")\\\n- \"]],\"start1\":3246,\"start2\":3246,\"length1\":16,\"length2\":13},{\"diffs\":[[0,\"lity\"],[-1,\")\\\n- See \\\"MC Sample Count Guidelines\\\" note for accuracy/speed tradeoffs\\\n\\\n### V4 vs V3 Benchmark (10K hands, 5v5, 10 seeds)\\\nV4 wins **6/10 seeds**, average edge **+0.34 BB/hand per seat**. V3 removed — V4 is the new production baseline.\\\n\\\n### History\\\n- **V2** (dropped): Nut-aware draw quality, hardcoded constants\\\n- **V3** (dropp\"],[1,\" in sweeps)\\\n- `mc_time_budget_ms`: 5k (sim) → 10k (live)\\\n\\\n## Config System\\\n\\\nBot configs are TOML files in `configs/bots/`:\\\n```toml\\\n[bot]\\\nname = \\\"cash_nl_g4_live\\\"\\\nvoting_mode = \\\"first_applicable\\\"\\\n\\\n[[strategies]]\\\ntype = \\\"g2_ke_hu_nash\\\"\\\n\\\n[[strategies]]\\\ntype = \\\"g4_adaptive_postflop\\\"\\\n\\\n[strategies.config]\\\nmc_samples = 50000\\\nbet_turn_base = 0.58\\\n# ... 80+ configurable parameters\\\n```\\\n\\\nConfigs are loaded via `register_bot_from_config(path)` and registered by name.\\\n\\\n## Workspace Structure\\\n\\\n```\\\nsuper_marvin/\\\n├── holdem_bots/          # Bot strategies (Gen 1-5)\\\n├── holdem_gui/           # Web-bas\"],[0,\"ed\"],[-1,\",\"],[0,\" s\"],[-1,\"uperseded by V4): V2 + F1/F4/F7 fixes, exhaustive equity, 80 sweepable thresholds\\\n- **V4** (current production): V3 decision logic + MC multi-way equity, 82 thresholds (incl. mc_samples/mc_seed)\"],[1,\"weep tool\\\n├── live_server/          # Axum gateway for live play\\\n├── poker_protocol/       # Wire types (BotAction, TableEvent)\\\n├── hand_replay/          # Replay engine + regression tests\\\n├── configs/bots/         # Bot configuration files\\\n├── scripts/              # Sweep/tournament scripts\\\n└── profiles/             # Persisted opponent profiles (gitignored)\\\n```\"]],\"start1\":3285,\"start2\":3285,\"length1\":530,\"length2\":965}]"
metadata_diff: {"new":{},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2026-06-28T05:27:39.218Z
created_time: 2026-06-28T05:27:39.218Z
type_: 13