id: 746b05a33ec346709854d9c8cbbd3558
parent_id: 
item_type: 1
item_id: fd14e517692c4f2e88dfecb2c8625e8f
item_updated_time: 1780224890073
title_diff: "[{\"diffs\":[[1,\"Porting Plan — Java Supersonic → Rust holdem_bots\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":49}]"
body_diff: "[{\"diffs\":[[1,\"Comprehensive porting plan covering recommended bots, folder structure,\\\nTOML-based assembly, implementation phases, and dependency graph.\\\n\\\n---\\\n\\\n## Part A: Strategy Components per Game Type — All Generations\\\n\\\n### A.1 Multi-Generation Strategy Matrix\\\n\\\nEach game type needs **at least one strategy component from every applicable generation**.\\\nThis enables cross-generational simulation testing (e.g., Gen 4 vs Gen 1, Gen 3 vs Gen 2).\\\n\\\n| Game Type | Gen 1 (Static) | Gen 2 (Mathematical) | Gen 3 (Nash/ICM) | Gen 4 (Opponent Modelling) |\\\n|-----------|---------------|---------------------|-------------------|---------------------------|\\\n| Cash NL 10-max | `BigStackBot` + `ShortStackBot` (already ported) | `RingNLStrategyV1` (EHS postflop) | N/A for cash | N/A for cash |\\\n| Cash NL 6-max | `BigStackBot` + `ShortStackBot` (same, adjusted thresholds) | `RingNLStrategyV1` (looser ranges) | N/A | N/A |\\\n| Cash FL 10-max | N/A (no static FL bot exists) | `RingFLStrategyV1` | N/A for cash | N/A for cash |\\\n| Cash FL 6-max | N/A | `RingFLStrategyV1` (looser ranges) | N/A | N/A |\\\n| SNG NL 10-max | `SimpleBot` / `KillSimple` (test baselines) | `PostFlopEHSStrategy` (PSim) | `ModNashICMv7` + `PushOrFold` | `CustomModNGV2` |\\\n| SNG NL 6-max | Same baselines | `PostFlopEHSStrategy` | `ModNashICMv7_6max` | `CustomModNGV2` (6-max) |\\\n| MTT NL | `SimpleBot` baseline | `PostFlopEHSStrategy` | `ModNashICMv7` + `PushOrFold` | `CustomModNGV2` |\\\n| HU NL | `AlwaysCall`/`AlwaysFold` (baselines) | `PostFlopEHSStrategy` (HU mode) | `KEHU20BBNeqV3` + `EGHUPreFlopV8` | `NGHUPostFlopStrategyV2` |\\\n\\\n### A.2 Generation Purpose\\\n\\\n| Generation | Role | Use Case |\\\n|-----------|------|----------|\\\n| **Gen 1 (Static)** | Baseline opponent | Simple, predictable play. Good for measuring minimum bot quality. Also useful as \\\"fish\\\" opponents. |\\\n| **Gen 2 (Mathematical)** | Intermediate test | EHS-based decisions with `HandPotential`. Tests whether a bot can beat mathematically sound play. |\\\n| **Gen 3 (Nash/ICM)** | Advanced bot | Game-theoretic optimal play in endgame situations. The benchmark for tournament strategies. |\\\n| **Gen 4 (Opponent Modelling)** | Best overall | Adapts to opponents in real-time. Should beat all prior generations by exploiting tendencies. |\\\n\\\n### A.3 Current Capability Matrix\\\n\\\n| Game Type | Gen 1 (Static) | Gen 2 (EHS) | Gen 3 (Nash/ICM) | Gen 4 (OppModel) |\\\n|-----------|:-:|:-:|:-:|:-:|\\\n| Cash NL 10-max | ✅ Ported | ❌ Not ported | N/A | N/A |\\\n| Cash NL 6-max | ✅ Ported | ❌ Not ported | N/A | N/A |\\\n| Cash FL 10-max | N/A | ❌ Not ported | N/A | N/A |\\\n| Cash FL 6-max | N/A | ❌ Not ported | N/A | N/A |\\\n| SNG NL 10-max | ❌ Not ported | ❌ Not ported | ❌ Not ported | ❌ Not ported |\\\n| SNG NL 6-max | ❌ Not ported | ❌ Not ported | ❌ Not ported | ❌ Not ported |\\\n| MTT NL | ❌ Not ported | ❌ Not ported | ❌ Not ported | ❌ Not ported |\\\n| HU NL | ❌ Not ported | ❌ Not ported | ❌ Not ported | ❌ Not ported |\\\n\\\n---\\\n\\\n## Part B: Proposed Folder Structure\\\n\\\n### B.1 Source Code Structure\\\n\\\n```\\\nholdem_bots/src/\\\n├── lib.rs                          # Crate root — registers all bot types\\\n├── strategy_bot.rs                 # StrategyBot adapter (HoldemPlayer → Strategy)\\\n│\\\n├── common/                         # Framework utilities (EXISTING)\\\n│   ├── mod.rs                      #   Re-exports: Strategy, ModularStrategy, etc.\\\n│   ├── modular.rs                  #   Strategy trait, ModularStrategy, VotingMode\\\n│   ├── context.rs                  #   StrategyContext — game state snapshot\\\n│   ├── action_recorder.rs          #   ActionRecorder — per-hand action history\\\n│   ├── hand_analyzer.rs            #   HandAnalyzer — hand evaluation utilities\\\n│   ├── hand_helper.rs              #   HandHelper — board texture, hand categorization\\\n│   └── hand_potential.rs           #   HandPotential — ppot/npot/nutpot/rpot/EHS\\\n│\\\n├── cash/                           # Cash game strategies (EXISTING, needs expansion)\\\n│   ├── mod.rs                      #   Re-exports: BigStackBot, ShortStackBot, etc.\\\n│   ├── big_stack.rs                #   BigStackBot (Gen 1, stack > 25 BB)\\\n│   ├── big_stack_preflop.rs        #   BigStackPreFlop — hand grouping preflop\\\n│   ├── short_stack.rs             #   ShortStackBot (Gen 1, stack ≤ 25 BB)\\\n│   ├── short_stack_preflop.rs      #   ShortStackPreFlop — push/fold preflop\\\n│   ├── postflop.rs                 #   PostFlopStrategy — shared postflop (needs EHS upgrade)\\\n│   ├── nl.rs                       #   [NEW] RingNLCash — Gen 2 EHS-based NL cash bot\\\n│   ├── fl.rs                       #   [NEW] RingFLCash — Gen 2 FL cash bot\\\n│   └── thresholds.rs               #   [NEW] Cash threshold configuration structs\\\n│\\\n├── sng/                            # [NEW] SNG strategies\\\n│   ├── mod.rs                      #   Re-exports: SngBot, etc.\\\n│   ├── bot.rs                      #   SngBot — composition root for SNG\\\n│   ├── preflop.rs                  #   SNG-specific preflop (ICM-aware ranges)\\\n│   ├── postflop.rs                 #   SNG-specific postflop (ICM-adjusted EHS)\\\n│   └── push_fold.rs                #   Push/fold chart strategy\\\n│\\\n├── mtt/                            # [NEW] MTT strategies\\\n│   ├── mod.rs                      #   Re-exports: MttBot, etc.\\\n│   ├── bot.rs                      #   MttBot — composition root for MTT\\\n│   ├── preflop.rs                  #   MTT-specific preflop (bubble-aware)\\\n│   └── postflop.rs                 #   MTT-specific postflop\\\n│\\\n├── hu/                             # [NEW] Heads-up strategies\\\n│   ├── mod.rs                      #   Re-exports: HuBot, etc.\\\n│   ├── bot.rs                      #   HuBot — composition root for HU\\\n│   ├── nash_tables.rs              #   Precomputed Nash equilibrium tables (20BB/15BB)\\\n│   ├── preflop.rs                  #   HU preflop (Nash + profiling)\\\n│   └── postflop.rs                 #   HU postflop (simplified, aggressive)\\\n│\\\n├── nash/                           # [NEW] Nash equilibrium solver\\\n│   ├── mod.rs                      #   Re-exports: NashSolver, etc.\\\n│   ├── solver.rs                   #   Iterative best-response Nash solver\\\n│   └── push_fold_range.rs          #   Push/fold range computation\\\n│\\\n├── icm/                            # [NEW] ICM equity calculator\\\n│   ├── mod.rs                      #   Re-exports: IcmCalculator, etc.\\\n│   ├── calculator.rs               #   ICM equity computation (recursive)\\\n│   └── bubble_factor.rs            #   Bubble factor calculation\\\n│\\\n├── opponent/                       # [NEW] Opponent modelling\\\n│   ├── mod.rs                      #   Re-exports: PlayerModel, RangePredictor, etc.\\\n│   ├── player_model.rs             #   In-memory opponent statistics tracker\\\n│   ├── stats.rs                    #   OpponentStats struct (VPIP, PFR, AF, etc.)\\\n│   ├── range_predictor.rs          #   Opponent range prediction from actions\\\n│   └── hand_range.rs               #   Weighted hand range representation\\\n│\\\n├── deception/                      # [NEW] Bluff and lure modules\\\n│   ├── mod.rs                      #   Re-exports\\\n│   ├── bluff.rs                    #   Semi-bluff, continuation bluff\\\n│   └── lure.rs                     #   Trap/slowplay, induce bets\\\n│\\\n├── assembly/                       # [NEW] TOML-driven strategy assembly\\\n│   ├── mod.rs                      #   Re-exports: StrategyFactory, etc.\\\n│   ├── factory.rs                  #   StrategyFactory — reads TOML, assembles ModularStrategy\\\n│   ├── registry.rs                 #   StrategyRegistry — maps type names → constructors\\\n│   └── config.rs                   #   Config structs (BotConfig, StrategyConfig, etc.)\\\n│\\\n├── baseline/                       # [NEW] Baseline/test opponents (Gen 1)\\\n│   ├── mod.rs                      #   Re-exports\\\n│   ├── simple_bot.rs               #   SimpleBot — basic ABC poker\\\n│   ├── kill_simple.rs              #   KillSimple — slightly smarter baseline\\\n│   ├── always_call.rs              #   AlwaysCall — calls every bet\\\n│   └── always_fold.rs              #   AlwaysFold — folds every hand (except free checks)\\\n│\\\n└── data/                           # [NEW] Embedded data files\\\n    ├── mod.rs                      #   Re-exports\\\n    ├── hu_nash_20bb.rs             #   include_str!(\\\"../../configs/data/hu_nash_20bb.csv\\\")\\\n    ├── hu_nash_15bb.rs             #   include_str!(\\\"../../configs/data/hu_nash_15bb.csv\\\")\\\n    └── push_fold_charts.rs         #   Compiled push/fold chart data\\\n```\\\n\\\n### B.2 Configuration File Structure\\\n\\\n```\\\nconfigs/\\\n├── bots/                           # Bot assembly configurations\\\n├── strategies/                     # Strategy component configurations\\\n├── thresholds/                     # Threshold configuration files\\\n└── data/                           # Precomputed data files\\\n```\\\n\\\n---\\\n\\\n## Part C: TOML-Based Strategy Assembly Design\\\n\\\n### C.1 Bot Assembly Config Schema (`configs/bots/*.toml`)\\\n\\\n```toml\\\n[bot]\\\nname = \\\"sng_gen3_nash\\\"\\\ndescription = \\\"SNG bot with Nash/ICM endgame (Gen 3)\\\"\\\nvoting_mode = \\\"first_applicable\\\"\\\ngame_type_filter = \\\"sng\\\"\\\ntable_size = { min = 2, max = 10 }\\\n\\\n[[strategies]]\\\ntype = \\\"steal_from_inactive\\\"\\\nenabled = true\\\n\\\n[[strategies]]\\\ntype = \\\"fold_micro_stack\\\"\\\nconfig = { threshold_bb = 2.0 }\\\nenabled = true\\\n\\\n[[strategies]]\\\ntype = \\\"nash_icm\\\"\\\nconfig = \\\"configs/strategies/nash_icm.toml\\\"\\\nenabled = true\\\n```\\\n\\\n### C.2 Strategy Factory Architecture\\\n\\\nStrategyFactory → StrategyRegistry → lookup type name → constructor → ModularStrategy → StrategyBot\\\n\\\n### C.3 Rust Implementation Sketch\\\n\\\n```rust\\\n#[derive(Debug, Deserialize)]\\\npub struct BotConfig {\\\n    pub bot: BotInfo,\\\n    pub strategies: Vec<StrategyEntry>,\\\n}\\\n\\\n#[derive(Debug, Deserialize)]\\\npub struct StrategyEntry {\\\n    pub r#type: String,\\\n    pub config: Option<toml::Value>,\\\n    pub enabled: Option<bool>,\\\n}\\\n```\\\n\\\n---\\\n\\\n## Part D: Implementation Phases\\\n\\\n| Phase | Description | Effort | Dependencies |\\\n|-------|-------------|--------|-------------|\\\n| 1 | TOML Strategy Assembly Framework | 3–5 days | None |\\\n| 2 | Port Existing Cash to TOML | 2–3 days | Phase 1 |\\\n| 3 | Cash NL Gen 2 (EHS PostFlop) | 1–2 days | Phase 2 |\\\n| 4 | SNG Endgame — Nash/ICM (Gen 3) | 5–7 days | Phase 1, 3 |\\\n| 5 | HU Strategy (Gen 3) | 3–5 days | Phase 1 |\\\n| 6 | SNG/MTT Gen 1+2 Baselines | 2–3 days | Phase 3 |\\\n| 7 | FL Cash (Gen 2) | 2–3 days | Phase 3 |\\\n| 8 | Opponent Modelling (Gen 4) | 5–7 days | Phase 3 |\\\n| 9 | Full Composition Bots (Gen 4) | 7–10 days | All prior |\\\n\\\n**Critical path:** Phase 1 → 2 → 3 → 4 → 8 → 9\\\n\\\n**Parallel tracks after Phase 3:**\\\n- Track A: Phase 4 (SNG Nash/ICM) — on critical path\\\n- Track B: Phase 5 (HU Strategy) — can start after Phase 1\\\n- Track C: Phase 6 (SNG/MTT Baselines) — can start after Phase 3\\\n- Track D: Phase 7 (FL Cash) — can start after Phase 3\\\n- Track E: Phase 8 (Opponent Modelling) — can start after Phase 3\\\n- Phase 9 requires all prior phases\\\n\\\n---\\\n\\\n## Part E: Simulation Matrix\\\n\\\nCross-generational testing ensures each new generation is strictly better than the last.\\\n\\\n- **Cash NL:** Gen 2 should show statistically significant edge over Gen 1 over 10K+ hands\\\n- **SNG NL:** Each generation should beat previous by significant margin over 1K+ tournaments\\\n- **HU NL:** Gen 3 (Nash) beats Gen 2 (EHS) beats Gen 1 (always_call)\\\n- **Sanity checks:** Strategies should perform poorly outside their game type\\\n\\\n---\\\n\\\n## Appendix: Cargo.toml Dependencies\\\n\\\n```toml\\\n[dependencies]\\\nholdem_core = { path = \\\"../holdem_core\\\" }\\\nrand = \\\"0.8\\\"\\\nrayon = \\\"1.8\\\"\\\nserde = { version = \\\"1\\\", features = [\\\"derive\\\"] }   # NEW\\\ntoml = \\\"0.8\\\"           # NEW\\\ncsv = \\\"1.3\\\"            # NEW\\\n```\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":11457}]"
metadata_diff: {"new":{"id":"fd14e517692c4f2e88dfecb2c8625e8f","parent_id":"2c8da247905946c3aa19eb4936e16323","latitude":"0.00000000","longitude":"0.00000000","altitude":"0.0000","author":"","source_url":"","is_todo":0,"todo_due":0,"todo_completed":0,"source":"joplin-desktop","source_application":"net.cozic.joplin-desktop","application_data":"","order":1780223817205,"markup_language":1,"is_shared":0,"share_id":"","conflict_original_id":"","master_key_id":"","user_data":"","deleted_time":0},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2026-05-31T10:56:29.080Z
created_time: 2026-05-31T10:56:29.080Z
type_: 13