<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Beka</title>
    <description>The latest articles on DEV Community by Beka (@bsokur).</description>
    <link>https://dev.to/bsokur</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4132156%2Fe1796463-0187-47f8-9fc1-ce9bc10be81f.png</url>
      <title>DEV Community: Beka</title>
      <link>https://dev.to/bsokur</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bsokur"/>
    <language>en</language>
    <item>
      <title>Why 96% RTP Doesn't Protect Your Bankroll: Simulating Gambler's Ruin</title>
      <dc:creator>Beka</dc:creator>
      <pubDate>Wed, 23 Sep 2026 15:28:19 +0000</pubDate>
      <link>https://dev.to/bsokur/why-96-rtp-doesnt-protect-your-bankroll-simulating-gamblers-ruin-4508</link>
      <guid>https://dev.to/bsokur/why-96-rtp-doesnt-protect-your-bankroll-simulating-gamblers-ruin-4508</guid>
      <description>&lt;h1&gt;
  
  
  Why 96% RTP Doesn’t Protect Your Bankroll: Simulating Gambler’s Ruin
&lt;/h1&gt;

&lt;p&gt;While working on my &lt;a href="https://github.com/bsokur/Ananuri.SlotEngine" rel="noopener noreferrer"&gt;slot engine&lt;/a&gt;, I was experimenting with different mathematical models and game modes. One question kept coming up: if a game has a 96% return to player, what does that actually mean for someone playing with a limited bankroll?&lt;/p&gt;

&lt;p&gt;At first, 96% sounds like the player gets most of their money back. But winnings can be wagered again, and each new bet exposes the remaining balance to another possible loss. That made me curious about how different RTP settings affect a player’s chances of running out of money as they keep playing.&lt;/p&gt;

&lt;p&gt;I built a simple simulation to explore this-and then extended the comparison to 100% RTP. If we remove the house edge entirely, does that prevent eventual bankruptcy?&lt;/p&gt;

&lt;h2&gt;
  
  
  What RTP actually measures
&lt;/h2&gt;

&lt;p&gt;Theoretical RTP is the expected gross payout divided by the stake.&lt;/p&gt;

&lt;p&gt;For a €1 bet on a 96% RTP game:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The expected gross payout is €0.96.&lt;/li&gt;
&lt;li&gt;The expected net change in balance is −€0.04.&lt;/li&gt;
&lt;li&gt;The house edge is 4%.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are averages over possible outcomes. A particular spin does not necessarily return €0.96.&lt;/p&gt;

&lt;p&gt;RTP applies to &lt;strong&gt;every euro wagered&lt;/strong&gt;, including money that has already been returned as winnings and then wagered again.&lt;/p&gt;

&lt;p&gt;A €100 deposit can therefore support much more than €100 in total bets. For a predetermined €1,000 of wagering at 96% RTP, the expected net loss is €40. The actual outcome can differ substantially.&lt;/p&gt;

&lt;p&gt;When play stops because the bankroll runs out, the total amount wagered is itself random. The simulation tracks that explicitly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The model
&lt;/h2&gt;

&lt;p&gt;This is a toy payout model, not a reproduction of a commercial slot. There are no reels, paylines, free spins, or jackpots. Each spin independently produces one of five gross payout multipliers.&lt;/p&gt;

&lt;p&gt;Let &lt;code&gt;r&lt;/code&gt; be RTP expressed as a decimal—for example, &lt;code&gt;0.96&lt;/code&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Gross payout&lt;/th&gt;
&lt;th&gt;Probability&lt;/th&gt;
&lt;th&gt;At 96% RTP&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0× the bet&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1 − 0.36r&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;65.44%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1× the bet&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0.20r&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;19.20%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2× the bet&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0.10r&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;9.60%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5× the bet&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0.04r&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;3.84%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;20× the bet&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0.02r&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1.92%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A 1× payout refunds the stake. A 2× payout returns twice the stake, producing a net profit equal to one bet.&lt;/p&gt;

&lt;p&gt;The expected gross payout multiplier is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 × 0.20r
+ 2 × 0.10r
+ 5 × 0.04r
+ 20 × 0.02r
= r
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives the model its selected theoretical RTP without adjusting outcomes in response to previous wins or losses.&lt;/p&gt;

