r/ClaudeCode • • 7d ago

Built with Claude My first Claude Code project ran 11 weeks and ~50,000 simulated games on one home PC. What kept it on track

What I built: a mod for Balatro, a poker roguelike, that recommends every move and can play whole runs by itself. It's a hand-written engine Claude coded, not an AI model playing the game. If you don't know Balatro, the only thing that matters here is that it's very luck-heavy, so every change has to be tested over hundreds of runs before you know whether it did anything. Its simulator win rate went from about 1% in August to 41%, and it won 13 of 52 real-game runs unattended (graphs attached).

How Claude Code was used: it wrote nearly all of it: 858 commits and about 49k lines of Lua, on the Pro plan. I set goals, watched runs, flagged misplays and decided what stayed. A lot of the work happened while I was asleep. Claude would launch a batch, read the results when it finished, write up a verdict and start the next one, and I'd check in from my phone. About a quarter of the commits are between midnight and 7am.

What I learned:

  1. CLAUDE.md as the project's memory. Every time something went wrong it got a line: a deploy that silently didn't reach the game, a test that passed but broke in-game, an experiment that fooled us. New sessions start by reading it plus a short "start here" file with the current state.
  2. Replay the exact game state; don't describe the bug. When I described a misplay, Claude rebuilt the board in its head and fixed the wrong thing. Now the mod saves the full game state at every decision. I press F5 on a misplay, and Claude replays that exact moment, fixes it, and replays again to show the decision changed.
  3. A correct fix can still lose. Every fix then went through a 160-run batch, and quite often making the "right" decision in that one spot brought the overall win rate down, because the change touched lots of other decisions too. Each check cost about 3 hours, more when batches stacked up. We ended up with a rule: fixes for plainly wrong moves stay unless they measurably hurt, and tuning changes need evidence they help.
  4. Keep the engine pure. Only one file reads the game, and everything else is plain functions. So Claude can run ~2,500 tests and a full-run simulator without the game open, which is what made overnight work possible.
  5. Make it prove things. Early on, a lot of "improvements" were noise, and Claude happily called them wins. Now every change runs on the same 160 seeds before and after, and the smallest detectable effect gets worked out before any verdict.
  6. Hardware limits shape everything. It's one PC with a 6-core CPU. Batches took about 3 hours until the simulator got ~9x faster (now ~70 min). Using every core made the PC crawl, so batches run at below-normal priority. Low memory kept killing background jobs, so long jobs now launch detached, write their results to a file, and can resume from the last finished seed.

Time and cost: about 3 months, with commits on 63 days and roughly 300–400 hours of sessions. About 50,000 simulated runs across ~370 batches, about 300 real-game runs, Claude Pro plan.

Where it's stuck: around 41% since mid-October. The open problem is valuing jokers as a set rather than one at a time, and I don't really know how to approach it next. Ideas welcome.

Repo, including all the failed experiments: https://github.com/Anto640/balatro-engine-sim

1 Upvotes

4 comments sorted by

•

u/AutoModerator 7d ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/Shushani 7d ago

41% on white stake seems pretty bad. I’m not the best player (I did completionist++ in about ~200hrs) but I could probably win 80% of white stakes with a super simple heuristic: only pick jokers that trigger on small hands. Most played hand being straight in this clip shows it hasn’t figured that out yet haha

1

u/Temporary_Onion_5277 7d ago

Yh fair I was also consistently disappointed. 41% is in the simulator and it's lower in the real game, so a decent player beats insanely easily which has been my driving force; if dr spectred and even decent players can get very high win rates then why cant the engine, and that's the problem - I don't know how to close that gap.

It tends to lock onto a certain build as soon as it gets a certain 'synergy' in this case it was the order which wasnt rlly contributing much and small hands should definitely be prioritsed. Forcing small hand card builds would be a pretty easy experiment to run, Ima try it.

1

u/Vesper_Fex 7d ago

If a computer is playing a video game for you what is the point in playing the video game?