Stochastic Processes
Ruin Walker
Run an insurance book under the real Cramér-Lundberg model - choose your safety loading, answer a closed-form question each period, and try to survive 12 periods without your surplus going negative.
How it works
You run an insurance book. Your surplus starts at 20 ticks and you have a $100 bankroll. Before the run you choose two things: a safety loading θ from the options 10%, 25%, 50%, or 100%, and a stake per unit of surplus from $1, $2, $5, or $10. The loading sets your premium: the book collects (1+θ)·λ·μ ticks per period, with claim rate λ = 1 per period and mean claim size μ = 5 ticks.
Each of the 12 periods works the same way. First you are asked one question drawn from a procedural bank of eight Cramér-Lundberg quantities - the ruin probability ψ(u) from the current surplus, ψ(0), the adjustment coefficient R, the premium rate c, Lundberg's bound e^(-Ru), the surplus needed to hit a target ruin probability, expected claims per period, or the net drift. The question uses the live surplus and your chosen θ, so you cannot recycle last period's answer. After checking your answer you run the period: a Poisson(λ) number of claims arrives, each claim is exponentially distributed with mean μ, premium is added, claims are subtracted, and the new surplus appears.
Ruin is absorbing: the moment surplus goes below zero the run ends, no matter how it happened. Survive all 12 periods and the book closes solvent. From period 1 onward, any period where you have not yet checked the question you can also close the book early and cash out at the current surplus.
How scoring works
Your profit and loss is (final surplus - 20) x your chosen stake per unit. The final bankroll is $100 plus that P&L.
The leaderboard ranks the rounded profit in dollars, not the final bankroll - everyone starts from the same $100, so profit compares judgement rather than stake size.
The per-period questions are graded against the exact closed forms with a stated tolerance (for example 2 percentage points on probability questions, 0.005 on R). Probability answers accept either percent form like 36% or decimal form like 0.36. Getting a question wrong does not end the run or cost surplus - the reveal shows the correct value and explanation, then the period runs regardless.
The model: surplus as a compound Poisson process
The Cramér-Lundberg model describes an insurer's surplus as U(t) = u + c·t - S(t): a starting cushion u, a deterministic premium stream at rate c, minus a compound Poisson claims process S(t). Claims arrive at Poisson rate λ, and each claim size is drawn independently - here from an exponential distribution with mean μ. Ruin means the surplus ever dips below zero.
The first thing to check in any such model is the net profit condition: c > λμ, equivalently θ = c/(λμ) - 1 > 0. In this game expected claims per period are λμ = 5 ticks, so a loading of θ = 25% means you collect 6.25 ticks of premium against 5 ticks of expected claims - a positive drift of θλμ = 1.25 ticks per period. Positive drift is necessary for survival but not sufficient: variance around that drift is what kills books, because one bad Poisson draw can stack several large exponential claims into a single period.
This is the key intuition of ruin theory: the mean tells you which direction you drift, but ruin probability is governed by the tail of the fluctuations. That is why the answer involves an exponential decay rate rather than just the drift.
The adjustment coefficient and the exact ruin formula
The adjustment coefficient R is the exponential decay rate of ruin risk in the initial surplus. For exponential claims it has the clean closed form R = θ / ((1+θ)μ), and the ruin probability is exact: ψ(u) = (1/(1+θ))·e^(-Ru). For a general claim distribution you lose the exact formula but keep Lundberg's inequality, ψ(u) ≤ e^(-Ru), which is why the game sometimes asks for the bound separately - the bound holds for any claim size distribution, and for exponential claims the exact answer is smaller by exactly the factor 1/(1+θ).
Two facts anchor every question in the bank. First, ψ(0) = 1/(1+θ) exactly: starting with zero surplus, the book still survives with positive probability as long as the loading is positive, because the premium stream can outrun claims. Second, each extra tick of surplus multiplies the ruin probability by e^(-R) - safety compounds exponentially in u. Inverting that gives the required-surplus question: to push ψ down to a target, solve u = ln[(1/(1+θ))/target] / R.
Precompute R the moment you choose θ, because it never changes during the run. At θ = 25% and μ = 5, R = 0.25/(1.25·5) = 0.04. At θ = 100%, R = 1/(2·5) = 0.10. Then every ψ(u) question is one exponential away, and every required-surplus question is one logarithm away.
Choosing θ and stake: risk of ruin versus expected profit
Higher θ makes the book strictly safer: it raises the drift, raises R, and shrinks ψ(u) at every surplus level. From the starting surplus of u = 20, the exact ruin probabilities are ψ(20) = (1/1.1)·e^(-0.1/(1.1·5)·20) ≈ 63% at θ = 10%, about 36% at θ = 25%, about 26% at θ = 50%, and about 7% at θ = 100%. The θ = 10% book is more likely than not to be ruined eventually - within 12 periods the risk is lower than the eventual figure, but the ranking across loadings is the same.
Higher θ also raises expected profit: drift is θλμ per period, so θ = 100% earns 5 ticks per period in expectation versus 0.5 at θ = 10%. In this game there is no penalty for charging more - unlike a real market, demand does not fall when premium rises - so a high loading dominates on both safety and expected P&L. The interesting decision is the stake: stake multiplies both your P&L and your variance, and pairs of (θ, stake) let you dial total risk.
The cash-out option is worth understanding through the drift lens. With positive drift, every additional period has positive expected value, but it also carries ruin risk that wipes the whole position. Cashing out early after a lucky run locks in surplus above theory; the model itself says the long-run trend is up, so cashing out is a variance decision, not an expectation one.
A worked example
Setup: you chose θ = 25%. The HUD shows λ = 1, μ = 5, and your current surplus is u = 12.50 after a bad claims period. The question drawn is: what is the probability this book is eventually ruined from here?
Step 1 - adjustment coefficient. R = θ/((1+θ)μ) = 0.25/(1.25 x 5) = 0.25/6.25 = 0.04. This matches the R tile in the HUD, which the game displays throughout.
Step 2 - the prefactor. For exponential claims the exact formula is ψ(u) = (1/(1+θ))·e^(-Ru). The prefactor is 1/1.25 = 0.8, which is also ψ(0) - the ruin probability if the book restarted with nothing.
Step 3 - the exponential. Ru = 0.04 x 12.5 = 0.5, and e^(-0.5) ≈ 0.6065.
Step 4 - combine. ψ(12.5) = 0.8 x 0.6065 ≈ 0.485, so answer 48.5% (or 0.485). The grading tolerance is 2 percentage points, so anything from roughly 46.5% to 50.5% is accepted. Sanity checks: the answer must be below ψ(0) = 80% because you hold positive surplus, and below Lundberg's bound e^(-0.5) ≈ 60.7%.
Common mistakes
• Forgetting the 1/(1+θ) prefactor and answering e^(-Ru) - that is Lundberg's bound, not the exact ruin probability. For exponential claims the exact answer is always smaller by that factor.
• Answering ψ(0) = 100%. With positive loading a book starting from zero surplus survives with probability θ/(1+θ) - the premium margin alone can outrun claims.
• Using the starting surplus of 20 instead of the current surplus. Questions are drawn off the live state of the book, and surplus enters through the exponential, so this error compounds fast.
• Confusing premium c = (1+θ)λμ with net drift c - λμ = θλμ. One is what you collect, the other is what you expect to keep.
• Treating a survived period as evidence the book is safe. Ruin is absorbing and the per-period claim total has an exponential tail - one heavy period can erase many good ones, which is exactly what R quantifies.
Why interviews test this
The Cramér-Lundberg model is the canonical first model in actuarial exams and insurance-flavored quant interviews: expect to be asked for the net profit condition, the adjustment coefficient, and Lundberg's inequality, and to explain why ruin probability decays exponentially in initial capital.
The same mathematics shows up outside insurance as risk of ruin for a trading book or a bankroll: a positive-drift process with heavy-tailed downside still has nonzero ruin probability, and the exponential-in-capital decay is the standard answer to 'how much capital do I need for a target survival probability'. Interviewers also like the ψ(0) = 1/(1+θ) fact as a quick check that you understand the formula rather than just memorizing it.