{
  "schemaVersion": 1,
  "slug": "poker-odds-calculator",
  "category": "gaming",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "29b96b482f5f52531ea93dfbedc4d45a3ebf62bac96c4fbc5a9f6a8be1c1d987",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/poker-odds-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "p1 = o ÷ n; p2 = 1 − (n−o) ÷ n × (n−o−1) ÷ (n−1); pot% = C ÷ (P + C) × 100",
    "vars": [
      [
        "p1",
        "Hit on next card"
      ],
      [
        "o",
        "Outs"
      ],
      [
        "n",
        "Unseen cards"
      ],
      [
        "p2",
        "Hit by the river"
      ],
      [
        "pot%",
        "Pot odds (%)"
      ],
      [
        "C, P",
        "Call amount C and current pot P"
      ]
    ],
    "note": "Turn probability = outs / unseen cards; flop-to-river chance uses two draws without replacement. Pot odds = call / (pot + call). Outs and unseen-card counts must be whole numbers with outs ≤ unseen cards. This compares draw completion only, not winning equity."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "OpenStax — Probability and combinations",
        "url": "https://openstax.org/books/introductory-statistics-2e/pages/3-introduction"
      }
    ],
    "referenceRole": "definition",
    "implementationHash": "29b96b482f5f52531ea93dfbedc4d45a3ebf62bac96c4fbc5a9f6a8be1c1d987",
    "basis": "p1 = o ÷ n; p2 = 1 − (n−o) ÷ n × (n−o−1) ÷ (n−1); pot% = C ÷ (P + C) × 100",
    "limitations": "The references explain definitions and methods; any extra preset must be checked against the assumptions on this page."
  },
  "contract": {
    "compute": "if(!Number.isInteger(outs)||!Number.isInteger(unseenCards)||outs<0||unseenCards<2||outs>unseenCards)return{turnOdds:null,byRiverOdds:null,ruleOfThumb:null,potOdds:null,callIsProfitable:null,oddsAgainst:null,__error:'inputError'};const n=unseenCards,o=outs,one=o/n,two=1-((n-o)/n)*((n-o-1)/(n-1)),pct=street==='flop'?two:one,potOdds=(potSize+callAmount)>0?callAmount/(potSize+callAmount)*100:0,rule=street==='flop'?o*4:o*2,against=pct>0?(100-pct)/pct:0;return{turnOdds:one*100,byRiverOdds:two*100,ruleOfThumb:rule,potOdds,callIsProfitable:pct>potOdds?'Draw chance exceeds pot odds (simplified)':'Pot odds exceed draw chance (simplified)',oddsAgainst:Math.round(against)+' to 1'};",
    "inputs": [
      {
        "name": "outs",
        "type": "number",
        "default": 9,
        "min": 0,
        "max": 46,
        "step": 1,
        "slider": true
      },
      {
        "name": "unseenCards",
        "type": "number",
        "default": 47,
        "min": 2,
        "max": 52,
        "step": 1,
        "slider": true
      },
      {
        "name": "potSize",
        "type": "number",
        "default": 100,
        "min": 0,
        "max": 10000000,
        "step": 1
      },
      {
        "name": "callAmount",
        "type": "number",
        "default": 20,
        "min": 0,
        "max": 1000000,
        "step": 1
      },
      {
        "name": "street",
        "type": "select",
        "default": "flop",
        "options": [
          {
            "value": "flop"
          },
          {
            "value": "turn"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "turnOdds",
        "precision": 2,
        "unit": "%"
      },
      {
        "name": "byRiverOdds",
        "precision": 2,
        "unit": "%"
      },
      {
        "name": "ruleOfThumb",
        "precision": 0,
        "unit": "%"
      },
      {
        "name": "potOdds",
        "precision": 2,
        "unit": "%"
      },
      {
        "name": "callIsProfitable",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "oddsAgainst",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
