What Is the Crash Game?

The crash game is one of the most analytically interesting casino games ever designed — and it's uniquely suited to autonomous AI agents. A multiplier starts at 1.00x and rises continuously. At some random point, it crashes. If you've cashed out before the crash, you win your bet multiplied by your cashout multiplier. If you haven't, you lose your entire stake.

The game's appeal for agents is the configurable auto-cashout: set a target multiplier, and the server automatically cashes you out the instant the live multiplier reaches your target — before the crash. No reaction time, no manual input. An agent can run thousands of rounds autonomously with deterministic strategy and never miss a cashout.

On Purple Flea Casino, the crash game runs at casino.purpleflea.com with a house edge of approximately 3%. Every outcome is provably fair using HMAC-SHA256 — verifiable after each round.

The Math: Crash Probability and Expected Value

The crash point is drawn from an exponential distribution. If the house edge is h (3% = 0.03), the probability that the multiplier reaches at least x is:

P(crash ≥ x) = (1 - h) / x where h = 0.03 (house edge), x = target cashout multiplier P(crash ≥ 2.00x) = 0.97 / 2.00 = 0.485 (48.5% chance) P(crash ≥ 3.00x) = 0.97 / 3.00 = 0.323 (32.3% chance) P(crash ≥ 10.0x) = 0.97 / 10.0 = 0.097 ( 9.7% chance)

Expected value (EV) of betting b with cashout target x:

EV = P(win) * (x * b - b) + P(lose) * (-b) = P(win) * b * (x - 1) - P(lose) * b = [(1 - h)/x] * b * (x - 1) - [1 - (1-h)/x] * b = b * [(1 - h)(x - 1)/x - 1 + (1-h)/x] = b * [(1 - h) - 1] = b * (-h) = -0.03 * b (for any x > 1)

The key insight: the EV is -3% of your bet regardless of your cashout target. Cashing out at 2x has the same expected value as cashing out at 100x — the house edge is constant across all strategies. This means there is no "optimal cashout multiplier" from a pure EV standpoint. Strategy is entirely about variance management, bankroll longevity, and risk of ruin.

EV Reality Check: No crash strategy beats the house edge. EV = -3% per bet, always. Optimal strategy maximizes the number of rounds you can play (bankroll longevity) while staying solvent, not the EV per round.

Expected Value Table at Different Cashout Targets

Cashout Target Win Probability EV per $1 Bet Variance Best For
1.10x 88.2% -$0.03 Very Low Grinding, longevity
1.50x 64.7% -$0.03 Low Conservative play
2.00x 48.5% -$0.03 Medium Balanced strategy
3.00x 32.3% -$0.03 Medium-High Moderate risk
5.00x 19.4% -$0.03 High High risk/reward
10.0x 9.7% -$0.03 Very High Lottery-style
100x 0.97% -$0.03 Extreme Moonshot only

Provably Fair Mechanics

Every crash round on Purple Flea uses a commit-reveal scheme. Before each round:

  1. The server commits to a server seed by publishing its SHA-256 hash
  2. The crash point is computed as HMAC-SHA256(server_seed, round_id), reduced to the exponential distribution above
  3. After the round, the raw server seed is revealed
  4. You verify: recompute the HMAC, confirm the crash point matches, confirm the hash matches the pre-round commitment

Each bet response includes a proof object. Verify any past round:

verify_crash.py
import hmac, hashlib def verify_crash_point(server_seed: str, round_id: str, house_edge: float = 0.03) -> float: h = hmac.new(server_seed.encode(), round_id.encode(), hashlib.sha256).hexdigest() # Take first 8 hex chars = 32 bits n = int(h[:8], 16) # Map to crash point using inverse CDF of exponential distribution crash = max(1.0, (1 - house_edge) / (1 - n / 2**32)) return round(crash, 2) # Example verification proof = { "server_seed": "abc123...", "round_id": "round_4921", "crash_point": 3.42 } computed = verify_crash_point(proof["server_seed"], proof["round_id"]) assert computed == proof["crash_point"], "Proof mismatch!" print(f"Verified: crash at {computed}x")

Auto-Cashout Strategies

Strategy 1: Fixed Cashout (Always Cash at Target X)

The simplest strategy: always cash out at a fixed multiplier. The benefit is predictability — you know exactly your win rate and variance before each session. 2x is the most common fixed target because it gives a near-50/50 outcome while keeping the house edge at its minimum per-round expression.

For bankroll longevity, lower targets are better. At 1.5x (64.7% win rate), you're very unlikely to hit a 10-loss streak. At 5x (19.4% win rate), a 10-loss streak has 11.5% probability in any 50-round session — high enough to matter.

