A Monster for Every Season: Summer 2
You can get A Monster for Every Season: Summer 2 now at Gumroad
Results 1 to 27 of 27
  1. - Top - End - #1
    Firbolg in the Playground
     
    Kobold

    Join Date
    Sep 2007
    Location
    Earth... sort of.
    Gender
    Male

    Default Math in the playground

    So, as we all play RPGs, we've all probably encountered dice, and, by extension, probabilities. Now, it's pretty easy to say that 2d6 averages 7, or that if you hit half the time for an average of 7 damage your average damage per round is 3.5. That's all nice and easy.

    But there are a lot of RPG rules that play havoc with that. Partial rerolls, roll and keep, or roll and keep systems, for example.

    What can you do to analyze probabilities when these kinds of factors are in play?

    EXAMPLE (note: This isn't a real game I'm in, I'm not actually interested in the answer so much as the techniques used to derive it): I'm playing in a game of Legend of the Five Rings. When attacking, my character gets to roll 5d10, and keep the highest 3 dice. Also, 10s get rerolled and the new value is added to the old.

    First off, how the heck do I calculate the average. Then, let's say I get to choose between four new skills: One adds +5 to the total, one lets me roll two extra die, and one lets me keep an extra die, and one lets me reroll two existing die (not summing their values like with the 10s, just rerolling normally). How do I determine which one will have the greatest impact?
    Avatar by K penguin. Sash by Damned1rishman.
    MOVIE NIGHTS AND LETS PLAYS LIVESTREAMED

  2. - Top - End - #2
    Titan in the Playground
    Join Date
    May 2007
    Location
    Tail of the Bellcurve
    Gender
    Male

    Default Re: Math in the playground

    XdY keep the highest Z is just a basic order statistics problem. Google is your friend here; that should net you the joint probability mass distribution function. Then the sum is a convolution of that (ugly), and the average is just the plain old average.

    I can maybe work it out for you in generality later, when I don't have a raging headache from redoing a week's worth of code thanks to somebody else's screw-up.
    Blood-red were his spurs i' the golden noon; wine-red was his velvet coat,
    When they shot him down on the highway,
    Down like a dog on the highway,
    And he lay in his blood on the highway, with the bunch of lace at his throat.


    Alfred Noyes, The Highwayman, 1906.

  3. - Top - End - #3
    Colossus in the Playground
     
    BlackDragon

    Join Date
    Feb 2007
    Location
    Manchester, UK
    Gender
    Male

    Default Re: Math in the playground

    The other way to do it is to write a quick Excel (or OpenOffice Calc) macro that rolls the dice 100,000 times and puts the results into a spreadsheet for perusal. Yes, this isn't going to quite be the same on a computer as it would be actually rolling the dice due to the computer generating its numbers pseudo-randomly, but the result should be good enough for government work, as they say!

  4. - Top - End - #4
    Bugbear in the Playground
     
    Devil

    Join Date
    Oct 2005
    Location
    Terra Ephemera

    Default Re: Math in the playground

    Yeah, that's stuff easy.

    For the REALLY fun stuff, consider things like "I've got my wizard, what spells do I memorize not knowing what we'll come up against, and then what order do I cast them knowing this encounter has THIS monster but not knowing if the DM's going to mix up monster types or just have this be the dungeon theme? Do I go full blast early or keep a reserve? What spells do THEIR casters have prepped?"

    That's game theory. With incomplete information. FUN!

    ((To really answer your original question, I need to know what happens if you get 4 tens. Do you reroll, add, and discard the lowest, or do you discard one of the tens and then roll again? Also, what happens if you roll a 10 the second time? Do you keep rolling? Also, your skill choices depend on how you feel about variance and deviation. Is a slightly lower average an acceptable tradeoff for less predictability? Is being able to control when you get a boost from, say, a reroll worth a lower average if you can get that extra oomph on the one roll where it really counts? If so, how much is that worth and how much of your average will you trade away for it?))
    Last edited by Reltzik; 2013-10-12 at 04:00 AM.
    I'm not an evil GM! Honest!

  5. - Top - End - #5
    Firbolg in the Playground
     
    Kobold

    Join Date
    Sep 2007
    Location
    Earth... sort of.
    Gender
    Male

    Default Re: Math in the playground

    Quote Originally Posted by factotum View Post
    The other way to do it is to write a quick Excel (or OpenOffice Calc) macro that rolls the dice 100,000 times and puts the results into a spreadsheet for perusal. Yes, this isn't going to quite be the same on a computer as it would be actually rolling the dice due to the computer generating its numbers pseudo-randomly, but the result should be good enough for government work, as they say!
    That sounds like a great easy way to do it. How would one tell Excel to do something like this? I know it has a random function, but I don't know how to do a roll'n'keep or reroll lowest on Excel.

    Quote Originally Posted by Reltzik View Post
    That's stuff easy
    I'm glad to hear it! I went with these questions to my college's stats tutoring center and they seemed to believe that calculating the distribution of something like that would involve more complex math than anyone without a lot of advanced training was capable of, and said that I could go talk to the stats professor in charge of probability, but she probably wouldn't be able to help me because the calculations would be so complicated.

    Quote Originally Posted by Reltzik View Post
    ((To really answer your original question, I need to know what happens if you get 4 tens. Do you reroll, add, and discard the lowest, or do you discard one of the tens and then roll again? Also, what happens if you roll a 10 the second time? Do you keep rolling?
    Exploding tens would be calculated first, since those aren't true rerolls- Rolling a 10 and then a 7 is treated as though you'd somehow managed to make "17" come up on a ten sided die. 10s can indeed continue to explode, so rolling 10-10-10-6 would be considered rolling a 36 on that die.

    Quote Originally Posted by Reltzik View Post
    Also, your skill choices depend on how you feel about variance and deviation. Is a slightly lower average an acceptable tradeoff for less predictability? Is being able to control when you get a boost from, say, a reroll worth a lower average if you can get that extra oomph on the one roll where it really counts? If so, how much is that worth and how much of your average will you trade away for it?))
    Well, what I'd really like is access to the tools needed to see the data for myself, since this scenario is purely hypothetical, and how I feel about variability would depend on the risks and rewards involved with any given type of check.
    Avatar by K penguin. Sash by Damned1rishman.
    MOVIE NIGHTS AND LETS PLAYS LIVESTREAMED

  6. - Top - End - #6
    Bugbear in the Playground
     
    shawnhcorey's Avatar

    Join Date
    Dec 2010
    Location
    The Great White North
    Gender
    Male

    Default Re: Math in the playground

    Or just play Fate.

    Exploding d10:

    Code:
    roll              probability
    
    1 - 9             1/10
    11 - 19           1/100
    21 - 29           1/1,000
    31 - 39           1/10,000
    ...
    (Stop when you get tired.)

    You will notice some numbers missing. With exploding dice, these are impossible to get.
    How do you keep a fool busy? Turn upside down for answer.
    ˙ɹǝʍsuɐ ɹoɟ uʍop ǝpısdn uɹnʇ ʎsnq ןooɟ ɐ dǝǝʞ noʎ op ʍoɥ

  7. - Top - End - #7
    Ogre in the Playground
     
    Flumph

    Join Date
    Nov 2006
    Location
    England. Ish.
    Gender
    Male

    Default Re: Math in the playground

    Quote Originally Posted by shadow_archmagi View Post
    That sounds like a great easy way to do it. How would one tell Excel to do something like this? I know it has a random function, but I don't know how to do a roll'n'keep or reroll lowest on Excel.
    This is where you would start writing your own functions. a few Visual Basic for Applications functions will give you all the flexibility you need.

    EDIT: If you really need something like this I can probably knock it together. You'll need to say exactly what you need, though...

    EDIT the Second: Just coded up the basic Roll 5/Add d10 to tens/Keep the top Three (I'm bored...): It seems to be averaging out at 24.1733
    (Provided I am coding right...)
    Last edited by Manga Shoggoth; 2013-10-12 at 12:49 PM.
    Warning: This posting may contain wit, wisdom, pathos, irony, satire, sarcasm and puns. And traces of nut.

    "The main skill of a good ruler seems to be not preventing the conflagrations but rather keeping them contained enough they rate more as campfires." Rogar Demonblud

    "Hold on just a d*** second. UK has spam callers that try to get you to buy conservatories?!? Even y'alls spammers are higher class than ours!" Peelee

  8. - Top - End - #8
    Bugbear in the Playground
     
    Devil

    Join Date
    Oct 2005
    Location
    Terra Ephemera

    Default Re: Math in the playground

    Quote Originally Posted by shadow_archmagi View Post
    I'm glad to hear it! I went with these questions to my college's stats tutoring center and they seemed to believe that calculating the distribution of something like that would involve more complex math than anyone without a lot of advanced training was capable of, and said that I could go talk to the stats professor in charge of probability, but she probably wouldn't be able to help me because the calculations would be so complicated.
    Oh heavens no, you don't need complex math. I suppose you could do something with moments and fourier transforms, but they're not necessary.

    Quote Originally Posted by shadow_archmagi View Post
    Exploding tens would be calculated first, since those aren't true rerolls- Rolling a 10 and then a 7 is treated as though you'd somehow managed to make "17" come up on a ten sided die. 10s can indeed continue to explode, so rolling 10-10-10-6 would be considered rolling a 36 on that die.
    Shawn got the distribution on a single (potentially exploding) roll right. We can actually consider this two variables: A) What's the roll that we terminate on? (the one that isn't 0). B) How many 0s do we roll first? We take A and add it to 10^B for our result, and because the sum of the expected value of each of these will give us the expected value of the sum, calculating the average easy. A is a uniform integer distribution on [1,9] and has an average of 5. B can be calculated by geometric series. There's a 90% chance that B = 0, a 9% chance that B = 1, a 0.9% chance that B = 2, and so on, which gives us a series of .9*0 + .09*10 + .009*100 + holy crap that's just .9 added to itself forever the expected value of this roll is fricking INFINITE.

    .... excuse me. I'm going to go bash my head against the wall and contemplate the idiocy of game designers.

    But no, wait, you're contending against a fixed number of hit points, aren't you? So if the schmuck has 28 HP, your range of outcomes is something like "I do 3, 4, 5, 6, etc points of damage", except the range of outcomes doesn't actually go on to infinity but instead terminates as "... 26 points, 27 points, DEAD AND I DON'T CARE WHETHER IT WAS 28 POINTS OR 28 MILLION).

    .... okay. You probably do care. Because that would be awesome.

    In any event, that distribution for a single die is pretty easy to build up. I'll be back later to process multiple dice (and discarding low rolls) if someone else doesn't get to it.
    I'm not an evil GM! Honest!

  9. - Top - End - #9
    Titan in the Playground
     
    Kato's Avatar

    Join Date
    Apr 2008
    Location
    Germany
    Gender
    Male

    Default Re: Math in the playground

    Quote Originally Posted by shadow_archmagi View Post
    That sounds like a great easy way to do it. How would one tell Excel to do something like this? I know it has a random function, but I don't know how to do a roll'n'keep or reroll lowest on Excel.
    Well, I wouldn't use excel but a proper programming language like python (if and while commands are your best friend) but maybe that's just because I'm more used to it but if you get into the basics of programming that's something you can pretty fast put together. A system I play (The Dark Eye) also has rules which make it kind of hard to estimate the chances of success at first glance and at some point I had thrown together a program to calculate it just by rolling a few thousand rolls. I misplaced it but I think it shouldn't take more than an hour to put this together, probably much less.
    Good chance to learn some programming, too.
    "What's done is done."

    Pony Avatar thanks to Elemental

  10. - Top - End - #10
    Colossus in the Playground
     
    BlackDragon

    Join Date
    Feb 2007
    Location
    Manchester, UK
    Gender
    Male

    Default Re: Math in the playground

    Quote Originally Posted by Reltzik View Post
    which gives us a series of .9*0 + .09*10 + .009*100 + holy crap that's just .9 added to itself forever the expected value of this roll is fricking INFINITE.

    .... excuse me. I'm going to go bash my head against the wall and contemplate the idiocy of game designers.
    Rolemaster RPG system had a similar thing--everything in that game was done via d100, but the rule was that you re-rolled and added to the original on a 95 or greater (I think, it's a long time since I played the game), and rolled and subtracted if you got less than 5. This was the game I was playing on the glorious occasion where I managed something like 358 on a roll.

    Of course, the "infinite maximum" issue wasn't an issue in Rolemaster, because the result of your roll was used as an index into a table which told you exactly what happened--I think those tables topped out at 400 or thereabouts, so there was no point rolling if you went past that point. (For some reason, when rolling d100 on the critical hit tables, 66 was always the worst one--you really didn't want to roll that if you'd just sustained an E (e.g. the worst possible) critical, because they were always instantly fatal!

  11. - Top - End - #11
    Ogre in the Playground
     
    Flumph

    Join Date
    Nov 2006
    Location
    England. Ish.
    Gender
    Male

    Default Re: Math in the playground

    OK. These are the results I have come up with (rolling the dice a given number of times).

    {table=head] Method | Average
    Number of Iterations | 10,000
    Basic Throw 5/Keep 3 | 24.10
    Basic Throw 5/Keep 3 + 5 | 29.29
    Basic Throw 5/Keep 3 + 2d10 | 35.28
    Throw 5/Keep 4 | 28.22
    Throw 5 Reroll 2 Keep 3 | 26.61
    [/table]

    The Excel spreadsheet in question is available on request should you wish to check my code (and should be fairly easy to expand if you want to fiddle more...).

    (Edit: The spreadsheet doesn't do the exploding tens, it just adds an extra roll if you get a ten. I'll add that later...)

    (Edit 2: That was quick... Now with exploding tens...

    {table=head] Method | Average
    Number of Iterations | 10,000
    Basic Throw 5/Keep 3 | 24.46
    Basic Throw 5/Keep 3 + 5 | 29.47
    Basic Throw 5/Keep 3 + 2d10 | 35.50
    Throw 5/Keep 4 | 28.37
    Throw 5 Reroll 2 Keep 3 | 28.19
    [/table]

    The exploding tens don't make much of a difference as they don't occur too often - the chances of getting two tens in a row are relatively insignificant)
    Last edited by Manga Shoggoth; 2013-10-12 at 03:32 PM.
    Warning: This posting may contain wit, wisdom, pathos, irony, satire, sarcasm and puns. And traces of nut.

    "The main skill of a good ruler seems to be not preventing the conflagrations but rather keeping them contained enough they rate more as campfires." Rogar Demonblud

    "Hold on just a d*** second. UK has spam callers that try to get you to buy conservatories?!? Even y'alls spammers are higher class than ours!" Peelee

  12. - Top - End - #12
    Titan in the Playground
     
    Kato's Avatar

    Join Date
    Apr 2008
    Location
    Germany
    Gender
    Male

    Default Re: Math in the playground

    Huh, for some curious reason the impact of the exploding tens on the last row seems to be massively bigger than on anything else. I wonder why that is?

    Great, now I feel compelled to also write a program to check those numbers Not that I dont trust Manga, I just think it would be "fun". (And by that I mean I need to satisfy my compulsions)
    "What's done is done."

    Pony Avatar thanks to Elemental

  13. - Top - End - #13
    Firbolg in the Playground
     
    Kobold

    Join Date
    Sep 2007
    Location
    Earth... sort of.
    Gender
    Male

    Default Re: Math in the playground

    Quote Originally Posted by Manga Shoggoth View Post
    The Excel spreadsheet in question is available on request should you wish to check my code (and should be fairly easy to expand if you want to fiddle more...).
    Oh, I'd love that!
    Avatar by K penguin. Sash by Damned1rishman.
    MOVIE NIGHTS AND LETS PLAYS LIVESTREAMED

  14. - Top - End - #14
    Titan in the Playground
     
    Kato's Avatar

    Join Date
    Apr 2008
    Location
    Germany
    Gender
    Male

    Default Re: Math in the playground

    Hm.... my results differ quite a bit more than expected from Manga's... Admittedly, I won't say my code couldn't be bugged and I entirely ignored double exploding dice but it still seems off to me. I'll post my numbers:


    {table=head] Method | without explosions | with explosions
    Basic Throw 5/Keep 3 | 20.49 | 22.75
    Basic Throw 5/Keep 3 + 5 | 25.49 | 27.75
    Basic Throw 5/Keep 3 + 2d10 | 30.52 | 33.64
    Throw 5/Keep 4 | 23.65 | 25.92
    Throw 5 Reroll 2 Keep 3 | 22.89 | 26.05
    [/table]

    I would look for the error on my part first but thinking about it even with the pick of best dice, an average of 24 seems high, considering you'd have 3*5.5=16.5 average without it. I'm confused what's to blame.
    Last edited by Kato; 2013-10-12 at 05:54 PM.
    "What's done is done."

    Pony Avatar thanks to Elemental

  15. - Top - End - #15
    Ogre in the Playground
     
    Flumph

    Join Date
    Nov 2006
    Location
    England. Ish.
    Gender
    Male

    Default Re: Math in the playground

    Quote Originally Posted by shadow_archmagi View Post
    Oh, I'd love that!
    Sure. PM me with an email address and I'll send it on. It will be at least tomorrow as I need to go to bed now...


    Quote Originally Posted by Kato View Post
    Hm.... my results differ quite a bit more than expected from Manga's... Admittedly, I won't say my code couldn't be bugged and I entirely ignored double exploding dice but it still seems off to me.
    ...
    I would look for the error on my part first but thinking about it even with the pick of best dice, an average of 24 seems high, considering you'd have 3*5.5=16.5 average without it. I'm confused what's to blame.
    There were a few bugs in my code (It isn't the best piece of coding I have ever been guilty of, and was rather rushed). For what it is worth, my basic functions are:

    Code:
    Function fnThrow5(pintKeep As Integer, pintExchange As Integer) As Integer
    '
    ' This function returns a dice roll as follows:
    '
    ' - Throw 5 d10
    ' - If any value is a 10, then add an additional d10. Exploding D10s this time.
    ' - Only use the top X values
    '
    Dim arrDice(5) As Integer
    Dim intI As Integer
    Dim intTempValue As Integer
    Dim bClear As Boolean
    Dim intExtraD10 As Integer
    
    '
    ' First, throw the five dice.
    '
        For intI = 1 To 5
            arrDice(intI) = Int(Rnd() * 10) + 1
        Next intI
    '    Debug.Print "Base", arrDice(1), arrDice(2), arrDice(3), arrDice(4), arrDice(5)
    
    '
    ' If a number is a 10, then add an additional d10
    '
        For intI = 1 To 5
            If arrDice(intI) = 10 Then
                Do
                    intExtraD10 = Int(Rnd() * 10) + 1
                    arrDice(intI) = arrDice(intI) + intExtraD10
                Loop Until intExtraD10 <> 10
            End If
        Next intI
    '    Debug.Print "Post 10", arrDice(1), arrDice(2), arrDice(3), arrDice(4), arrDice(5)
    
    '
    ' Now sort the values (a basic bubble sort is our friend here)
    '
        Do
            bClear = True
            For intI = 1 To 4
                If arrDice(intI) < arrDice(intI + 1) Then
                    intTempValue = arrDice(intI)
                    arrDice(intI) = arrDice(intI + 1)
                    arrDice(intI + 1) = intTempValue
                    bClear = False
                End If
            Next intI
        Loop Until bClear
    '    Debug.Print "Sort 1", arrDice(1), arrDice(2), arrDice(3), arrDice(4), arrDice(5)
        
    '
    ' Replace the bottom X dice with new throws and resort
    ' (We assume that if this is done both the dice must be replaced
    ' even if they are >10. We do the lowest dice as it would not make
    ' sense to rethrow the higher ones)
    '
        If pintExchange > 0 Then
        
            For intI = 1 To pintExchange
                arrDice(5 - (intI - 1)) = Int(Rnd() * 10) + 1
            Next intI
            For intI = 1 To pintExchange
                If arrDice(5 - (intI - 1)) = 10 Then
                    Do
                        intExtraD10 = Int(Rnd() * 10) + 1
                        arrDice(5 - (intI - 1)) = arrDice(5 - (intI - 1)) + intExtraD10
                    Loop Until intExtraD10 <> 10
                End If
            Next intI
    '        Debug.Print "Exchange", arrDice(1), arrDice(2), arrDice(3), arrDice(4), arrDice(5)
            
            Do
                bClear = True
                For intI = 1 To 4
                    If arrDice(intI) < arrDice(intI + 1) Then
                        intTempValue = arrDice(intI)
                        arrDice(intI) = arrDice(intI + 1)
                        arrDice(intI + 1) = intTempValue
                        bClear = False
                    End If
                Next intI
            Loop Until bClear
    '        Debug.Print "Sort 2", arrDice(1), arrDice(2), arrDice(3), arrDice(4), arrDice(5)
    
        End If
    
    '
    ' Now that we have our sorted array, sum the highest X values.
    '
        intTempValue = 0
        For intI = 1 To pintKeep
            intTempValue = intTempValue + arrDice(intI)
        Next intI
    
    '
    ' Pass the values back to the caller.
    '
        fnThrow5 = intTempValue
    
    End Function

    And to call it (This pulls the number of iterations from the Control worksheet and writes all the numbers generated to the Numbers worksheet - the averages are then generated by the standard worksheet functions, but you don't see that here...):


    Code:
    '
    ' Pull the number of iterations from the worksheet, and let the dice roll
    '
    ' Column 1 is the basic Throw 5/Keep 3
    ' Column 2 is the basic Throw 5/Keep 3 plus 5
    ' Column 3 is the basic Throw 5/Keep 3 plus 2d10
    ' Column 4 is Throw 5/Keep 4
    ' Column 5 is the basic Throw 5/Keep 3 rethrowing the last two without bonus
    '
        lngIterations = Sheets("Control").Cells(3, 3).Value
        For lngI = 1 To lngIterations
            Sheets("Numbers").Cells(lngI, 1) = fnThrow5(3, 0)
            Sheets("Numbers").Cells(lngI, 2) = fnThrow5(3, 0) + 5
            Sheets("Numbers").Cells(lngI, 3) = fnThrow5(3, 0) + Int(Rnd() * 10) + 1 + Int(Rnd() * 10) + 1
            Sheets("Numbers").Cells(lngI, 4) = fnThrow5(4, 0)
            Sheets("Numbers").Cells(lngI, 5) = fnThrow5(3, 2)
        Next lngI
    Warning: This posting may contain wit, wisdom, pathos, irony, satire, sarcasm and puns. And traces of nut.

    "The main skill of a good ruler seems to be not preventing the conflagrations but rather keeping them contained enough they rate more as campfires." Rogar Demonblud

    "Hold on just a d*** second. UK has spam callers that try to get you to buy conservatories?!? Even y'alls spammers are higher class than ours!" Peelee

  16. - Top - End - #16
    Titan in the Playground
    Join Date
    May 2007
    Location
    Tail of the Bellcurve
    Gender
    Male

    Default Re: Math in the playground

    Quote Originally Posted by Reltzik View Post
    O A is a uniform integer distribution on [1,9] and has an average of 5. B can be calculated by geometric series. There's a 90% chance that B = 0, a 9% chance that B = 1, a 0.9% chance that B = 2, and so on, which gives us a series of .9*0 + .09*10 + .009*100 + holy crap that's just .9 added to itself forever the expected value of this roll is fricking INFINITE.

    .... excuse me. I'm going to go bash my head against the wall and contemplate the idiocy of game designers.
    I think this is more a flaw of using expected value as a summary statistic for extremely skewed distributions. Infinitesimal chances of absurdly large outcomes don't, except in the measure theoretic definition, really tell you anything about what will or will not happen.
    Blood-red were his spurs i' the golden noon; wine-red was his velvet coat,
    When they shot him down on the highway,
    Down like a dog on the highway,
    And he lay in his blood on the highway, with the bunch of lace at his throat.


    Alfred Noyes, The Highwayman, 1906.

  17. - Top - End - #17
    Bugbear in the Playground
     
    Devil

    Join Date
    Oct 2005
    Location
    Terra Ephemera

    Default Re: Math in the playground

    Quote Originally Posted by warty goblin View Post
    I think this is more a flaw of using expected value as a summary statistic for extremely skewed distributions. Infinitesimal chances of absurdly large outcomes don't, except in the measure theoretic definition, really tell you anything about what will or will not happen.
    It's true that the expected value isn't that great a measure in this case, but discovering that it's infinite does shed some light on why "plug the formula into a computer and have it chug through a few million iterations" isn't going to give usable results.

    EDIT: To answer the OP's original question, there isn't any "do this and it works" algorithms or tools. If there were, all statistics people would have been replaced by computers by now. A lot of the problem here is figuring out what to ask, eg, "what's the average damage" proved a bad question to ask but "what are the odds I'll do at least ____ damage" was better. I think what you'd find most useful are cumulative distribution graphs for each roll, overlaid for comparison.
    Last edited by Reltzik; 2013-10-12 at 08:27 PM.
    I'm not an evil GM! Honest!

  18. - Top - End - #18
    Ettin in the Playground
     
    Kobold

    Join Date
    May 2005
    Location
    Somerville, MA
    Gender
    Male

    Default Re: Math in the playground

    Quote Originally Posted by factotum View Post
    Of course, the "infinite maximum" issue wasn't an issue in Rolemaster, because the result of your roll was used as an index into a table which told you exactly what happened--I think those tables topped out at 400 or thereabouts, so there was no point rolling if you went past that point.
    Couldn't you lower yourself back to table territory with bad rolls though? ie, if you're at 500 and roll under 05 for a few rolls, you'd go back down.
    If you like what I have to say, please check out my GMing Blog where I discuss writing and roleplaying in greater depth.

  19. - Top - End - #19
    Surgebinder in the Playground Moderator
     
    Douglas's Avatar

    Join Date
    Aug 2005
    Location
    Mountain View, CA
    Gender
    Male

    Default Re: Math in the playground

    Quote Originally Posted by Reltzik View Post
    There's a 90% chance that B = 0, a 9% chance that B = 1, a 0.9% chance that B = 2, and so on, which gives us a series of .9*0 + .09*10 + .009*100 + holy crap that's just .9 added to itself forever the expected value of this roll is fricking INFINITE.

    .... excuse me. I'm going to go bash my head against the wall and contemplate the idiocy of game designers.
    Except the portion of the outcome from B is not 10^B, but merely 10*B. It's the sum of .9*0 + .09*10 + .009*20 + .0009*30, etc., which is most certainly not infinite. This is a bit messy of a series to calculate the sum of, but there's an easier way to solve the problem.

    If B is the number of 0s you get on the exploding die, you have a 90% chance of B = 0 and a 10% chance of starting over and adding 1.
    Bavg = (.9 * 0) + (0.1 *(1 + Bavg))
    Bavg = 0.1 + .1*Bavg
    0.9*Bavg = 0.1
    Bavg = 0.1/0.9 = 1/9

    B averages 1/9, and you get 10*B added to the total, so average 10/9. Add the average of the final die, and you get an average total of 6.1111111111111...
    Like 4X (aka Civilization-like) gaming? Know programming? Interested in game development? Take a look.

    Avatar by Ceika.

    Archives:
    Spoiler
    Show
    Saberhagen's Twelve Swords, some homebrew artifacts for 3.5 (please comment)
    Isstinen Tonche for ECL 74 playtesting.
    Team Solars: Powergaming beyond your wildest imagining, without infinite loops or epic. Yes, the DM asked for it.
    Arcane Swordsage: Making it actually work (homebrew)

  20. - Top - End - #20
    Ogre in the Playground
     
    Flumph

    Join Date
    Nov 2006
    Location
    England. Ish.
    Gender
    Male

    Default Re: Math in the playground

    Quote Originally Posted by Reltzik View Post
    It's true that the expected value isn't that great a measure in this case, but discovering that it's infinite does shed some light on why "plug the formula into a computer and have it chug through a few million iterations" isn't going to give usable results.
    You are missing something here - although you could get an infinite number of rolls here, the additional roll requires you to get a 10 on a d10, and every additional bonus roll also expects you to get a 10 to continue.

    This is why the "plug the formula in a computer" - aka simulation - approach works - it shows you very quickly how the rolls will work in practice, without having to throw the dice X thousand times. Simulation is a powerful tool, whether done by computers or real models.

    And what it shows is that over time the lower and more likley results dominate. It is true that you could get an infinite series of 10s. It is also true that brownian motion could cause all the oxygen molecules to drift over to the opposite end of the room - theoretically possible, but not going to happen in my lifetime. Not more than once, anyway.

    In practice, you very quickly get up to a maximum of 4 bonus throws in a roll (by around 500 iterations, in fact), but after that an increase in the maximum number drops off sharply - in 10,000 iterations, the longest bonus chain I have seen is 7, and most runs yeild 5 or occasionally 6.

    The spreadsheet I was using had auto-calculation turned on, so I could see the average values change as the spreadsheet went through the rolls. The average stablises very quickly - somewhere between 500 and 1000 the first two significant figures are stable, and between 1000 and 10000 the first decimal place stablises.

    The maxima and minima also "stablise" very quickly - pretty stable by the 500 and 1000 mark, and very stable past the 5000 mark.

    Quote Originally Posted by Reltzik View Post
    EDIT: To answer the OP's original question, there isn't any "do this and it works" algorithms or tools. If there were, all statistics people would have been replaced by computers by now. A lot of the problem here is figuring out what to ask, eg, "what's the average damage" proved a bad question to ask but "what are the odds I'll do at least ____ damage" was better. I think what you'd find most useful are cumulative distribution graphs for each roll, overlaid for comparison.
    EDIT: Having added distributions to the spreadsheet - unsurprisingly the distribution is somewhat skewed, shifted to the lower end of the spectrum. I really need to get out more...
    Last edited by Manga Shoggoth; 2013-10-13 at 05:27 AM. Reason: Removed response as I may have misunderstood the quote, added bit about distributions.
    Warning: This posting may contain wit, wisdom, pathos, irony, satire, sarcasm and puns. And traces of nut.

    "The main skill of a good ruler seems to be not preventing the conflagrations but rather keeping them contained enough they rate more as campfires." Rogar Demonblud

    "Hold on just a d*** second. UK has spam callers that try to get you to buy conservatories?!? Even y'alls spammers are higher class than ours!" Peelee

  21. - Top - End - #21
    Colossus in the Playground
     
    BlackDragon

    Join Date
    Feb 2007
    Location
    Manchester, UK
    Gender
    Male

    Default Re: Math in the playground

    Quote Originally Posted by valadil View Post
    Couldn't you lower yourself back to table territory with bad rolls though? ie, if you're at 500 and roll under 05 for a few rolls, you'd go back down.
    You're probably right...I don't think the situation ever arose, though, so I don't actually know what the rules for dealing with it were.

  22. - Top - End - #22
    Ogre in the Playground
    Join Date
    Oct 2011
    Location
    The last place you look
    Gender
    Male

    Default Re: Math in the playground

    Quote Originally Posted by shadow_archmagi View Post
    First off, how the heck do I calculate the average. Then, let's say I get to choose between four new skills: One adds +5 to the total, one lets me roll two extra die, and one lets me keep an extra die, and one lets me reroll two existing die (not summing their values like with the 10s, just rerolling normally). How do I determine which one will have the greatest impact?
    However, there's another stat not a play here. The variance.

    Pretend there are two abilities available. One has you roll 13d6, the other has you roll 7d12. Both give you an expected roll of 45.5, but you're more likely to roll closer to that on the 13d6. This is where the variance comes in. The variance of the first one is 13*(6-1)/12 = 493. The variance of the second one is 7*(12-1)/12 = 584. (Okay, so those aren't too different, but you get the point)

    The catch is, though, that the variance involves averaging the squares of the values, which in this case is particularly nasty. I'll get back possibly later today, possibly in a day or two with a solution. (Real-life stuff getting in the way)

    Oh, and for anyone else with knowledge of advanced stats, my plan is to use moment generating functions.
    Last edited by Razanir; 2013-10-13 at 09:33 AM.
    Avatar by Venetian Mask. It's of an NPC from a campaign I may yet run (possibly in PbP) who became a favorite of mine while planning.

    Quote Originally Posted by Razanir View Post
    Everyone knows frying pans are actually weapons that people repurpose for cooking
    I am a 10/14/11/15/12/14 LG Clr 2

  23. - Top - End - #23
    Titan in the Playground
    Join Date
    May 2007
    Location
    Tail of the Bellcurve
    Gender
    Male

    Default Re: Math in the playground

    Really, what you want is an expression for the actual distribution, or at least a histogram from a decent number of simulations to estimate the CDF. This is a probability problem, not a statistics question, so there's really very little reason to mess around with summary statistics of any sort.
    Blood-red were his spurs i' the golden noon; wine-red was his velvet coat,
    When they shot him down on the highway,
    Down like a dog on the highway,
    And he lay in his blood on the highway, with the bunch of lace at his throat.


    Alfred Noyes, The Highwayman, 1906.

  24. - Top - End - #24
    Ogre in the Playground
     
    AttilaTheGeek's Avatar

    Join Date
    Nov 2012
    Location
    Boston (UTC-5)
    Gender
    Male

    Default Re: Math in the playground

    How has Anydice not been mentioned? No need to bother writing stuff up in Excel, just write "output [highest 3 of 5d10]" and it'll give you a mean of 21.46 with a standard deviation of 4.35 in less than a second. There's no need to write up an entire block of stuff for excel! Let me summarize his entire attack routine in a one-liner:

    When attacking, my character gets to roll 5d10, and keep the highest 3 dice. Also, 10s get rerolled and the new value is added to the old. -
    Code:
    output [highest 3 of 5d[explode d10]]
    For the "four new skills" you mentioned, it only takes four lines.

    Then, let's say I get to choose between four new skills: One adds +5 to the total, one lets me roll two extra die, and one lets me keep an extra die, and one lets me reroll two existing die (not summing their values like with the 10s, just rerolling normally). How do I determine which one will have the greatest impact?
    1. output [highest 3 of 5d[explode d10]]+5, average 29.48, standard dev. 8.06.
    2. output [highest 3 of 7d[explode d10]]], average 28.17, standard dev. 8.40.
    3. output [highest 4 of 5d[explode d10]], average 28.32. standard dev. 9.04.
    4. And I don't understand what you mean by the fourth one. Do you (1) explode 5 d10 separately, (2) reroll the lowest two, then (3) take the highest 3 of those?
    Homebrew: Temporalist Quotebox Avatar by Kris on a Stick
    Blue is for sarcasm Call me Attila

  25. - Top - End - #25
    Firbolg in the Playground
     
    Kobold

    Join Date
    Sep 2007
    Location
    Earth... sort of.
    Gender
    Male

    Default Re: Math in the playground

    Oh hey wow. Anydice looks like an automated version of exactly the thing I needed. Thank goodness the internet has everything, and thank you so much Attila for pointing me to this!
    Avatar by K penguin. Sash by Damned1rishman.
    MOVIE NIGHTS AND LETS PLAYS LIVESTREAMED

  26. - Top - End - #26
    Troll in the Playground
     
    Cuthalion's Avatar

    Join Date
    May 2012
    Location
    California
    Gender
    Male

    Default Re: Math in the playground

    Quote Originally Posted by shadow_archmagi View Post
    So, as we all play RPGs, we've all probably encountered dice, and, by extension, probabilities. Now, it's pretty easy to say that 2d6 averages 7, or that if you hit half the time for an average of 7 damage your average damage per round is 3.5. That's all nice and easy.

    But there are a lot of RPG rules that play havoc with that. Partial rerolls, roll and keep, or roll and keep systems, for example.

    What can you do to analyze probabilities when these kinds of factors are in play?

    EXAMPLE (note: This isn't a real game I'm in, I'm not actually interested in the answer so much as the techniques used to derive it): I'm playing in a game of Legend of the Five Rings. When attacking, my character gets to roll 5d10, and keep the highest 3 dice. Also, 10s get rerolled and the new value is added to the old.

    First off, how the heck do I calculate the average. Then, let's say I get to choose between four new skills: One adds +5 to the total, one lets me roll two extra die, and one lets me keep an extra die, and one lets me reroll two existing die (not summing their values like with the 10s, just rerolling normally). How do I determine which one will have the greatest impact?
    What are dice?
    Spoiler: Quote(s)
    Show
    Quote Originally Posted by Temotei View Post
    You're my favorite.
    Quote Originally Posted by Kneenibble View Post
    I'll kill them! I'll kill all of them!
    Quote Originally Posted by FinnLassie View Post
    We're crashing Wombat's wedding! WITH AN ARMY OF WOMBATS AND BUDGIES.


    "So whosoever is a hedgehog let him see to it that his wife is a hedgehog also, and so forth."

  27. - Top - End - #27
    Bugbear in the Playground
     
    Devil

    Join Date
    Oct 2005
    Location
    Terra Ephemera

    Default Re: Math in the playground

    Quote Originally Posted by douglas View Post
    Except the portion of the outcome from B is not 10^B, but merely 10*B. It's the sum of .9*0 + .09*10 + .009*20 + .0009*30, etc., which is most certainly not infinite. This is a bit messy of a series to calculate the sum of, but there's an easier way to solve the problem.

    If B is the number of 0s you get on the exploding die, you have a 90% chance of B = 0 and a 10% chance of starting over and adding 1.
    Bavg = (.9 * 0) + (0.1 *(1 + Bavg))
    Bavg = 0.1 + .1*Bavg
    0.9*Bavg = 0.1
    Bavg = 0.1/0.9 = 1/9

    B averages 1/9, and you get 10*B added to the total, so average 10/9. Add the average of the final die, and you get an average total of 6.1111111111111...
    Okay, so it was a dumb math mistake on MY part instead of the game designers.

    ....

    *bashes head against wall*
    I'm not an evil GM! Honest!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •