<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abhinav Kumar on Medium]]></title>
        <description><![CDATA[Stories by Abhinav Kumar on Medium]]></description>
        <link>https://medium.com/@abhinavk99?source=rss-ffaf31771794------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*UREcuA-6vfHysPA9Nmh4UA.jpeg</url>
            <title>Stories by Abhinav Kumar on Medium</title>
            <link>https://medium.com/@abhinavk99?source=rss-ffaf31771794------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 07 Jun 2026 19:58:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abhinavk99/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Exploring Dice Math (With Explosions!)]]></title>
            <link>https://medium.com/new-writers-welcome/exploring-dice-math-with-explosions-6d558e36bfe5?source=rss-ffaf31771794------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d558e36bfe5</guid>
            <category><![CDATA[roleplaying-game]]></category>
            <category><![CDATA[math]]></category>
            <category><![CDATA[new-writers-welcome]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[probability]]></category>
            <dc:creator><![CDATA[Abhinav Kumar]]></dc:creator>
            <pubDate>Mon, 17 Jan 2022 20:57:06 GMT</pubDate>
            <atom:updated>2022-01-18T13:05:42.499Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learning probability through Dimension 20</h4><figure><img alt="Image showing a bag of dice used in roleplaying games. Shows various sizes of polyhedral dice." src="https://cdn-images-1.medium.com/max/1024/0*fzKOhofhp2BsYmBm" /><figcaption>Photo by <a href="https://unsplash.com/@armato?utm_source=medium&amp;utm_medium=referral">Alperen Yazgı</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The excellent <a href="https://www.dropout.tv/videos/misfits-magic-holiday-special">Misfits and Magic Holiday Special</a> from Dimension 20, a show about tabletop role-playing games (TTRPGs), has great storytelling and a hilarious cast. However, let’s talk about the math. I won’t spoil anything, but at one point the inimitable Brennan Lee Mulligan, playing as Evan Kelmp, has to choose between rolling two differently sized dice to hit a total. The catch? The dice explode.</p><h4>Exploding Dice</h4><p>I promised explosions, so let’s get to it. Dice exploding is a game mechanic where rolling the highest number on the die allows the player to roll again and add the values, continuing until the highest value is not rolled. Since TTRPGs resolve important events through dice rolls, this mechanic can have a large impact on the events in the game. This seemingly simple summation can result in an interesting dilemma, exemplified by Brennan’s decision.</p><p>One die roll would not be enough to succeed and Brennan could choose between a larger and smaller die. Imagine you are in a similar situation. You would expect the larger die to get a larger value per roll, but the smaller die is more likely to explode, giving you a valuable extra roll. What should you do? I wasn’t sure so I decided to do the math to find out.</p><h4>Math Time</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3owzW5c1tPq63MPmWk%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3owzW5c1tPq63MPmWk%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F3owzW5c1tPq63MPmWk%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="183" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d15aed036a1967879d0a5b8e391c7b6/href">https://medium.com/media/4d15aed036a1967879d0a5b8e391c7b6/href</a></iframe><p>Let’s do some math! I will be deriving equations that we can use to model how exploding dice work, but there’s no need to look at the math if you don’t want to. The text is enough to conceptually understand what is happening. If you have any questions about anything, feel free to leave a response and I’ll do my best to answer them.</p><p>To answer our question about choosing a die, we need to calculate the probability of rolling a value given the size of a die. We’ll step through an example for a specific die and then extrapolate from there for all dice.</p><p><em>Caveat: In the Kids on Brooms game system that Misfits and Magic uses, there are bonuses added to dice rolls. I will derive these formulas initially without including bonuses, but what is shown can be easily be extended to include bonuses as I will demonstrate later.</em></p><p>Let’s initially consider a d4, or 4 sided die, the smallest die used in role-playing games. We will say this die explodes if we roll a 4. For this die, rolling a 1, 2, or 3 has the same probability as it would if it couldn’t explode. Rolling a 4 has 0 probability since if we rolled a 4 we would automatically add at least 1 more from another die roll. Extending this, we can write the sequence of die rolls necessary to reach any number.</p><p>1: 1<br>2: 2<br>3: 3<br>4: impossible<br>5: 4, 1<br>6: 4, 2<br>7: 4, 3<br>8: impossible<br>9: 4, 4, 1<br>10: 4, 4, 2</p><p>We can see a pattern here. The number of rolls needed is equal to the target number divided by 4, rounded up. The exceptions are the multiples of 4. In our list, any values that have the same sequence length have the same probability of occurring. This is because they require the same number of rolls of a d4. Our first equation will be for the probability mass function (PMF) of the distribution. This is a function that calculates the probability of specific events occurring. We can write the PMF as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/0*y-_on5G9SEOhGVPN.png" /><figcaption>Photo by Abhinav Kumar</figcaption></figure><p>This is true if <em>x</em> is not a multiple of 4. If <em>x</em> is a multiple of 4, the probability is 0.</p><p>This equation may look intimidating but let’s go through it piece by piece. <em>X</em> is a random variable, meaning we sample a probability distribution to get its value, while <em>x</em> is any specific value <em>X </em>could be measured to have. The equation says that the probability of <em>X</em> equaling any specific <em>x</em> tends to decrease as <em>x</em> increases. The probability decreases by a factor of the die size whenever we need to explode an additional time.</p><p>The value that Brennan needed to hit was 10. For the rest of the article, I will use “hitting” as a substitute for saying “rolling at least”. To figure out the probability of hitting a 10, we need to know the probability of Brennan rolling any value that is at least 10. We can find this by first calculating the probability of rolling at most a 9. The probability of rolling at least a 10 is equal to 1 minus the probability of rolling at most a 9 since the combination of those two sets includes every possible event. The function that gives the probability of getting at most a value is known as the cumulative distribution function. To calculate the CDF at <em>x </em>= 9, we will calculate each probability for values 1 through 9 and sum them up.</p><p>Plugging in the die sizes and needed value, we get the probability of hitting a 10 using a d8 as being 10.94%. This is higher than the probability when using a d6, 8.33%. In general, a die with more sides will be better than a die with fewer sides, no matter how many explosions are needed. The only time this is not the case is if we need to hit the maximum value on a die.</p><p>In the case of needing to hit the maximum value on a die, rolling a die with 2 fewer sides will be better, but only for hitting that maximum value. For example, the probability of hitting a 6 on an exploding d6 is 16.67%, but the probability of hitting a 6 on an exploding d4 is 18.75%. This is because the probabilities of all of the values above 6 have to add up to 16.67% when using a d6. We have a 16.67% chance of exploding on a d6 and we have to explode to reach values over 6. However, we have a 25% chance of exploding with a d4 and have a 75% chance of getting a 6 in total once exploded. Therefore, for this very specific case, the increase in the probability of exploding outweighs the increase in die size. Something to keep in mind for future gameplay.</p><p>This isn’t the full story, however. Brennan’s character, Evan Kelmp, had a bonus of 1 added to the roll of his smaller die. Taking this into account, rolling the smaller die is preferable. This is because we are comparing hitting a 10 on the d8 with hitting a 9 on the d6. Whenever a bonus is in play, it effectively lowers the threshold the dice need to hit and therefore increases the probability of success. So Brennan made the optimal choice by rolling the smaller die given the bonuses in play.</p><p>This answers the question I posed earlier, but we’ve just scratched the surface. Why explode on the highest value instead of the other values? Why not explode on more than one value and see what happens? We can do these things, but we will have to use some different tools. While possible to do the math by hand as we did earlier, it is more complicated to calculate the PMF and CDF when we want to explode on more than one value. Instead, we can work with expected values.</p><h4>Great Expectations</h4><p>Although we have already answered our question, we can do some more analysis. This will lead to some interesting patterns, especially when we change how we explode. This analysis is based on the expected value of the random variable.</p><p>The expected value of a random variable is the sum of the values of the possible outcomes times the probability of them happening. We can also use “mean” or “average” interchangeably with “expected value”. For a standard 6 sided die without any exploding, this looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3rWtmZdwrCXfCV_t.png" /><figcaption>Photo by Abhinav Kumar</figcaption></figure><p><em>E[X]</em> is mathematical notation meaning the expected value of a random variable <em>X</em>.</p><p>Now, let’s add the exploding mechanic and recalculate the expected value, stopping after 1 explosion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eVPwLh4cAovtVptA.png" /><figcaption>Photo by Abhinav Kumar</figcaption></figure><p>We have a 1/6 probability of rolling 1 through 5. We also have a 1/6 probability of rolling a 6, but we need to account for the next roll as well that only occurs if we roll a 6. That additional roll has the same expected value as the original roll, so we’re saying we will add the additional expected value to our total 1/6 of the time. As we can see, the expected value is of course higher. But it’s not the exact value. To get the exact expected value, we need to be able to calculate an infinite sum. To do this, let’s rewrite the prior equation slightly by combining the 2 terms and going deeper.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0Z1XeBe8sM5sXEYu.png" /><figcaption>Photo by Abhinav Kumar</figcaption></figure><p>The 21 comes from summing up the values on the die. Since each additional explosion is dependent on all the prior explosions occurring, the expected value for each roll is divided by a larger and larger value. This represents the fact that the probability of getting a certain number of explosions in a row decreases as the total number of explosions increases.</p><p>This infinite series falls under the class of <strong>geometric series</strong>. This is great because there is a simple formula for finding the sum of an infinite geometric series.</p><figure><img alt="Sum is equal to the first term in the sequence divided by 1 minus the rate of change" src="https://cdn-images-1.medium.com/max/355/0*1NqBFKsCLYgu9AMl.png" /><figcaption>Photo by Abhinav Kumar</figcaption></figure><p>In this formula, <em>a₁ </em>is<em> t</em>he first term in the series and <em>r</em> is the rate of change of the series.</p><p>For the six-sided die, <em>a₁</em> = 21/6 and <em>r </em>= 1/6. Plugging in these values we get <em>S</em> = 4.2, a significant step up from the 3.5 we get without exploding.</p><h4>Secret Formula</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxUPJPbRo2WtIQbZ7S8%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxUPJPbRo2WtIQbZ7S8%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FxUPJPbRo2WtIQbZ7S8%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/2cdd0898e6426efae4f52022d0650f81/href">https://medium.com/media/2cdd0898e6426efae4f52022d0650f81/href</a></iframe><p>At this point, we technically have a formula to calculate the expected value of an exploding die, but it’s a bit clunky. We have to write out the geometric series first and also, what if we want to explode on more than just the top value? We want the most general possible formula, and we can get it by using generic values for the number of sides of the die and the number of values on which we explode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Dydpn2dcK6yqMsZw.png" /><figcaption>Photo by Abhinav Kumar</figcaption></figure><p>In this formula, <em>n</em> is the number of die faces and <em>k</em> is the number of die faces that will cause us to explode. The Σ symbol is notation that represents a sum. We increment <em>i</em> from the value at the bottom of the Σ to the value at the top of the Σ, plug in each <em>i</em> to the expression to the right of the Σ, and add up all the values. In this case, the expression to the right of the Σ is just <em>i.</em> This means we are summing all the values from 1 to <em>n</em> without any extra operations applied to them.</p><p>We can map this expression to the specific case we looked at earlier for a d6. If we set <em>n </em>= 6 and <em>k </em>= 1, it is the same formula. What this boils down to is something very similar to the formula for the mean of a die roll. If <em>k</em> is set to 0, meaning we never explode, then it is the same since we add up all the values on the die and divide by the number of sides. Something else important to point out is that this formula doesn’t depend on which <em>k </em>sides of the die lead to exploding. All that matters is the probability of exploding, <em>k/n</em>. Exploding on a 1 will lead to the same expected value as exploding on a 6. You could even change the exploding values every time you explode and the expected value would be the same.</p><p>With this formula, we have something we can graph to answer our question another way.</p><h4>Picture Time</h4><figure><img alt="Desmos plot showing same expected value for x = 2 and 3. From then on, values increase." src="https://cdn-images-1.medium.com/max/1024/1*EoUQbeuJhYFRL4sEOKfs5Q.png" /><figcaption>Plot showing how the expected value changes with the number of die faces. For this plot, k = 1. Photo by Abhinav Kumar</figcaption></figure><p>With the above Desmos plot, which you can find <a href="https://www.desmos.com/calculator/5p2y9stmjl">here</a>, we can visually answer the question posed at the beginning: Rolling a fewer-sided die is generally not better than rolling a die with more sides assuming all the bonuses are the same. Although the probability of exploding decreases as the number of faces increases, the expected value of a single die roll increases at a faster rate except in the special case we already covered. But what if we change the value of <em>k</em>. By increasing <em>k</em>, we create a fascinating pattern.</p><figure><img alt="Desmos plot showing number of die faces vs. expected value. For this plot, k=3. The value at x=4 is 10 and decreases until x=6. x=6 and x=7 have the same value, and from then on the expected values increase." src="https://cdn-images-1.medium.com/max/1024/1*3NOXOPOVqNixpF6U5uAmwg.png" /><figcaption>Plot showing how the expected value changes with the number of die faces. For this plot, k=3. Photo by Abhinav Kumar</figcaption></figure><p>Setting <em>k </em>= 3 through the adjustable slider, we create this plot. What this says is that if we explode on 3 values, we should roll a d4 unless we can roll at least a d16 to get the highest expected value. Since the standard dice used across various roleplaying games are some subset of 4, 6, 8, 10, 12, or 20 sided dice, exploding on 3 values turns the smallest die, the d4, into the second-best possible die in the game!</p><p>A few other tidbits: You will find that for any <em>k</em> greater than 0, dice with <em>2k</em> sides and <em>2k + 1</em> sides will always have the same expected value. Dice with <em>k + 1</em> sides and <em>(k + 1)² - 1</em> sides will also always have the same expected value for any <em>k</em> greater than 0, meaning that a die with <em>k+1 </em>sides will be your best option unless you can use one with more than <em>(k + 1)² - 1</em> sides. You can prove these statements mathematically, but I’ll leave that as an exercise for anyone interested. As a hint, you can use the following formula combined with the expected value formula we already derived earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/0*Bp_RC7HOXdZVzzR5.png" /><figcaption>Photo by Abhinav Kumar</figcaption></figure><h4>In Summation</h4><p>We explored some of the mathematical foundations of probabilistic analysis and the weirdness that can occur when dice explode. We found that as long as we don’t have a smaller die with a bigger bonus than a larger die and we only explode on 1 value, choosing a smaller die is rarely beneficial. While this knowledge probably won’t change your life, it’s fun to look into how systems around us work, even if they are just dice.</p><p>Once again, feel free to leave any questions you have in the responses and I’ll do my best to answer them. If you want to learn more about dice math, <a href="https://highdicer.wordpress.com/">High Dice Roller</a> has some interesting articles. There are also plenty of resources online about probability, like <a href="https://pll.harvard.edu/course/introduction-probability-edx?delta=2">online courses</a>. Or, just roll some dice and see what happens! There are always patterns out there to explore. Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d558e36bfe5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/new-writers-welcome/exploring-dice-math-with-explosions-6d558e36bfe5">Exploring Dice Math (With Explosions!)</a> was originally published in <a href="https://medium.com/new-writers-welcome">New Writers Welcome</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>