Absinthe
Absinthe
  • Threads: 4
  • Posts: 21
Joined: Sep 22, 2011
September 23rd, 2011 at 10:48:20 AM permalink
There is a simple game called 24, though I am sure it is known by many other names. I have only ever seen it played 1 on 1 for even money. However, i am trying to calculate it out to figure the odds of some hands, and I am running into some issues.

The rules are simple.
1. You have 6 dice
2. You have to HOLD at least one of them each throw
3. You can HOLD as many of them as you want
4. Once held that die can not be reintroduced to the roll
5. When there are no more that are not held, you are done

The scoring is also simple.
1. You must have 1 die with 2 pips.
2. You must have 1 die with 4 pips.
3. Your score is the sum of the remaining 4 dice.

If you don't have a 2 and a 4 you get 0 score.

If I walk it and say:
First roll has 6 dice in it, I have about 100% of getting any one specific number (4 or 2 or 6) (1/6 * 6 dice)
If I take one out....
Second Roll 83% chance of getting one specific number (4,2,6) (1/6 * 5 dice)
If I take one out ..
Third roll etc...

The ultimate goal (perfect score) is 2,4, 6,6,6,6
I have 6 throws with decreasing number of dice to get 6 specific numbers. Do I add these numbers together, or multiply them or is there an exponent involved?

I multiplied them all together and get 0.0154317283987654 which would suggest that I should be able to get a 24 (perfect score) 1.54... out of 100 attempts

However, that feels wrong. It feels like that is more the result of throwing them all 1 time and trying to get a perfect score. Would I be looking for the chances of throwing them all for 6 specific numbers. and multiply that by throwing 5 of a specific number * 4 of a specific number and so on? That doesn't feel right either.

Ultimately the perfect score is 6 specific numbers but at any one time I can get any one of 3 numbers. Like on the first roll, it is good if I get 4 or 2 or even 6. So on the first roll it is actually (3/6 * 6) * (2/6 * 5) * (1/6 * 4) of getting all three right off the bat. I just start tripping over myself at this point. If I multiply them together I get 0.092591... suggesting that there is a 9.25... % or almost 1 in 10 games would expect a 24 result? I like this one better. But it doesn't really account for the 2 and 4 but the more I think about it, the less I think they matter. Am I right at this point?

Assuming I was right, what do I do to calculate the next score 23. The difference being that one of 4 of the dice can be either 5 or 6 (to be 23 or better). But to get 23 exactly it would seem that the chances are the same as 24 but I intuitively believe that to be wrong. I am thinking this chances things by starting the above calculation with (4/6 * 6)*(3/6 * 5)*(2/6 * 4)*(1/6 *3)*(1/6 * 2)*(1/6 * 1) because now I have 4 different specific numbers I am trying to get. Consequently that gives me a 37% which seems way too high.

So what am I doing wrong? I know it is something stupid.
CrystalMath
CrystalMath
  • Threads: 8
  • Posts: 1911
Joined: May 10, 2011
September 23rd, 2011 at 1:51:01 PM permalink
This is a difficult question.

You need to consider all of the ways that you can get the first spin. Then you need to decide what is the optimal hold. For instance, I imagine that it is best to hold 2s, 4s, and 6s on the first roll, but not always (see below). I also assume that your goal is to get the best possible average score, right? This means that on your last roll, you would re-roll any 1, 2, or 3, assuming that you don't need the 2. You would not, however, reroll the 5 if you had 2,4,6,6,6,5, because it would reduce your expected score.

Let's consider the following first rolls:

1,1,1,1,2,6. At this point, it might actually be better to keep only the 2 and not the 2 and 6. This is because it is more important for you to get the 4 than it is to have the 6.

2,6,6,6,6,6. Do you throw away only one of the 6s in hopes of the 4, or do you throw away 2, 3, 4, or 5 of them? If you throw away one of them, then you will get a 0 score 5/6 of the time and a 24 score 1/6 of the time for an average expected score of 4. If you throw away two of the sixes, you end up with an average score of 6.80555 (considering that you will keep a 4, then re-roll the remaining die if it is 3 or under). It may be even better to throw away more.
I heart Crystal Math.
miplet
miplet
  • Threads: 5
  • Posts: 2114
Joined: Dec 1, 2009
September 23rd, 2011 at 2:11:14 PM permalink
Interesting results for the same type of game (replaces 2 and 4 with 1 and 4).
http://bruteforcex.blogspot.com/2010/08/1-4-24-simulation.html
“Man Babes” #AxelFabulous
Absinthe
Absinthe
  • Threads: 4
  • Posts: 21
Joined: Sep 22, 2011
September 23rd, 2011 at 7:07:14 PM permalink
I think you are talking strategy more than odds, but maybe not.