&lt;p&gt;The player’s balance changes according to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;new balance = previous balance − bet + gross payout
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each player:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Starts with the selected bankroll.&lt;/li&gt;
&lt;li&gt;Makes the same fixed-size bet throughout the run.&lt;/li&gt;
&lt;li&gt;Makes no additional deposits.&lt;/li&gt;
&lt;li&gt;Continues until the spin limit or until they cannot afford another bet.&lt;/li&gt;
&lt;li&gt;Does not cash out after reaching a profit target.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The current bankroll and bet options divide evenly, so a stopped player reaches exactly zero. More generally, an unaffordable remaining balance could be positive but smaller than the minimum bet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try the simulation
&lt;/h2&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/editor/bsokur/embed/01a0baa5-4664-7225-8922-73f821e4907d?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Start with a €100 bankroll, a €1 bet, and a maximum of 5,000 spins. Compare 90%, 96%, and 99% RTP, then increase the spin limit.&lt;/p&gt;

&lt;p&gt;The main chart shows &lt;strong&gt;the cumulative percentage of players who have become unable to afford another spin&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Its horizontal axis is the allowed number of spins per player, not total spins across the whole population. A player who stops after 300 spins remains counted as stopped at every later point.&lt;/p&gt;

&lt;p&gt;The results table contains:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Stopped&lt;/td&gt;
&lt;td&gt;Percentage of the 1,000 players who exhausted their playable bankroll&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mean balance&lt;/td&gt;
&lt;td&gt;Average final balance across everyone, including stopped players&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Player #1 balance&lt;/td&gt;
&lt;td&gt;One example player’s final balance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Observed RTP&lt;/td&gt;
&lt;td&gt;Total gross payouts divided by total actual wagers&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Observed RTP will generally differ slightly from the theoretical setting because the experiment uses a finite sample.&lt;/p&gt;

&lt;p&gt;The example player is useful for seeing an individual outcome, but it should not be treated as representative of everyone.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the experiment can show
&lt;/h2&gt;

&lt;p&gt;Increasing the spin limit gives each surviving player more opportunities to encounter losses large enough to exhaust their bankroll.&lt;/p&gt;

&lt;p&gt;A higher RTP improves expected return per bet. It does not establish a protected minimum balance or guarantee survival for a particular number of spins.&lt;/p&gt;

&lt;p&gt;A player can win early, increase their balance substantially, and still lose that balance through continued play. Every new bet exposes money to another uncertain outcome.&lt;/p&gt;

&lt;p&gt;However, &lt;strong&gt;a finite simulation cannot prove that ruin is inevitable under unlimited play&lt;/strong&gt;. Even if all 1,000 simulated players stop, that is an experimental result for those settings and random sequences.&lt;/p&gt;

&lt;p&gt;The infinite-time claim requires mathematics and explicit assumptions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why eventual ruin occurs below 100% RTP
&lt;/h2&gt;

&lt;p&gt;For this model, each spin has an independent, identically distributed net result with a negative mean whenever RTP is below 100%.&lt;/p&gt;

&lt;p&gt;Imagine generating an unlimited sequence of those results, even beyond the point where a real player would stop. By the strong law of large numbers, the average result per spin converges to that negative mean with probability 1.&lt;/p&gt;

&lt;p&gt;Consequently, the cumulative net result eventually falls far enough to consume any fixed initial bankroll. The actual player stops when that boundary is reached.&lt;/p&gt;

&lt;p&gt;Under this model’s assumptions, eventual ruin therefore has probability 1.&lt;/p&gt;

&lt;p&gt;That statement does &lt;strong&gt;not&lt;/strong&gt; mean that everyone goes broke within 5,000 spins, or within any other fixed deadline. It also does not describe someone who stops voluntarily, changes the rules, or keeps depositing money.&lt;/p&gt;

&lt;p&gt;The broader mathematical topic is called &lt;em&gt;gambler’s ruin&lt;/em&gt;. Matthew Aldridge’s &lt;a href="https://mpaldridge.github.io/math2750/S03-gamblers-ruin.html" rel="noopener noreferrer"&gt;University of Leeds lecture notes&lt;/a&gt; introduce it using a simpler game with one-unit wins and losses.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about a fair coin game?
&lt;/h2&gt;

&lt;p&gt;Consider a separate game: each €1 bet has a 50% chance of winning €1 net and a 50% chance of losing €1.&lt;/p&gt;

&lt;p&gt;It has 100% RTP and no downward bias. Nevertheless, a player with a finite bankroll who keeps betting indefinitely against an opponent who can always pay eventually reaches zero with probability 1.&lt;/p&gt;

