logo

Babylon.js Market

PokerAIBill

tabletop-casino · poker-ai

PokerAIBill

Listens toPokerBetting
Talks toPokerBetting
1
Tight Bill the Card SharkBonus figureTight Bill the Card Shark
Unlock

Install with the CLI:

bjs download PokerAIBill

PokerAIBill

Bill — the tight, pot-odds NPC. He folds the junk, plays the premium hands hard, and post-flop calls only when the price is right.

What it does

PokerAIBill is one poker personality, laid over the shared PokerAI substrate. The decision (decideBill) splits across the two streets.

Pre-flop, with no board to read, it reads the starting-hand tier from classifyStartingHand:

  • premium (QQ+, AKs) → raise.
  • strong (JJ, TT, AKo) → mostly call, raise ~20% of the time.
  • moderate → check when it's free, otherwise call.
  • weak / trash → take a free check if one is offered, otherwise fold.

Post-flop it weighs made-hand equity (estimateEquity) against the pot odds (potOdds):

  • FullHouse+ (equity ≥ 0.90) → always raise/bet.
  • Trips / straight / flush (equity ≥ 0.65) → mix raises and calls.
  • Two pair (≥ 0.50) and one pair (≥ 0.30) → call when the odds beat the equity, otherwise fold; free action gets a check.
  • High card (< 0.30) → check for free, fold to a bet.

Each decision writes a reasoning object back onto the context — the hand string, the tier or equity/odds, and short notes like monster, odds ok, odds bad, free check — so a HUD can show why Bill acted.

The decision is deterministic against its inputs. The one source of randomness is the post-flop weighted mix; decideBill takes its generator as the rng parameter, defaulting to Math.random. The exported bill callback is a drop-in NpcStrategy and uses the default Math.random; call decideBill directly when a test or a seeded host needs to pin the draw.

PokerAIBillSystem carries the personality over the bus: it listens for the betting director's poker.actionRequired menu, plays the seats it owns, and emits poker.turnAction with Bill's pick.

Use it in a scene

A scene is just data — a list of entities, each with its components. At startup the SceneLoader turns this JSON into a live world; edit the file and reload to rebuild it.

Fastest path

bjs download scene PokerAIBill

Pulls this exact scene into your project and runs it — no copy-paste. Add --all to grab the components and assets it needs too.

Or build it from scratch with the bjs CLI:

  1. 1Scaffold a project
    npm create @babylonjsmarket/arcade@latest my-game

    World, renderer, and dev server — ready to run.

  2. 2Install dependencies
    cd my-game && npm install
  3. 3Add PokerAIBill
    bjs download PokerAIBill

    Copies its source into src/ so the scene resolves.

    First time? Run bjs login once.

  4. 4Paste the scene into src/scenes/arcade-room.ts and run
    npm run dev

    SceneLoader builds the world from the JSON; reload to rebuild.

JSON
{
  "Bill": {
    "components": {
      "PokerAIBill": {
        "seatIds": ["npc0", "npc1"]
      }
    }
  }
}

The example scene pairs it with PokerHandEval and PokerBetting: the director offers a menu on poker.actionRequired, Bill answers with poker.turnAction, the director applies the chip effect. Or use the strategy directly without the System:

TypeScript
import { bill, decideBill } from './PokerAIBill'

table.setStrategies(new Map([['npc0', bill], ['npc1', bill]]))

// Or pin the post-flop draw in a test:
const action = decideBill(available, ctx, () => 0)

Props

PropTypeDefaultMeaning
seatIdsstring[][]Seats Bill plays. Empty means he answers for every NPC seat offered a menu.

Events

DirectionNameConstPayload
inpoker.actionRequiredPokerAIBillInputEvents.ACTION_REQUIRED{ playerId, actions, context? }
outpoker.turnActionPokerAIBillEvents.TURN_ACTION{ playerId, action }

poker.turnAction is the same name PokerBetting accepts as a human's raw action, so the director applies Bill's pick exactly as it would a HUD click. With no context on the menu, decideBill falls back to a random legal action (through the injected rng); with one, it runs the full pre-flop / post-flop policy.

Dependencies

  • PokerAI — supplies estimateEquity, potOdds, classifyStartingHand, pickAction, weightedPick, and shortHand, plus the re-exported ActionType / NpcContext / NpcStrategy.
  • PokerBetting — the betting director Bill registers with as an NpcStrategy (via setStrategies) and answers over the bus.
  • PokerHandEval — the underlying evaluator equity reads through PokerAI.

Notes

  • One Bill per scene: the System routes a menu into the first entity carrying a PokerAIBill instance.
  • The strategy signature has no rng slot, so the exported bill uses Math.random; the System exposes its own rng field, and decideBill takes one as an argument — set either to pin the post-flop mixes.
  • The reasoning object mutates the context passed in; pass a fresh context per turn if a HUD reads it back.
  • Equity bands map directly to made-hand ranks (equityForRank in PokerAI): the cutoffs here — 0.90, 0.65, 0.50, 0.30 — are FullHouse, trips, two pair, one pair. Retune the bands by editing those thresholds, not the evaluator.

More like this

PokerAI
PokerBetting
PokerHandEval
AIGoalSeek
AIKick
AIZone
AiPilot
BallPossession
BallPursuit
CardFan
DeckDealer
Enemy
EnemySpawner
FreighterChain
LineOfSight
PokerAICali
PokerAIRandy
PokerAIShark
PokerAISurge
PokerAITilt
PokerHUD
PokerInput
PokerMultiplayer
PokerSeating
PokerTableCards
PokerTableDirector
TurnPacer
WaveDirector

Was this page helpful?

We read every note — tell us what's working and what isn't.

↑↓ NavigateEnter SelectEsc CloseCtrl+K Open Search