How daz029/balatro-strategy works
Jackdaw is a Balatro simulator and reinforcement-learning environment. The principal workflow is an agent observing a game state, choosing a legal action through an environment adapter, and receiving the resulting state and reward as the engine advances the run. The repository also supports separate hand-play and shop-agent training, hand-solving and behavior cloning, and decision review via slideshow prototypes. Edges reflect README descriptions or SOURCE INDEX references; unsampled implementation details are not inferred.
Main entry points: game.py Game step engine · balatro_env.py Run environment · hand_play_gym.py Hand-play environment · hand_policy_v3.py Hand policies
Components 23
Environments
- Run environment
jackdaw/env/balatro_env.py - Hand-play environment
jackdaw/env/hand_play_gym.py - Shop environment
jackdaw/env/shop_gym.py - State encoding
jackdaw/env/observation.py - Legal actions
jackdaw/env/action_space.py - Hand-play adapter
jackdaw/env/hand_play_adapter.py
Agents
- Hand policies
jackdaw/agents/hand_policy_v3.py - Pointer policy head
jackdaw/agents/hand_pointer_head.py - Shop policy
jackdaw/agents/shop_policy.py - Hand solver
scripts/hand_solver.py
Game engine
- Game step engine
jackdaw/engine/game.py - Actions and phases
jackdaw/engine/actions.py - Hand evaluation and scoring
jackdaw/engine/hand_eval.py - Joker effects
jackdaw/engine/jokers.py - Consumable effects
jackdaw/engine/consumables.py - Run initialization
jackdaw/engine/run_init.py - Shop operations
jackdaw/engine/shop.py
Bridge and scenarios
- Balatrobot adapter
jackdaw/bridge/balatrobot_adapter.py - Scenario definitions
jackdaw/cli/scenarios
Decision review
- Hand decision viewer
prototypes/hand-slideshow/app.js - Shop decision viewer
prototypes/shop-slideshow-prototype/app.js - Decision export
scripts/export_shop_decisions_csv.py
Other components
- Agent or user
Connections 23
- Agent or user → Run environment: submits actions
- Run environment → State encoding: encodes state
jackdaw/env/observation.py - Run environment → Legal actions: gets legal actions
jackdaw/env/action_space.py - Run environment → Game step engine: advances game
- Hand-play environment → Hand-play adapter: uses adapter
jackdaw/env/hand_play_gym.py - Hand-play environment → State encoding: encodes state
jackdaw/env/hand_play_gym.py - Hand-play environment → Game step engine: steps engine
- Shop environment → Game step engine: steps engine
- Hand policies → State encoding: consumes
jackdaw/agents/hand_policy_v3.py - Pointer policy head → Hand policies: uses policy
jackdaw/agents/hand_pointer_head.py - Hand policies → Hand-play environment: trains in
- Shop policy → Shop environment: trains in
- Hand solver → Hand policies: supplies solved data
- Game step engine → Actions and phases: validates actions
jackdaw/engine/game.py - Game step engine → Hand evaluation and scoring: scores hands
jackdaw/engine/game.py - Game step engine → Joker effects: dispatches effects
jackdaw/engine/game.py - Game step engine → Consumable effects: uses effects
jackdaw/engine/game.py - Game step engine → Run initialization: initializes runs
jackdaw/engine/game.py - Game step engine → Shop operations: uses shop logic
jackdaw/engine/game.py - Balatrobot adapter → Actions and phases: adapts actions
jackdaw/bridge/balatrobot_adapter.py - Scenario definitions → Game step engine: configures scenarios
- Decision export → Hand decision viewer: feeds decisions
- Decision export → Shop decision viewer: feeds decisions