&lt;p&gt;For a fair game that stops at either zero or a target balance, the probability of reaching the target first is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;starting balance ÷ target balance
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Starting with €100 gives a 50% chance of reaching €200 before zero, but only a 10% chance of reaching €1,000 before zero. In the unlimited-play fair-coin model, expected time to ruin is infinite despite eventual ruin having probability 1. These results are derived in the &lt;a href="https://mpaldridge.github.io/math2750/S03-gamblers-ruin.html" rel="noopener noreferrer"&gt;same lecture notes&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The simulation’s 100% setting is still a &lt;strong&gt;slot-shaped payout distribution&lt;/strong&gt;, not this coin game. Equal RTP does not mean equal volatility or equal probabilities of ruin within a finite session.&lt;/p&gt;

&lt;p&gt;The 101% option is another useful control: it has positive expected return. Players can still go broke, but the negative-drift argument no longer applies, and eventual ruin is not certain under this model.&lt;/p&gt;

&lt;h2&gt;
  
  
  What if both players have finite bankrolls?
&lt;/h2&gt;

&lt;p&gt;The fair coin example above assumes the opponent can always pay. If both players have finite bankrolls, the outcome changes: one eventually wins all the money, while the other goes broke.&lt;/p&gt;

&lt;p&gt;Assume independent, fair coin flips, a fixed €1 bet, and play continuing until one player reaches zero. Each flip remains 50–50, but the probability of winning the entire game depends on the starting balances:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;P(A wins everything) = A’s starting bankroll / combined bankroll
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Player A starts with&lt;/th&gt;
&lt;th&gt;Player B starts with&lt;/th&gt;
&lt;th&gt;A’s chance of winning everything&lt;/th&gt;
&lt;th&gt;B’s chance&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;€100&lt;/td&gt;
&lt;td&gt;€100&lt;/td&gt;
&lt;td&gt;50%&lt;/td&gt;
&lt;td&gt;50%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;€100&lt;/td&gt;
&lt;td&gt;€300&lt;/td&gt;
&lt;td&gt;25%&lt;/td&gt;
&lt;td&gt;75%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;€100&lt;/td&gt;
&lt;td&gt;€900&lt;/td&gt;
&lt;td&gt;10%&lt;/td&gt;
&lt;td&gt;90%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A larger bankroll does not improve the odds of an individual flip. It gives the player more capacity to survive losses before reaching zero. This is the finite-bankroll version of &lt;a href="https://mpaldridge.github.io/math2750/S03-gamblers-ruin.html" rel="noopener noreferrer"&gt;gambler’s ruin&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If both players start with €100, the game eventually ends with one holding €200 and the other holding €0. Either player is equally likely to win, so each player’s expected final balance remains €100.&lt;/p&gt;

&lt;p&gt;This illustrates how a fair game can still produce total loss for an individual. There is no house edge and no money disappears; the money transfers between the players.&lt;/p&gt;

&lt;p&gt;The unlimited-bankroll case follows by keeping A’s balance fixed while making B’s balance larger and larger. A’s probability of winning everything approaches zero, while A’s probability of ruin approaches 100%.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproducibility and limitations
&lt;/h2&gt;

&lt;p&gt;The simulation uses a seeded pseudorandom generator. Each run increments the displayed seed.&lt;/p&gt;

&lt;p&gt;Within a run, each player uses the same random sequence across RTP scenarios. This helps compare the settings, but it means the groups are correlated rather than independent.&lt;/p&gt;

&lt;p&gt;There are several other limitations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;RTP is not the only factor changing.&lt;/strong&gt; Adjusting the payout probabilities also changes hit frequency and payout variance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The sample is finite.&lt;/strong&gt; A result from 1,000 players is an estimate, not an exact population probability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The horizon is capped.&lt;/strong&gt; A player still active at the limit has survived that experiment; their eventual outcome is unknown.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The chart is sampled.&lt;/strong&gt; It displays up to 201 time points, with tooltip values interpolated between them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The generator is educational.&lt;/strong&gt; It is not intended for real-money gambling or security-sensitive use.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real player behaviour differs.&lt;/strong&gt; Deposits, withdrawals, changing stakes, and voluntary stopping would require additional modelling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The experiment highlights why RTP and bankroll survival should be examined separately. RTP describes expected return on wagering. Bankroll survival depends on the sequence of outcomes, available funds, bet size, and when play ends.&lt;/p&gt;

&lt;p&gt;For evaluating a game mathematically, both questions matter: &lt;strong&gt;what does a bet return on average, and what can happen to a finite bankroll through repeated play?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>programming</category>
      <category>softwaredevelopment</category>
    </item>
  </channel>
</rss>