If I want to make this into let's say a slot machine with 6 reels. I would have to come up with a paytable. To maintain HA, I have to pay less than whatever the fair odds are. Therefore I would have some jackpot for playing a 24 hand and perhaps a lower payout for a 23 and 22 and even money for 21 and nothing below that. That is just "fer instance" off the top of my head.

The best throw is 2,4,6,6,6,6. If I do that on the first toss then I am done. Because I can hold them all. I can make the game more interesting (difficult) by forcing the player to always only hold 1 die each toss. But that is a different calculation.

As for strategy, when I play it, I would usually always hold a 6 if it came up so in your example I would have held the 2 and 6 and re rolled the 1's. That may not be optimal, but it is the way I do it.

What I think I am doing wrong is multiplying where I need to raise to a power. But I am not certain. Come on math come back to me! The frustrating part is I know that I know how to do this, but it is escaping me.

To roll 1 specific number in one role is 1/6 if I want to do that to 6 consecutive rolls then I raise that to the power of how many I want. So I think it is (1/6)^6 to roll the whole perfect hand in one shot. But that would consider that I wanted to roll 6,6,6,6,6,6.

My mind tells me that the first roll should be more like (3/6) chance, meaning that any 2,4,or 6 would be a successful hold, but more to my favor because it is out of 6 rolls. If I elected to keep 2 or 4 or 6 and upon success with a 2 or 4 the second roll would be (2/6) with whatever advantage the 5 remaining rolls give me. if I took a 6 the first time it is still (3/6) with the advantage that 5 remaining dice give me. and so on. I know the rolls have to increase it, just not sure how (mathematically) to set up the calculation. I know this is a simple calculation, but I also know I am simply doing it wrong.

Thinking out loud for a second: (sometimes this helps) :)

Toss 1 die and achieve a specific number 1/6
Toss 1 die and achieve one of 2 specific numbers 2/6
Toss 1 die and achieve one of 3 specific numbers 3/6

Toss 2 dice and get 1 specific number on each (1/6)^2
Toss 2 dice and get at least 1 specific number on either (1/6)*2

Toss 3 dice and get at least 1 specific number on either (1/6)*3

Ok with that as logic:
Toss 6 and get at least 1 of 3 specific number ((1/6)*3)* 6
6
Toss 5 and get at least 1 of 3 specific number ((1/6)*3)* 5
6
Toss 4 and get at least 1 of 3 specific number ((1/6)*3)* 4
6
Toss 3 and get at least 1 of 3 specific number ((1/6)*3)* 3
6
Toss 2 and get at least 1 of 2 specific number ((1/6)*2)* 2
4
Toss 1 and get at least 1 of 1 specific number ((1/6)*1)* 1
2

If I multiply them all together I get 1.6 repeating (166%?). That suggests that I should get 24 more than the amount of times I roll :)

If I take the 2 and 4 first I make the odds worse I think
Toss 6 and get at least 1 of 3 specific number ((1/6)*3)* 6
2
Toss 5 and get at least 1 of 3 specific number ((1/6)*2)* 5
4
Toss 4 and get at least 1 of 3 specific number ((1/6)*1)* 4
6
Toss 3 and get at least 1 of 3 specific number ((1/6)*1)* 3
6
Toss 2 and get at least 1 of 2 specific number ((1/6)*1)* 2
6
Toss 1 and get at least 1 of 1 specific number ((1/6)*1)* 1
6

Which comes to .09 which suggests that I have a 9% chance.

I am obviously putting the decimal point in the wrong place or simply overlooking something in the math. This says that I have a 300% chance of getting the first number, a 250% chance of getting the second number a 200% chance of getting the third then a 100% of the 4th and 67% on the 5th and 16% on the 6th. That would be for the first example, and with the other strategy it would be 300%, 167%, 67%, 50%, 33%, 16%.

Do those number actually sound reasonable? How can I possibly have a 300% chance of anything?
If so, how do I combine them properly to come up with the right % for a perfect score?
Absinthe
Absinthe
  • Threads: 4
  • Posts: 21
Joined: Sep 22, 2011
September 23rd, 2011 at 7:16:16 PM permalink
The brute force simulation is pretty much the same game. It is however, testing for a strategy over a given number or plays. I like the result value but not the methodology. This should be a calculable thing, and I am just not doing it correctly. (frustrating)

The strategy he uses in the brute force method seems to work against the odds for optimal success especially on the "Go for broke". As soon as you hold a 2 or 4 instead of a 6 you reduce your odds of having a favorable number to hold on the next throw. 3/6 vs 2/6 vs 1/6 (times the number of dice) Because of the qualification issue associated with the 2/4 (or 1/4) in his case he puts special weight on them. However, I contend that in the "Go for broke" getting a 23 is a loss anyway. So the 6's are equally as important as the qualifying numbers. It is better to have 3 or 2 possible results from a roll than only 1.
Absinthe
Absinthe
  • Threads: 4
  • Posts: 21