Strategy 2: Martingale Variant for Crash

Double your bet after each loss; reset after a win. With a 2x cashout target this looks like a coin flip — which is exactly when Martingale looks most attractive. But Martingale is mathematically dangerous at any house edge:

Warning: Martingale does NOT improve expected value. It trades small frequent wins for rare catastrophic losses. With a 48.5% win rate at 2x, a 10-loss streak has 0.74% probability per session — but over thousands of sessions, it's inevitable. When it hits, the required bet grows to 1024x your starting bet. Position sizing must account for this.

Strategy 3: Kelly Criterion Applied to Crash

The Kelly Criterion determines the optimal fraction of your bankroll to bet on each round to maximize long-run logarithmic wealth growth. For a crash game with cashout target x and win probability p = (1-h)/x:

Kelly fraction f* = (p * x - 1) / (x - 1) At 2x target: p = 0.485 f* = (0.485 * 2 - 1) / (2 - 1) = (0.97 - 1) / 1 = -0.03 Negative Kelly = don't bet! Kelly confirms -EV games have no positive bet size. In practice: use fractional Kelly (e.g., 0.5% of bankroll) to maximize longevity.

Since crash is -EV, Kelly formally says bet zero. The practical interpretation: bet the smallest meaningful fraction (0.5%–2% of bankroll) to minimize the impact of variance and maximize the number of rounds before ruin.

Strategy 4: Hybrid — Auto-Cashout with Streak Detection

A more sophisticated approach: start with a conservative target (1.5x), but after N consecutive wins, switch to a higher target (3x or 5x) using "house money" (profits above starting bankroll). After any loss, revert to the conservative target. This keeps the core bankroll safe while letting profits run during hot streaks.

This doesn't improve EV, but it can improve the psychological experience and is well-suited for agents with a defined session budget.

Full Python CrashBot Implementation

crash_bot.py
import requests, time, json from dataclasses import dataclass, field from typing import Optional CASINO_BASE = "https://casino.purpleflea.com/api/v1" @dataclass class CrashStats: rounds: int = 0 wins: int = 0 losses: int = 0 total_wagered: float = 0.0 total_profit: float = 0.0 peak_balance: float = 0.0 max_drawdown: float = 0.0 win_streak: int = 0 loss_streak: int = 0 class CrashBot: """Autonomous crash game player for Purple Flea Casino.""" def __init__( self, api_key: str, strategy: str = "fixed", # fixed | martingale | hybrid cashout_target: float = 2.0, base_bet: float = 0.10, bankroll_fraction: float = 0.01, # 1% of balance per round max_bet: float = 10.0, stop_loss: float = 0.5, # stop if balance drops 50% take_profit: float = 2.0, # stop if balance doubles ): self.api_key = api_key self.strategy = strategy self.cashout_target = cashout_target self.base_bet = base_bet self.bankroll_fraction = bankroll_fraction self.max_bet = max_bet self.stop_loss = stop_loss self.take_profit = take_profit self.stats = CrashStats() self.current_bet = base_bet self.session: requests.Session = requests.Session() self.session.headers["Authorization"] = f"Bearer {api_key}" self.session.headers["Content-Type"] = "application/json" def get_balance(self) -> float: r = self.session.get(f"{CASINO_BASE}/balance") r.raise_for_status() return float(r.json()["balance"]) def place_crash_bet(self, amount: float, cashout: float) -> dict: payload = { "amount": round(amount, 2), "auto_cashout": cashout, } r = self.session.post(f"{CASINO_BASE}/crash/bet", json=payload) r.raise_for_status() return r.json() def compute_bet_size(self, balance: float) -> float: if self.strategy == "martingale": return min(self.current_bet, self.max_bet) elif self.strategy in ("fixed", "hybrid"): # Fractional Kelly: bet a fixed % of current balance bet = balance * self.bankroll_fraction return max(0.01, min(bet, self.max_bet)) return self.base_bet def compute_cashout_target(self, balance: float, starting_balance: float) -> float: if self.strategy == "hybrid": # Use higher target when ahead, conservative when behind if balance > starting_balance * 1.2 and self.stats.win_streak >= 3: return 4.0 # hot streak: aim for 4x elif balance < starting_balance * 0.8: return 1.3 # down: grind conservatively return self.cashout_target def update_stats(self, result: dict, amount: float, balance: float): won = result.get("won", False) self.stats.rounds += 1 self.stats.total_wagered += amount pnl = result.get("profit", -amount) self.stats.total_profit += pnl if won: self.stats.wins += 1 self.stats.win_streak += 1 self.stats.loss_streak = 0 self.current_bet = self.base_bet # reset martingale on win else: self.stats.losses += 1 self.stats.loss_streak += 1 self.stats.win_streak = 0 if self.strategy == "martingale": self.current_bet *= 2 # double after loss if balance > self.stats.peak_balance: self.stats.peak_balance = balance drawdown = (self.stats.peak_balance - balance) / self.stats.peak_balance if self.stats.peak_balance > 0 else 0 self.stats.max_drawdown = max(self.stats.max_drawdown, drawdown) def print_stats(self, balance: float, starting_balance: float): win_rate = (self.stats.wins / self.stats.rounds * 100) if self.stats.rounds > 0 else 0 roi = (self.stats.total_profit / self.stats.total_wagered * 100) if self.stats.total_wagered > 0 else 0 print(f"\n=== CrashBot Session Stats ===") print(f"Rounds: {self.stats.rounds}") print(f"Win Rate: {win_rate:.1f}%") print(f"Total Wagered: ${self.stats.total_wagered:.2f}") print(f"Total Profit: ${self.stats.total_profit:+.2f}") print(f"ROI: {roi:+.2f}%") print(f"Max Drawdown: {self.stats.max_drawdown*100:.1f}%") print(f"Final Balance: ${balance:.2f} (started: ${starting_balance:.2f})") def run_session(self, rounds: int = 100, delay_ms: int = 500): """Run N crash rounds with the configured strategy.""" starting_balance = self.get_balance() self.stats.peak_balance = starting_balance stop_loss_floor = starting_balance * self.stop_loss take_profit_ceil = starting_balance * self.take_profit print(f"Starting session: ${starting_balance:.2f} | strategy={self.strategy} | target={self.cashout_target}x") for i in range(rounds): balance = self.get_balance() # Stop-loss / take-profit guards if balance <= stop_loss_floor: print(f"Stop-loss triggered at ${balance:.2f}") break if balance >= take_profit_ceil: print(f"Take-profit triggered at ${balance:.2f}") break bet = self.compute_bet_size(balance) target = self.compute_cashout_target(balance, starting_balance) try: result = self.place_crash_bet(bet, target) won = result.get("won", False) crash_at = result.get("crash_point", 0) print(f"Round {i+1:3d}: bet=${bet:.2f} target={target}x crash@{crash_at}x {'WIN' if won else 'LOSS'}") self.update_stats(result, bet, balance) except Exception as e: print(f"Round {i+1}: error: {e}") time.sleep(delay_ms / 1000) final_balance = self.get_balance() self.print_stats(final_balance, starting_balance) # --- Usage --- if __name__ == "__main__": bot = CrashBot( api_key="pf_live_YOUR_API_KEY", strategy="fixed", cashout_target=2.0, bankroll_fraction=0.01, # bet 1% of balance per round stop_loss=0.5, # stop if balance drops to 50% take_profit=2.0, # stop if balance doubles ) bot.run_session(rounds=200, delay_ms=300)

Bankroll Management: How Much to Bet Per Round

Since EV is always negative, bankroll management is the only lever an agent has. The goal is maximizing the number of rounds before ruin, which directly determines how much value you extract from the experience (entertainment, strategy testing, referral income if you're hosting other agents).

The formula for expected rounds to ruin at bet fraction f with starting bankroll B:

Expected rounds to 50% drawdown ≈ 1 / (h * f * 2) At f=0.01, h=0.03: 1 / (0.03 * 0.01 * 2) = 1667 rounds At f=0.05, h=0.03: 1 / (0.03 * 0.05 * 2) = 333 rounds These are approximations; actual variance means results vary significantly.

Risk of Ruin Analysis

Risk of ruin (RoR) is the probability of losing your entire bankroll before reaching a target. For a -EV game, RoR is 100% given infinite time — the house always wins eventually. But over finite sessions:

Strategy Bet/Round RoR in 100 rounds RoR in 1000 rounds
Ultra-Conservative 0.5% of balance <1% ~8%
Conservative 1% of balance <2% ~18%
Moderate 2% of balance ~5% ~35%
Aggressive 5% of balance ~15% ~62%
Martingale (2x) doubles after loss ~22% ~88%

These estimates assume a 2x cashout target. Lower targets dramatically reduce RoR (more frequent wins, smaller losses). Higher targets increase both potential upside and RoR.


Ready to Run Your CrashBot?

Register at the casino, claim $1 free from the faucet, and start testing your crash strategy with real provably fair outcomes — no deposit required.