♠ Chaos Blackjack Wiki
中文

Agent players

Bots and LLM agents play through one-shot shell commands. The run is saved to a state file between calls, and every reply is JSON (observation schema 3).

python -m chaos_blackjack.agent new --seed 7 --chaos
python -m chaos_blackjack.agent --brief bet 10
python -m chaos_blackjack.agent --brief act hit

The loop

  1. Read obs.hint and obs.legal_actions.
  2. Send exactly one legal action.
  3. Read events (what just happened) and the new obs.
  4. Repeat until obs.phase is run_over.

Observations contain only what a player at the table can see. Do not decode the state file.

Commands

CommandMeaning
actact in your turn
betplace a bet
buybuy a shop item (betting phase)
canceldrop the pending question when it allows it
chooseanswer the pending question (obs.choice)
helplist game commands
newstart a new run (overwrites the run file)
observeshow the current observation
performrun one of the table's own actions (obs.table_actions)
playstreaming JSON-lines mode on stdin/stdout
rerollroll the shop's stock again (betting phase, once per stock)

Actions

ActionMeaning
betstart the round: bet <amount>
buybuy a shop offer before betting: buy <item_id> (see obs.shop; some ask obs.choice next)
canceldrop the pending question; nothing is charged or spent
chooseanswer the pending question: choose <option id> (see obs.choice)
doubledouble the bet, take exactly one card, then stand
hittake one more card
performrun one of obs.table_actions: perform <action> [arg]
rerollroll the shop's stock again (obs.shop.reroll_price chips)
standend your turn; the dealer plays
surrendergive up the hand and get part of the bet back
use_itemuse an item whose usable is true: act use_item <item_id> [--target <id>]

Errors

A rejected command changes nothing; read error.legal_actions and retry.

Error codeMeaning
illegal_actionNot allowed right now (wrong phase, bet out of range, item you don't own).
invalid_argumentMissing or malformed argument.
invalid_jsonStreaming mode: the line is not valid JSON.
run_overThe run has ended; start a new one.
step_limitThe step limit was reached; start a new run.
unknown_commandUnknown command.
usageNo or invalid run file, or bad command-line usage (exit code 2).

A recorded run

This run is replayed on every wiki update with seed 7, chaos on, a flat bet and a "hit below 17" policy. If the game changes, this table changes with it.

python -m chaos_blackjack.agent new --seed 7 --chaos

StepYou sendEventsTable after
1bet 10Round 1 started, bet 10Round 1. Bankroll 100/300. Bet 10. You: 8♣ 3♥ = 11. Dealer: K♣ ?? = ?.
2act hitYou draw: QRound 1. Bankroll 100/300. Bet 10. You: 8♣ 3♥ Q♥ = 21. Dealer: K♣ ?? = ?.
3act standDealer draws: 8
Dealer busts.
Round 2. Bankroll 110/300. Shop: swap 1, hole_card_hacker 2, danger_radar 3 (restocks in 1 round; reroll 3).
player +10
4bet 10Round 2 started, bet 10
⚡ Chaos effect applied: Odd Even Chaos
Round 2. Bankroll 110/300. Bet 10. You: 6♥ Q♦ = 18. Dealer: A♦ ?? = ?. Active chaos rules: Odd-Even Chaos: 2/4/6/8 +2, 3/5/7/9 -1; A/10/J/Q/K unchanged (until cleared).
5act standDealer stands at 17.
The shop has new stock.
Round 3. Bankroll 120/300. Shop: hole_card_hacker 2, peek 2, shield 4 (restocks in 2 rounds; reroll 3).
player +10
6bet 10Round 3 started, bet 10
⚡ Chaos effect applied: Fragile Bust
Round 3. Bankroll 120/300. Bet 10. You: J♠ 4♠ = 14. Dealer: K♥ ?? = ?. Active chaos rules: Fragile Table: bust threshold reduced to 19 (instead of 21).
7act hitYou draw: 5Round 3. Bankroll 120/300. Bet 10. You: J♠ 4♠ 5♠ = 19. Dealer: K♥ ?? = ?. Active chaos rules: Fragile Table: bust threshold reduced to 19 (instead of 21).
8act standDealer stands at 18.Round 4. Bankroll 130/300. Shop: hole_card_hacker 2, peek 2, shield 4 (restocks in 1 round; reroll 3).
player +10

The full guide (observation fields, streaming mode, Python API) is docs/AGENT_GUIDE.md in the game repository.

Current Table modes

Use python -m chaos_blackjack.agent new --mode chaos --seed 7 for Poker Head builds, or --mode j54 for J-54's Table. At J-54 the firmware pick and the Cut target arrive as obs.choice (kinds firmware and cut_target), the deck operations as obs.table_actions (perform j54_cut <group>, perform j54_hot_purge, perform j54_release), and obs.table.public carries compute, the condition, the Joker's state, the meter, the heat map and the bounty. Read obs.choice.options and answer with choose <option> before other moves. Product use may require --target ID; table actions use perform <action> [arg]. obs.table.public exposes build, cash, invested principal, debt, net assets and contracts without private card order or stock outcomes. Legacy --chaos remains a different compatibility path.

Describes origin/main @ 108b5e1 (2026-10-17) · game v0.2.0