Joined: Sep 22, 2011
September 23rd, 2011 at 9:18:13 PM permalink
Not to answer my own question but... I am an idiot so here goes.

On 6 dice there are 46656 possible combinations or 6^6
Of them 44874 contain 2,4 or 6 this makes for 44874/46656 or 96.18%

On 5 dice there are 7776 possible combinations 6^5 7452/7776 or 95.83%
Of them 7452 contain 2,4, or 6 this makes for

On 4 dice there are 1296 possible combinations 6^4
Of them 1215 contain 2,4, or 6 this makes for 1215/1296 or 93.75%

On 3 dice there are 216 possible combinations 6^3
Of them 189 contain 2,4, or 6 this makes for 189/216 or 87.50%

On 2 dice there are 36 possible combinations 6^2
Of them 20 contain 2 or 4 this makes for 20/36 or 55.56%

On 1 dice there are 6 possible combinations 6^1
Of them 1 contain 4 this makes for 1/6 or 16.67%

If I multiply them all together I get 7%
So 7 out of 100 plays you should score 24. That feels more like actual play,

Each following score will add a layer of complexity to it, but sure enough I was doing it all wrong. I like the 7% number. I would welcome any arguments against it.
Absinthe
Absinthe
  • Threads: 4
  • Posts: 21
