React / probability / deck building

HandForge

A local probability workbench I built for a friend who wanted a clearer way to reason about deck-building choices. Instead of guessing whether a ratio change was worth the slot, he could paste a deck, tag cards into meaningful groups, define the question he cared about, and see whether the odds actually moved.

View repo

What it does

  • Parses pasted deck lists and combines duplicate card names into a normalized deck.
  • Lets users tag cards as starters, resources, search, draw, combo pieces, dead cards, or custom groups.
  • Supports generic card-game rules and a Pokemon TCG preset with opening hands, prize cards, and valid-hand rules.
  • Builds target questions visually: zone, card or tag, operator, count, and AND/OR logic.
  • Compares Deck A and Deck B with percentage-point deltas and practical interpretation.

Engine shape

The app uses exact probability where the target can be modeled cleanly, then falls back to seeded Monte Carlo simulation for more complex scenarios. The seed makes simulation runs reproducible, and heavier calculations run through a worker so the interface can stay responsive while the deck changes.

  • Exact probability and hypergeometric calculations for target conditions.
  • Seeded simulation with configurable sample counts.
  • Distribution, flow-stage, comparison, and sensitivity charts.
  • Local persistence for decks, targets, and ruleset settings.

Why it belongs

HandForge started as a favor for a friend, which is part of why it works as a portfolio piece. It was not built around a vague product thesis; it was built around one person trying to make better calls while tuning a deck. That constraint kept the app honest: take a real decision, turn the hidden math into a usable interface, and make the result inspectable enough that a player can trust it without becoming the probability engine.

User flow

  • Choose the ruleset before judging the hand.
  • Edit Deck A directly, or paste a count-plus-name deck list.
  • Use tags to turn card names into probability groups.
  • Define the target without writing a formula.
  • Use Deck B to test whether a ratio change is worth the slot.

Build notes

  • React and TypeScript application with Recharts visualizations.
  • Vitest coverage for parsing, validation, probability, comparison, and simulation behavior.
  • Playwright coverage for onboarding and the main analysis workflow.
  • Designed as a local workbench: fast to run, easy to inspect, and intentionally focused.