# Help with a math problem?

12 replies [Last post]
BMinNY
Offline
Joined: 03/07/2012

I am hoping someone here can help me sort out a little math dilemma that I am having with my game ending event...

I have been toying with the idea of a 6d being rolled at the end of each round of play. If it is 1-5, nothing happens. It is only important if it is a 6. After the third 6 is rolled, that begins the end of the game - actually it signals that each player will lead one more round.

What I would like to know are the mathematical probabilities of when the 3rd six is going to show. For example, what is the percentage that it will be on the third roll, the fourth roll, the fifth roll, etc. Does anyone know a formula for this? Additionally, I would like to be able to obtain the same information for the 4th 6 being rolled.

Thanks!

BlueRift Offline
Joined: 04/01/2012
Math

I don't have time at the moment to explain how it's done (maybe tomorrow). The average number of turns required to get 3 6's rolling once a turn is 18 (3*6).

The equation for the probability of rolling a first six one each turn is this equation: the probability of not getting a six (5/6), raised to the power of the number of turns it is minus one, times the probably of getting a six (1/6). It's easy to do in excel using this equation:

((5/6)^(Turn-1))*(1/6)

You figure out the probability of rolling the 1st six by summing all the probabilities of each turn and the ones before it. Like turn 1 is 16.67% and turn 2 is 30.56% (which is 16.67% + 13.89%) these numbers are found using the above equation. Here are the probabilities of rolling 1 six, two and three are more complicated and will have to wait:

Turn 1: 16.67%
Turn 2: 30.56%
Turn 3: 42.13%
Turn 4: 51.77%
Turn 5: 59.81%
Turn 6: 66.51%
Turn 7: 72.09%
Turn 8: 76.74%
Turn 9: 80.62%
Turn 10: 83.85%

You should note that this probability will never reach 100% (in mathematical turns) this will end up with your game having widely ranging lengths. They could be as short as 3 turns or as long as 40 or more. Chances are that it will average 18 turns but with a wide variance.

I recommend an alternative method for determining game length that will result in a random but more consistent number. You could add the numbers together (which would be too math heavy to work) but results in a nicely predictable bell curve.

Consider a model like Warhammer 40k where you roll a something like a 3+ and the game continues on turn 5, 4+ on turn 6, and a 5+ on turn 7. Those are the real numbers but you get the idea.

MarkKreitler Offline
Joined: 11/12/2008
Binomial Distribution