Joined: Sep 22, 2011
September 25th, 2011 at 5:08:29 PM permalink
Ok, I think it is still wrong. That does not account for the cases when you get multiple dice to hold in the same toss. :(
miplet
miplet
  • Threads: 5
  • Posts: 2114
Joined: Dec 1, 2009
September 26th, 2011 at 2:22:38 PM permalink
Quote: Absinthe

Ok, I think it is still wrong. That does not account for the cases when you get multiple dice to hold in the same toss. :(


I'm working on a combinational analysis. It might take a few days. According to that link I posted it should be around 4.8 %.
“Man Babes” #AxelFabulous
CrystalMath
CrystalMath
  • Threads: 8
  • Posts: 1911
Joined: May 10, 2011
September 26th, 2011 at 2:46:05 PM permalink
Quote: miplet

I'm working on a combinational analysis. It might take a few days. According to that link I posted it should be around 4.8 %.



Will you be looking for the best strategy to get the maximum number of perfect scores or the best strategy to get the highest average score? This is a completely different game if you are playing heads up with other players or if you are being paid by a paytable. In a heads up game, it also depends on your position and whether or not the players after you will have perfect strategy. With a paytable, the strategy will also vary based on the win amounts.
I heart Crystal Math.
miplet
miplet
  • Threads: 5
  • Posts: 2114
Joined: Dec 1, 2009
September 26th, 2011 at 2:58:21 PM permalink
Just a perfect score for now as that is the easyest.
“Man Babes” #AxelFabulous
Absinthe
Absinthe
  • Threads: 4
  • Posts: 21
Joined: Sep 22, 2011
September 26th, 2011 at 5:42:39 PM permalink
Ok, I have been twiddling some more bits.

I have determined that there are 6^6 possible final outcomes. I have further relearned some math to figure out that there are 6! / 4! possible winning combinations. I thought I had the tiger by the tail as the odds seemed pretty easy at (6!/4!) / (6^6 - (6!/4!)) ... That comes out to a very small percentage 0.0643417836%

I assume that is the odds of doing it all in one throw.

Further I determined that there are 32 different possible outcomes (regardless of the actual dice numbers) By this I mean, Throw 6 Keep 6 = 1 way. Throw 6 keep 5, throw 1 keep 1. That is 2. And so on all the way to Throw 6 keep 1, throw 5 keep 1 and so on down to throw 1 keep 1.

For what it is worth, if you ever throw all numbers that do not include a "keepable" 2,4,6 you can't win a perfect 24 score.

So in the best winning throw you get all perfect in 1 roll. In the worst winning throw you will make 6 rolls totaling 21 dice. At one point I thought this might even be a 21 choose 6 solution, but that actually comes out to more than 6^6 so I am not sure it is correct. I am not sure how to compensate for the permutations in 21 choose 6 where I know there will be duplicate values.

An interesting paytable would be to pay on 21-24. I think even money on 21 and a bit more on the others with, perhaps some bonuses on the lesser number of throws. For example 24 in 1 throw at .06% could be a good candidate for a jackpot of some sort :) But I digress.

When I looked at the brute force site I think it was flawed in the "go for broke" strategy, because I think taking 6's over 4's and 2's early would be a better strategy, since taking 4's or 2's reduce your odds of a safe throw. But again I digress.

When trying to calculate the game, since there are 32 ways to get to the end. Do I have to do all those calculations as well? My 7% calc came from doing t6 h1, t5 h1, t4 h1... but assumes that you keep 6's first then the 4 and 2. This gives you the best possible chances that I can see numerically. I would assume that if I do it in reverse, of holding the 4 and 2 first, I immediately reduce the odds of a safe roll and subsequent ones as well. I guess I could calculate all 30 permutations. Many of which would be the same and some just a bit different. Or do I have to calculate the chances of getting more than one keepable die and each of the 32 possible ways to finish. This would require lots of calculations (30 * 32) of them to be exact. Am I at least thinking the right direction? It has been years since game theory and even more since statistics and algebra :(
CrystalMath
CrystalMath
  • Threads: 8
  • Posts: 1911
Joined: May 10, 2011
September 27th, 2011 at 8:04:25 AM permalink
Here is a generic answer. To implement it requires some programming.

1. Determine every way to roll 6 dice as well as the likelihood of each outcome happening. This isn't quite as bad as it sounds. Although there are 6^6 outcomes, we don't care about the order. This reduces the number of unique rolls to 462. Here is a sample of the list. We don't care about the order, just the number of each dice. The weight is the number of ways that this can be thrown. For instance, in the second row, the 5 can be in any one of the 6 positions. Research combinatorials for this.

Qty 1s Qty 2s Qty 3s Qty 4s Qty 5s Qty 6s Weight
0 0 0 0 0 6 1
0 0 0 0 1 5 6
0 0 0 0 2 4 15
0 0 0 0 3 3 20
0 0 0 0 4 2 15
0 0 0 0 5 1 6
0 0 0 0 6 0 1
0 0 0 1 0 5 6
0 0 0 1 1 4 30
0 0 0 1 2 3 60
0 0 0 1 3 2 60
0 0 0 1 4 1 30
0 0 0 1 5 0 6
0 0 0 2 0 4 15


2. Loop through every way of holding the dice. For the first roll, you may hold everything, reroll 1, 2, 3, 4, or 5 of the die. There are 63 total ways to hold/re-roll the first time.

3. For each way to discard, loop through all the ways to re-roll the dice. There are 252 ways to throw 5 dice, 126 ways to throw 4 dice, 56 ways to throw 3 dice, 21 ways to throw 2 dice, and 6 ways to throw 1 die. For each of these, calculate the best possible pay. This means recursively searching how to discard the remaining dice. The recursion ends when you get down to discarding 0 dice, and you just calculate your score. At each step, choose the best possible average pay.

If this is implemented to use a paytable, it would also be easy to calculate the "go for broke" by setting the pay for a perfect score to 1 and the pay for everything else to a 0.

I know this is an overly simplistic description, but I think it is the general approach of any strategy based gambling game.
I heart Crystal Math.
Absinthe
Absinthe
  • Threads: 4
  • Posts: 21
Joined: Sep 22, 2011
September 28th, 2011 at 1:30:22 PM permalink
I see where you are getting 462 .. that is C(n+(s-1),s-1) where n = number of dice and s = number of sides on the dice. 11 choose 5.
I think I see the other 'weight' values as a divided factoral such as 6!/5! for 1 specific number with 5 duplicated numbers then 6!/4!/2! for the 15 then 6!/3!/3! comes out to 20 and I will assume on down the table.

Am I following you well? Now, what are you doing with that weight?

I am not sure I follow your counting of ways to throw and reroll dice. For example, if you have 3 dice you can only roll 6 different ways. I am not sure where you are getting 56. I must be missing something...

R K
3 3
3 1
3 2
2 2
2 1
1 1
Absinthe
Absinthe
  • Threads: 4
  • Posts: 21
Joined: Sep 22, 2011
October 11th, 2011 at 6:39:53 PM permalink
This thread got really quiet.
miplet
miplet
  • Threads: 5
  • Posts: 2114
Joined: Dec 1, 2009
October 11th, 2011 at 6:53:33 PM permalink
Quote: Absinthe

This thread got really quiet.


Still working on it. I'm trying to learn c++, so it may take awhile.
“Man Babes” #AxelFabulous
buzzpaff
buzzpaff
  • Threads: 112
  • Posts: 5328
Joined: Mar 8, 2011
October 11th, 2011 at 7:10:58 PM permalink
Am waiting for a call back from Albert Einstein.
Absinthe
Absinthe
  • Threads: 4
  • Posts: 21
Joined: Sep 22, 2011
October 12th, 2011 at 6:58:54 PM permalink
I can help with the C++ if you like. Though I have been focusing on C# lately.
  • Jump to: