In this note
  1. 01Scoring Pipeline
  2. 02Hand Evaluation
  3. 03Joker Effects
  4. 04Knowledge Points
  5. 05Takeaway

Balatro Rust is a command-line scoring engine. It reads round input, works out the hand that was played, applies card effects and joker modifiers, and prints the final score as chips times multiplier.

The part that needs care is deterministic rule composition. A hand can trigger several effects at once, so the engine needs one fixed order of operations.

Scoring Pipeline

Scoring runs in stages. The engine evaluates the base poker hand first. Played cards then add chips and their own effects, held cards add theirs, and independent joker and edition effects adjust the result last.

Each effect family has a fixed place in that order, which is what makes the system testable.

Hand Evaluation

The hand detector checks strong hands before weak ones. It also supports variant modifiers: altered straight detection, smeared suits, and shortcut-style rules.

Check order decides which category applies. When a hand matches more than one category, the engine has to pick the highest-priority one, and it has to pick the same one every time.

Joker Effects

Jokers are grouped by when they apply: scored-card effects, held-card effects, independent effects, and edition effects. The project handles blueprint-like behavior by normalizing copied joker effects before final scoring.

Splitting the effects this way keeps one large scoring problem from turning into a single unreadable function.

Knowledge Points

  • Rust fits deterministic engines well: enums, structs, and pattern matching keep state explicit.
  • Structured input such as YAML makes CLI test cases easy to write and replay.
  • Rule order matters in a game engine because more than one rule can match the same state.
  • Splitting effects by when they fire cuts down on accidental interactions between card effects.
  • Floating-point arithmetic is worth avoiding when the output needs exact floor-based scoring.
  • Complex game logic is easier to work with when it lives in small modules grouped by responsibility.
  • Scoring engines are easier to test when they are built from pure transformations wherever possible.

Takeaway

The repo turns a rule-heavy game into a staged evaluation system. The engineering lesson is to make timing and priority explicit.