Over the past few weeks I built something I never thought I'd finish: a fully autonomous Mines bot for Rainbet that not only plays by itself, but uses Claude AI to tune its own strategy every 5 minutes based on live performance data.
This isn't a get-rich-quick story. It's a story about systems thinking, probability, and what happens when you let an AI manage another AI.
Rainbet Mines is simple on the surface. You have a 49-tile grid with a configurable number of hidden mines. You bet, pick a tile, and if it's safe you can either cash out or keep going. Hit a mine and you lose everything.
The key insight is this: the fewer tiles you reveal, the safer the bet. Revealing just 1 tile on a 10-mine board gives you a 79.6% win chance at 1.21x multiplier. That's your baseline β a slightly negative EV game with a house edge baked in.
So why build a bot? Because the edge isn't in a single bet. It's in the system around it.
The bot runs as a Chrome extension content script in MAIN world context, meaning it has full access to the page's JavaScript environment while also having access to Chrome extension APIs. All communication with the Claude API routes through a background service worker to avoid CORS restrictions.
The core loop is simple:
Place a bet on 10/49 mines (scales with balance from $0.10 to $1.00+)
Reveal 1 tile
Cash out immediately
Split the profit: 20% to bankroll, 20% to bonus pot, 60% to loss buffer
Repeat
That profit split is the heart of the system.
Every win quietly builds a loss buffer. When a loss happens, the buffer absorbs it first β the bankroll never even notices. This means a single loss in a 79.6% win-rate game is usually invisible.
The buffer only runs out after several consecutive losses. That's when the recovery chain kicks in.
When the buffer hits zero, the bot doesn't panic. It first runs 3 quick attempts on a 39/49 mine board (20.4% win chance, ~4.6x multiplier) before escalating. If any of those 3 hits, the streak is cleared and we're back to normal.
If all 3 fail, the recovery chain begins. Each tier is sized to recover all previous losses in a single win:
Loss 1 16 mines x1.43 67.3% win
Loss 2 20 mines x1.62 59.2% win β resets here if balance < $100
T3a 16 mines x1.43 67.3% win β resets here if balance < $400
T4 30 mines x2.48 38.8% win ($5 flat)
T5 35 mines x3.36 28.6% win ($5 flat)
T6 40 mines 18.4% win ($5 flat)
Hail 45 mines 8.2% win ($5 flat)
RESET β accept the loss, back to normal
Budget caps prevent the chain from going too deep relative to your balance:
Under $100 β resets after Loss 2 (max loss ~$4)
Under $400 β resets after T3a (max loss ~$14β$43)
Over $400 β full chain allowed
The bonus pot slowly fills with 20% of every win. When it reaches a threshold, the bot fires a single high-stakes bet on the 39/49 grid.
The threshold scales with your balance:
< $100 β fires at $10, bets $10
< $300 β fires at $20, bets $20
< $400 β fires at $30, bets $30
< $500 β fires at $40, bets $40
$500+ β fires at $50, bets $50
At $0.10 base bet the bonus fires roughly once every 2,381 wins β rare enough to be meaningful, frequent enough to add real upside.
Every 5 minutes the bot sends a live snapshot of its session to Claude via the Anthropic API:
Win rate, loss rate, consecutive losses
Current bankroll, peak, net P/L
Buffer absorb count, reset count
Tile intelligence (which tiles have been safe or dangerous)
Claude analyzes the data and adjusts parameters live:
bonusPotShareβ how much profit goes to the bonus potlossBufferShareβ how much profit goes to the loss bufferdelayMsβ time between bets
If the win rate drops, Claude shifts more profit into the buffer. If the session is healthy and profitable, it can redirect more to the bonus pot for bigger payouts. The bot literally tunes itself.
The bot exposes a full command interface through the browser console. Type botHelp() to see:
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RAINBET MINES BOT v18.0 β
β βββββββββββββββββββββββββββββββββββββββββββββββββββ£
β Normal: 10/49 mines | 79.6% win | x1.21 β
β Bonus: 39/49 mines | scales with bankroll β
β Split: 20% bank / 20% pot / 60% buffer β
β βββββββββββββββββββββββββββββββββββββββββββββββββββ£
β ββ BOT CONTROL ββββββββββββββββββββββββββββββ β
β runBot() β start normal bot β
β stopBot() β stop + save state β
β recoverGrid() β recover orphaned game β
β βββββββββββββββββββββββββββββββββββββββββββββββββββ£
β ββ CLAUDE AI ββββββββββββββββββββββββββββββββ β
β runClaudeMode() β Claude plays $20β$200 β
β testClaude() β test AI tuner bridge β
β βββββββββββββββββββββββββββββββββββββββββββββββββββ£
β ββ WATCHDOG βββββββββββββββββββββββββββββββββ β
β startWatchdog() β auto-restart on death β
β stopWatchdog() β stop watchdog β
β βββββββββββββββββββββββββββββββββββββββββββββββββββ£
β ββ LIVE CONFIG ββββββββββββββββββββββββββββββ β
β setBet(0.10) β set base bet size β
β setTarget(1000) β change profit target β
β CONFIG.delayMs = 3000 β bet delay ms β
β βββββββββββββββββββββββββββββββββββββββββββββββββββ£
β ββ STATS & LOGS βββββββββββββββββββββββββββββ β
β printStats() β full session stats β
β printLog() β round-by-round table β
β printFullLog() β stats + snapshot + log β
β printSnapshot() β JSON for Claude β
β printTileStats() β tile mine rate map β
β printHistory() β last 3 sessions β
β βββββββββββββββββββββββββββββββββββββββββββββββββββ£
β ββ RESET ββββββββββββββββββββββββββββββββββββ β
β clearSaved() β wipe localStorage β
β clearHistory() β wipe session history β
β botHelp() β this menu β
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
Here's what printStats() looks like after a session:

And here's printFullLog() showing the round-by-round breakdown β wins, losses, buffer absorbs, recovery chains, and bonus plays:

And here's the bot actually playing on screen:

Building v18 took 18 iterations. Each version fixed something subtle β a tier constant misalignment that caused $70 losses, a win path continue statement that silently dropped win logs, a bankroll sync that corrupted recovery math mid-chain. The bugs were never obvious. They were the kind of bugs that only appear at scale, across thousands of rounds.
The bonus was the villain. In one session the bonus fired 14 times in a row without a single win (0.6% probability). That alone cost $70. The dynamic threshold system was built specifically to make this hurt less.
Recovery math is unforgiving. If your base bet changes mid-chain because your balance dropped a tier, the recovery calculations break. The solution was locking the streakBaseBet at the moment of first loss and using it for all subsequent recovery calculations in that chain.
Letting AI tune AI is strange. There's something philosophically interesting about Claude adjusting the parameters of a bot that's using Claude to adjust its own parameters. The tuner doesn't always make the "right" call, but over time it converges toward something reasonable.
At its peak the bot reached $169 from a starting balance, running cleanly at 82% win rate on normal bets. The losses that hurt came from the bonus β not the recovery chain. With the new threshold system the bonus fires far less often and with more capital behind it.
The full source code is open on GitHub:
https://github.com/spuriousdrag0n/rainbet-bot
You'll need:
A Rainbet account β use my referral link to sign up: https://playrainbet.com/tlpdkwcjv
A Claude API key from console.anthropic.com
Chrome browser
Setup is straightforward β clone the repo, add your API key, load the extension in Chrome, navigate to the Mines game and type runBot().
The Claude AI tuner activates automatically and starts adjusting parameters within 5 minutes of your first session.
The tile intelligence system is still underutilized. The bot tracks which tiles have been revealed as mines across thousands of rounds β that's real data about Rainbet's RNG patterns, or lack thereof. Whether that's exploitable is an open question.
The Claude tuner could also be extended to adjust the recovery chain depth dynamically β pulling back during bad sessions, extending it during strong ones.
For now, the bot runs. It logs. It tunes itself. And every few thousand rounds it fires a big bet on a nearly-impossible board, hoping to catch lightning.
If this bot made you money or you just found it interesting, consider sending a tip. Every bit helps fund more experiments like this one.
ETH / Any L2 (Arbitrum, Base, Optimism, Polygon...):
Any EVM-compatible chain works β ETH mainnet, Arbitrum, Base, Optimism, Polygon, all fine at the same address.
Built with Claude Sonnet 4, running as a Chrome extension on Rainbet. All code written iteratively across 18 major versions with extensive auditing and simulation at each step.