Check out the binomial distribution (http://en.wikipedia.org/wiki/Binomial_distribution). There's a catch which I'll discuss at the end.

p = 1/6 (the probability of rolling a 6),
n = the number of rolls for which you want to compute the chances of getting the third 6,
k = 3 (the number of suksesses, meaning "6" results, which, for you, is always 3 times). Sorry about the "successes" mnemonic -- I know it hurts.

The general formula is

n! / (k! * (n - k)!) all times p ^ k * (1 - p) ^ (n - k) = Probability of success

where ^ means "to the power of".

So, to find the odds of rolling 3 sixes in 4 rolls, you would have:

p = 1/6
n = 4
k = 3

Probability of success = 4! / (3! * (4 - 3)!) * (1/6) ^ 3 * (5/6) ^ (4 - 3)
or
P(success) = 4! / (3! * 1!) * (1/6)^3 * (5/6)^1
P(success) = 1 * 2 * 3 * 4 / (1 * 2 *3 * 1) * (1/6) * (1/6) * (1/6) * (5/6)
P(success) = 4 * (1/6) * (1/6) * (1/6) * (5/6)
P(success) = 4 * 5 / (6 * 6 * 6 * 6)
P(success) = 5 / (3 * 3 * 6 * 6)
P(success) = 5 / (9 * 36) which is 5 / (270 + 54) or 5 / 324 or approximately 1 / 65.

So, what's the catch?

As far as I know (and I could be wrong), if you're computing the chance of success in 4 rolls, that includes the chance of succeeding in the first three rolls. In other words, your 4 rolls could look like any of these cases (where '*' means "wasn't a 6"):

* 6 6 6
6 * 6 6
6 6 * 6
6 6 6 *

But in the last case, you would never have reached the fourth roll -- the game ends after the 3rd six.

So, in order to use the binomial equation, you need to keep track of all previous success and subtract them out of later results.

For example, if P(3) is the probability of succeeding in exactly 3 rolls, then
P(4) = Binomial result with (n=4, k=3, and p=1/6) - P(3).

Similarly, P(5) -- the chance of succeeding in exactly 5 rolls -- is:

P(5) = Binomial result with (n=5, k=3, and p=1/6) - [P(4) + P(3)],

or, if you like:

P(5) = Binomial result with (n=5, k=3, and p=1/6) - Binomial result with (n=4, k=3, and p=1/6).

So, really, to get the results for any number of rolls N, just compute the Binomial result for N and subtract off the Binomial result for N - 1.

Now a caveat on the caveat -- I'm not good at statistics, and I probably messed that up, so for goodness' sake, *double check this* with someone who can actually do math!

BMinNY
Offline
Joined: 03/07/2012
THANKS BLUERIFT!

BlueRift - First let me say thank you, that was AWESOME! Thank you, thank you, thank you!

BlueRift wrote:
You could add the numbers together (which would be too math heavy to work) but results in a nicely predictable bell curve.

Second, I want to see if I understand this idea...instead of just looking for a 6 at the end of each round (and disregarding any other result 1-5), I could simply add the values of the roles together, until I hit a pre-determined value, such as 18 or 20, which would then trigger the game ending sequence?

How does this result in a bell curve? I like to be able to analyze and see the math, I just can't do it, lol!

Thanks again for your rapid response!

kos
Offline
Joined: 01/17/2011

MarkKreiter's analysis is correct, as far as I can see. The caveat he mentions is also true, and unfortunately this makes the analysis significantly more complicated. That is, "What is the probability of the game length being 10 turns or less" is easy to calculate using the formula Mark provided, but "What is the probablility of the game length being exactly 10 turns" is much harder to calculate.

Adding the rolls together would certainly be an option as an alternative end-game mechanism. Note that the greater the variation in your min and max values on the die the more widely your game length is going to vary -- in particular the max game length will go rapidly to the right.

Example 1: Roll 1d6 per turn, end game when total is 20 or more.
- Min game length: 4
- Ave game length: 6
- Max game length: 20

Example 2: Roll 1d20 per turn, end game when total is 60 or more.
- Min game length: 3
- Ave game length: 6
- Max game length: 60

In examples 1 and 2 the average game length is the same (6 turns, near enough), and the min game length is almost the same, but the max game length is vastly different.

Personally, I would go with something that has much less variability than either of those examples, because (in general) I want more predictability in game length than "4 - 20 turns". Also, I'd want something that was easy to keep track of with a small number of counters. Say, roll 1d6: 1-3 place 1 counter, 4-6 place 2 counters. This translates into:

Example 3: Roll 1d2 per turn, end game when total is 8 or more.
- Min game length: 4
- Ave game length: 6
- Max game length: 8

(Note to all the mathemagicians out there: Yes, all numbers are rounded up to the nearest integer.)

Regards,
kos

MarkKreitler Offline
Joined: 11/12/2008
Thanks, Kos

Hey Kos,

Thanks for verifying my math.

Isn't this difficulty:

"That is, "What is the probability of the game length being 10 turns or less" is easy to calculate using the formula Mark provided, but "What is the probablility of the game length being exactly 10 turns" is much harder to calculate."

handled by this approach:

P(game ending in exactly N turns) = P(game ending in N turns or less) - P(game ending in N-1 turns or less)?

In which case, it's just the difference of binomial coefficients computed for N and N - 1. Not that much harder to compute.

In general, though, I prefer your more deterministic approach. It bounds the probabilities better, which makes the game more predictable, but still random. Nice system.

Mark

pelle Offline
Joined: 08/11/2008
square bashing

Square Bashing (miniatures game) uses an end-of-game counter that starts at 30 and decreases by 1d6 per turn, but not if the attacker made two successful attacks in that turn. That means the attacker will not run out of time as long as things are going well, but once the attack bogs down for whatever reason the game will end eventually.

KAndrw
Offline
Joined: 08/20/2008
I suggest the following: A =

I suggest the following:

A = the minimum number of turns you want the game to take
B = the maximum number of turns you want the game to take
C = a number that balances distribution

The game should include B+C tiles with identical backs, A+C of which have stars on the front, and B-C of which are blank.

At the end/start of each turn, randomly reveal a tile - if it's a star, it gets added to the star track (which has A spaces), otherwise it is removed from the game.

When the star track is full, the game ends.

SLiV Offline
Joined: 10/21/2011
Minor comment

KAndrw, I assume you mean A+B tiles with identical backs, and not B+C? Since A+C + B-C = A+B+C-C = A+B.

As far as the 3 sixes go, though, my math works out differently.

The chance that the game starts ending at round n (P) is the chance that you have thrown exactly 2 sixes (Q), times the chance that you throw the last six in this round (R), i.e. P(n) = R(n) * Q(n).

The chance that you have thrown exactly 2 sixes in the last n-1 rounds, is as follows:
Q(n) = (1/6)^2 * (5/6)^(n-3) * 1/2*(n-1)*(n-2).
The (1/6)^2 part means that you have thrown exactly 2 sixes, whereas (5/6)^(n-3) means that you have thrown n-1-2 = n-3 non-sixes. The last bit, 1/2*(n-1)*(n-2), is a bit harder to explain, but account to the fact that there are many different ways to through 2 sixes in n-1 throws; you have n-1 turns to throw one six, and n-2 turns to throw another.* (Mathematicians: (n-1)*(n-2)*1/2 = (n-1)! / 2! / (n-3)!, the binomial coefficient of n-1 and 2.)

(* I'm pretty sure it doesn't matter, but maybe I made a mistake where you cannot throw the first six at round 12 and the second at round 4.)

Ofcourse, the chance that you throw the last six, R, is equal to the chance you throw any six, i.e. 1/6.

That would leave us with the chance of ending the game at exactly n turns of P(n) = 1/6 * (1/6)^2 * (5/6)^(n-3) * 1/2*(n-1)*(n-2) = (1/6)^3 * (5/6)^(n-3) * 1/2*(n-1)*(n-2).

This all boils down to 0.46% chance to end the game after 3 rounds, and just as much chance to end it after 39 rounds. To me, saying your game takes about 3-39 rounds isn't really appetiting, to say the least. Even more so because out of 200 games you play, 1 will take longer than 60 turns.

So my suggestion would be to go with either kos' or pelle's or KAndrw's idea; 4-8 seams like a very reasonable roundcount (and you could easily scale this to 12-24 turns, for instance).

KAndrw
Offline
Joined: 08/20/2008
It's very possible that I got

It's very possible that I got that wrong :P

Let's work through it slowly, with some example numbers...

A = minimum number of turns = 8
B = maximum number of turns = 12
C = magical distribution balancing number = 5

Total number of tiles = B + C = 17
Tiles with stars = A + C = 13

Aha, here's where it went wrong:
Blank tiles DOES NOT EQUAL B-C (7)
Blank tiles = B - A = 4!

In this scenario, the first eight tiles drawn could all be stars, in which case the game ends on turn 8. At the other end of the scale, four of the first eleven tiles drawn could be blanks, in which case the twelfth tile can only be a star, and the game ends on turn 12.

The higher the value of C, the greater the chance of the game stretching out to the full B turns.

The reason I favour this approach is that it places hard limits on the number of turns, whereas an independently random system (ie the results of the previous turn do not affect the results of this turn) could in theory run forever. In order to narrow the probabilities sufficiently to guarantee that (say) 99% of games will fit within a certain range, you'll end up making it so that 80+% of games will be clustered around the middle of that range. Ish.

akanucho
Offline
Joined: 11/10/2009
Very impressive!

I'm going to have to use a system like this in a game of my own. I love how simple it is, both in implementation and in understanding how and why it works. I have to ask, was this system borrowed from/inspired by any other games in particular? I've seen a few games that use a fill-the-track system to determine when a game might end, but the idea of using a fixed number of tiles with blanks to force both minimum and maximum length is new to me.

I believe that increased values of C would favor a shorter game over a longer one, however, since the extra tiles all have stars on them. More stars means a greater chance that a tile is added to the track each turn.

ConMan
Offline
Joined: 03/22/2012
And now I can see an

And now I can see an extension of that mechanic that could do some nifty things - instead of stars and blanks, have two different symbols - say squares and circles - and one track for each symbols. The number of tiles in each track has some effect - for example, the current player gets +1 gold for each square and +1 soldier for each circle, or at 3 squares enemies get a power boost and at 3 circles players get one. And, when either of the two tracks is filled, game is over.

Note that by having two tracks and ending the game when *either* is filled results in a different distribution of turns to game end than just filling one - the minimum will be the same but the average and maximum will both drop.

KAndrw
Offline
Joined: 08/20/2008
akanucho wrote:I'm going to

akanucho wrote:
I'm going to have to use a system like this in a game of my own. I love how simple it is, both in implementation and in understanding how and why it works. I have to ask, was this system borrowed from/inspired by any other games in particular?

I'm pretty sure I made that system up, though obviously it owes a lot to systems like the Catan Event Cards and other deck-of-dice concepts.

Quote:
I believe that increased values of C would favor a shorter game over a longer one, however, since the extra tiles all have stars on them. More stars means a greater chance that a tile is added to the track each turn.

Gah! 