If we knew how to do that, we wouldn't need a program! (Which would probably need to understand English.)
Oh we know *how* to do the calculation. Its just fiddly. Pavster did a good job with it.
Not really; instead of representing (in my code) the three kinds of dice as 3, 2 and 1 (sides showing skulls out of 6), I'd have to use, 0.5, 0.333... and 0.166...; not exact and less tidy.
nah just do
float DICE1CHANCE = 1/2
float DICE2CHANCE = 1/3
float DICE3CHANCE = 1/6
Without replacement your calculation is wrong. Eg 3 reds is 3/15 * 2/14 * 1/13 = O.0022 (*)
Even as you've done it (with replacement), it would have to be (3/15)*(3/15)*(3/15) =0.008 not adding.
Then, as above, you have to work out all the mixed combinations as well.
(*) The fact that you might reach in and grab all three at once doesn't change the odds as it has to be the same probability as you would get picking them out one at a time.
BIB would be the predicted odds of drawing 3 reds out of 3 which is not what I was doing. I was using the expected number of reds in the sample - which is 9/15 for a without-replacement hypergeometric distribution.
After considering the problem this morning, there is a major simplification that can be made. It's very similar to paulbrock's post #2.
Drawing a die then rolling it is really just a two-step process to pick one particular face. So the problem is identical to one of drawing from a bag of tiles, each one representing one face of a die. There will be 9 red tiles with skulls on and 9 plain ones, 10 brown skulls and 20 plain, 7 green skulls and 35 plain. At this point the colour of the tile is irrelevant, only whether it has a skull on. There are 26 skulls, 64 plain for a total of 90.
The probability of getting at least one skull in three draws is the same as one minus the probability of getting plain tiles in three successive draws. So the calculation reduces to:-
After considering the problem this morning, the is a major simplification that can be made. It's very similar to paulbrock's post #2.
Drawing a die then rolling it is really just a two-step process to pick one particular face. So the problem is identical to one of drawing from a bag of tiles, each one representing one face of a die. There will be 9 red tiles with skulls on and 9 plain ones, 10 brown skulls and 20 plain, 7 green skulls and 35 plain. At this point the colour of the tile is irrelevant, only whether it has a skull on. There are 26 skulls, 64 plain for a total of 90.
The probability of getting at least one skull in three draws is the same as one minus the probability of getting plain tiles in three successive draws. So the calculation reduces to:-
P = 1 - (64/90 * 63/89 * 62/88) = 0.64535
Sadly you can't make that simplification, since the tiles are still connected -- if you draw one of the plain tiles out of the bag (for that first 64/90 chance in your formula) then you can't say there's 63/89 plain tiles left in the bag -- there could be 59/84, or 60/84, or 61/84 (depending on the colour of the "tile" you drew).
I agree with Pavster's earlier analysis -- the actual fraction it works out to is 15797/24570.
Sadly you can't make that simplification, since the tiles are still connected -- if you draw one of the plain tiles out of the bag (for that first 64/90 chance in your formula) then you can't say there's 63/89 plain tiles left in the bag -- there could be 59/84, or 60/84, or 61/84 (depending on the colour of the "tile" you drew).
I agree with Pavster's earlier analysis -- the actual fraction it works out to is 15797/24570.
Oh we know *how* to do the calculation. Its just fiddly. Pavster did a good job with it.
I meant those of us who find it necessary to write simulations.
(I've just had a go, without looking at the detailed workings of the other posts. I've got a value for drawing one dice (and a simulation of that suggested it's right). But for doing 2nd and 3rd draws, I end up with a complex tree of probabilities. I suppose a program could help with that, but I don't think the other posts were that elaborate, relying more on puzzle-solving skills.) (ETA: analytical is the word I want...)
There are two approaches to this problem, which should give the same result:
Mathematical. This requires knowledge of how to combine probabilities (for mutually exclusive outcomes add the individual probabilities; for independent outcomes multiply the individual probabilities) but with this question things get complicated and tricky. Computers cannot help with this approach (except to perform the trivial calculations, which could be done by hand or with a calculator). https://en.wikipedia.org/wiki/Probability#Mathematical_treatment
Simulation (sometimes called the Monte Carlo method). This requires either a great deal of time to perform enough trials using real-world equipment, or computer programming knowledge. The choice of programming language will affect the speed of operation, readibility, and perhaps in extreme cases accuracy at the umpteenth decimal place, but not the fundamental result. https://en.wikipedia.org/wiki/Monte_Carlo_method
After considering the problem this morning, there is a major simplification that can be made. It's very similar to paulbrock's post #2.
Drawing a die then rolling it is really just a two-step process to pick one particular face. So the problem is identical to one of drawing from a bag of tiles, each one representing one face of a die. There will be 9 red tiles with skulls on and 9 plain ones, 10 brown skulls and 20 plain, 7 green skulls and 35 plain. At this point the colour of the tile is irrelevant, only whether it has a skull on. There are 26 skulls, 64 plain for a total of 90.
The probability of getting at least one skull in three draws is the same as one minus the probability of getting plain tiles in three successive draws. So the calculation reduces to:-
P = 1 - (64/90 * 63/89 * 62/88) = 0.64535
Congratulations, you beat me to it. I slept on this problem and came up with the exact same solution. I think of it as leave the dice in the bag, shake the bag and then reveal the upward faces on 3 dice. The only outcome not acceptable is 3 blanks.
There are two approaches to this problem, which should give the same result:
Mathematical. This requires knowledge of how to combine probabilities (for mutually exclusive outcomes add the individual probabilities; for independent outcomes multiply the individual probabilities) but with this question things get complicated and tricky. Computers cannot help with this approach (except to perform the trivial calculations, which could be done by hand or with a calculator). https://en.wikipedia.org/wiki/Probability#Mathematical_treatment
Simulation (sometimes called the Monte Carlo method). This requires either a great deal of time to perform enough trials using real-world equipment, or computer programming knowledge. The choice of programming language will affect the speed of operation, readibility, and perhaps in extreme cases accuracy at the umpteenth decimal place, but not the fundamental result. https://en.wikipedia.org/wiki/Monte_Carlo_method
Would it be possible to use an "equivalence" method?
3 are red and each has 3 skulls on them (i.e. each dice has 3 skulls and 3 blank sides)
5 are brown, each with 2 skulls on them
7 are green, each with 1 skull on them
Could it be phrased like...
3 are red and 1.5 has skulls on them, 1.5 are blank
5 are brown, 1.67 has skulls, 3.33 are blank
7 are green, 1.167 has skulls, 5.833 are blank
and then work out how many combinations would include at least 1 skull - which is equivalent of them being picked and then rolled to reveal at least 1 skull.
I can't be arsed to test it but that's my first thought on how to make it easier to do.
The basic premise is that 2 dice each with 3 skulls and 3 blank sides is equivalent to 2 dice one which has 6 skulls and the other 6 blanks as far as overall probability goes.
Sadly you can't make that simplification, since the tiles are still connected -- if you draw one of the plain tiles out of the bag (for that first 64/90 chance in your formula) then you can't say there's 63/89 plain tiles left in the bag -- there could be 59/84, or 60/84, or 61/84 (depending on the colour of the "tile" you drew).
I agree with Pavster's earlier analysis -- the actual fraction it works out to is 15797/24570.
I disagree. Leave them in the bag and just reveal the top faces of 3 dice (die). All of the possible faces are still in the bag because you can only SEE 3 of them.
I disagree. Leave them in the bag and just reveal the top faces of 3 dice (die). All of the possible faces are still in the bag because you can only SEE 3 of them.
But the skulls on any individual die are linked. If one is showing it, the others can't be.
Once upon a time I might have known enough about the way individual probabilities can be combined to have solved the OP's problem mathematically. These days I'll leave that task to others.
As several people have now written computer simulation programs which give the same result as my program, it seems likely that is the correct result, so any mathematical approach which yields a different result must be regarded as highly suspect.
The first part of the question is a multivariate hypergeometric distribution problem. But all you really need to know is the expected number of die of each colour, given 3 draws (without replacement) - this is:
with a certain amount of confidence i can say the answer is 0.643
code below:
[PHP] <script>
function diceFun()
{
var totalit=document.getElementById("numGoes").value;
var yesNo=true;
if (totalit>=100001)
{
yesNo=confirm("You have chosen a number of iterations of more than 100,000.\n\nIt should only take a couple of seconds but your Browser might think it's crashed.\n\nContinue?");
}
if (totalit<1 || totalit!=Math.floor(totalit))
{
alert("Your value for number of iterations makes no sense!\n\nShould be an integer greater than 1.\n\nPerhaps around 50,000.");
yesNo=false;
}
if (yesNo==true)
{
var startTime = new Date();
var totalwin=0;
var dice = new Array();
for(a=1;a<=15;a++) //reset picked status on whole lot to 0
{
dice[a] = new Array(); //pos 0 kept for status of draw
for (b=0;b<=6;b++)
{
dice[a]=0;
}
}
for (iter=0;iter<totalit;iter++) //main loop for program
{
//alert("Hello World!");
a=0;
sawSkull=0;
while (a<3)
{
b=Math.floor(Math.random()*15)+1; //random number from 1 to 15, first card is 1, dice
if (!dice[0]) //dice hasn't already been picked
{
dice[0]=1;
a++;
c=Math.floor(Math.random()*6)+1; //random number from 1 to 6, first card is 1, side
if (dice[c])
{
sawSkull=1;
}
}
}
totalwin=totalwin+sawSkull;
for(a=1;a<=15;a++) //reset picked status on whole lot to 0
{
dice[a][0]=0;
}
} //end of main loop
var writeOut=document.getElementById("whereAnswer");
var endTime = new Date();
//alert(endTime);
var durationTime = endTime - startTime;
//durationTime = 10;
//alert(durationTime);
writeOut.innerHTML="After " + totalit + " goes the average win ratio " + totalwin/totalit +" in " + durationTime + " milliseconds";
}
}
</script>[/PHP]
(i butchered an old page, which is why it's fancy.)
i don't think that is right. i have the same result by simulation as pavster calculated.
Sure, the fact that my answer is different to the simulations shows it is wrong somewhere, though I'm not sure where. Pavster's suggestion is a little like brute force, so I am left wondering if there is a more elegant solution.
Sure, the fact that my answer is different to the simulations shows it is wrong somewhere, though I'm not sure where. Pavster's suggestion is a little like brute force, so I am left wondering if there is a more elegant solution.
I don't think there is an elegant solution.
I'm toying with adding this puzzle to my site, I like that I can show the approximate solution, the simulation, and the calculation. but it's the inelegance that's stopping me.
I'm toying with adding this puzzle to my site, I like that I can show the approximate solution, the simulation, and the calculation. but it's the inelegance that's stopping me.
the arbitrary and unpatterned distribution of dice means that the solutions we've got are as tidy as it gets I reckon...
I'm toying with adding this puzzle to my site, I like that I can show the approximate solution, the simulation, and the calculation. but it's the inelegance that's stopping me.
the arbitrary and unpatterned distribution of dice means that the solutions we've got are as tidy as it gets I reckon...
I did simplify the game for the specific question we were trying to answer.
In the actual game, having rolled the first three dice, you then choose another three dice from the bag - and so on until all dice have been rolled or until you roll four skulls. You can chose to stop rolling at any time. Roll four skulls and you cannot collect any of the prizes that are represented on the other faces of the dice (the faces that don't have skulls).
So estimating when to stop rolling is a key skill.
There is a penalty associated with rolling any skull at any time so the reason we were interested in the thread question was to assess whether the chance of rolling a skull on the first throw was too high in terms of penalty and rendered the game flawed.
i could easily modify my program to show the odds on the second 3 etc...
In terms of gameplay I think it would be more in terms of:
No of skulls rolled already
No of dice of different colours left in bag
Decision: Roll or not?
So, for instance:
3 skulls rolled
3 dice left in bag, all red
Decision: No brainer. DON'T ROLL
Intuitively you always roll until 3 skulls have been rolled then make an assessment, but there may be some combinations where you should stop with only two skulls already rolled ... I don't know.
Anyway, that's asking a bit much unless anyone is particularly interested. But I am genuinely grateful for all the hard work everyone has contributed. I have learnt a lot and I am always pleasantly surprised by how generous people on the forum are with their time.
Comments
Oh we know *how* to do the calculation. Its just fiddly. Pavster did a good job with it.
nah just do
float DICE1CHANCE = 1/2
float DICE2CHANCE = 1/3
float DICE3CHANCE = 1/6
then reference those where necessary.
BIB would be the predicted odds of drawing 3 reds out of 3 which is not what I was doing. I was using the expected number of reds in the sample - which is 9/15 for a without-replacement hypergeometric distribution.
Written in C#, a mainstream language.
After considering the problem this morning, there is a major simplification that can be made. It's very similar to paulbrock's post #2.
Drawing a die then rolling it is really just a two-step process to pick one particular face. So the problem is identical to one of drawing from a bag of tiles, each one representing one face of a die. There will be 9 red tiles with skulls on and 9 plain ones, 10 brown skulls and 20 plain, 7 green skulls and 35 plain. At this point the colour of the tile is irrelevant, only whether it has a skull on. There are 26 skulls, 64 plain for a total of 90.
The probability of getting at least one skull in three draws is the same as one minus the probability of getting plain tiles in three successive draws. So the calculation reduces to:-
P = 1 - (64/90 * 63/89 * 62/88) = 0.64535
Sadly you can't make that simplification, since the tiles are still connected -- if you draw one of the plain tiles out of the bag (for that first 64/90 chance in your formula) then you can't say there's 63/89 plain tiles left in the bag -- there could be 59/84, or 60/84, or 61/84 (depending on the colour of the "tile" you drew).
I agree with Pavster's earlier analysis -- the actual fraction it works out to is 15797/24570.
Yes, you're right. Damn!
I meant those of us who find it necessary to write simulations.
(I've just had a go, without looking at the detailed workings of the other posts. I've got a value for drawing one dice (and a simulation of that suggested it's right). But for doing 2nd and 3rd draws, I end up with a complex tree of probabilities. I suppose a program could help with that, but I don't think the other posts were that elaborate, relying more on puzzle-solving skills.) (ETA: analytical is the word I want...)
(It's interesting to see how it looks in another, somewhat stricter language. However I can also see why I create my own!)
Mathematical. This requires knowledge of how to combine probabilities (for mutually exclusive outcomes add the individual probabilities; for independent outcomes multiply the individual probabilities) but with this question things get complicated and tricky. Computers cannot help with this approach (except to perform the trivial calculations, which could be done by hand or with a calculator).
https://en.wikipedia.org/wiki/Probability#Mathematical_treatment
Simulation (sometimes called the Monte Carlo method). This requires either a great deal of time to perform enough trials using real-world equipment, or computer programming knowledge. The choice of programming language will affect the speed of operation, readibility, and perhaps in extreme cases accuracy at the umpteenth decimal place, but not the fundamental result.
https://en.wikipedia.org/wiki/Monte_Carlo_method
Congratulations, you beat me to it. I slept on this problem and came up with the exact same solution. I think of it as leave the dice in the bag, shake the bag and then reveal the upward faces on 3 dice. The only outcome not acceptable is 3 blanks.
I've refined my method! It's tidier but same answer though.
As someone said earlier, the order you draw the dice doesn't matter.
So the different combos and the ways you can get them are
RRR 1
RRB 3
RRG 3
RBG 6
RBB 3
RGG 3
BBB 1
BBG 3
BGG 3
GGG 1
So p(RBG) = 6*(3*5*7)/(15*14*13)=0.23077
P(RBB)=3*(3*5*4)/(15*14*13)=0.06593 and so on
Then for each of the 10 combos work out the probability of no skull.
For RBG p(no skull) = (3*4*5)/(6*6*6)=0.2777
Add that lot up and 1-p(no skull)=0.64294,
Would it be possible to use an "equivalence" method?
Instead of saying
Could it be phrased like...
3 are red and 1.5 has skulls on them, 1.5 are blank
5 are brown, 1.67 has skulls, 3.33 are blank
7 are green, 1.167 has skulls, 5.833 are blank
and then work out how many combinations would include at least 1 skull - which is equivalent of them being picked and then rolled to reveal at least 1 skull.
I can't be arsed to test it but that's my first thought on how to make it easier to do.
The basic premise is that 2 dice each with 3 skulls and 3 blank sides is equivalent to 2 dice one which has 6 skulls and the other 6 blanks as far as overall probability goes.
I disagree. Leave them in the bag and just reveal the top faces of 3 dice (die). All of the possible faces are still in the bag because you can only SEE 3 of them.
But the skulls on any individual die are linked. If one is showing it, the others can't be.
At the most superficial level, there's the common misconception that after opening a run of blue boxes you're more likely to open a red box
More seriously, I can think of a couple of results which most people find very unexpected, sometimes to the extent of not believing them:
https://en.wikipedia.org/wiki/Birthday_problem
https://en.wikipedia.org/wiki/Monty_Hall_problem
Once upon a time I might have known enough about the way individual probabilities can be combined to have solved the OP's problem mathematically. These days I'll leave that task to others.
As several people have now written computer simulation programs which give the same result as my program, it seems likely that is the correct result, so any mathematical approach which yields a different result must be regarded as highly suspect.
r 9/15 p 3/6
b 1 p 4/6
g 21/15 p 5/6
then p^no. dice for each
multiple results then 1 - results will give at least one skull
So I have 0.659
http://puzzles.nigelcoldwell.co.uk/dstest.htm
with a certain amount of confidence i can say the answer is 0.643
code below:
[PHP] <script>
function diceFun()
{
var totalit=document.getElementById("numGoes").value;
var yesNo=true;
if (totalit>=100001)
{
yesNo=confirm("You have chosen a number of iterations of more than 100,000.\n\nIt should only take a couple of seconds but your Browser might think it's crashed.\n\nContinue?");
}
if (totalit<1 || totalit!=Math.floor(totalit))
{
alert("Your value for number of iterations makes no sense!\n\nShould be an integer greater than 1.\n\nPerhaps around 50,000.");
yesNo=false;
}
if (yesNo==true)
{
var startTime = new Date();
var totalwin=0;
var dice = new Array();
for(a=1;a<=15;a++) //reset picked status on whole lot to 0
{
dice[a] = new Array(); //pos 0 kept for status of draw
for (b=0;b<=6;b++)
{
dice[a]=0;
}
}
dice[1][1] = 1;
dice[1][2] = 1;
dice[1][3] = 1;
dice[2][1] = 1;
dice[2][2] = 1;
dice[2][3] = 1;
dice[3][1] = 1;
dice[3][2] = 1;
dice[3][3] = 1;
dice[4][1] = 1;
dice[4][2] = 1;
dice[5][1] = 1;
dice[5][2] = 1;
dice[6][1] = 1;
dice[6][2] = 1;
dice[7][1] = 1;
dice[7][2] = 1;
dice[8][1] = 1;
dice[8][2] = 1;
dice[9][1] = 1;
dice[10][1] = 1;
dice[11][1] = 1;
dice[12][1] = 1;
dice[13][1] = 1;
dice[14][1] = 1;
dice[15][1] = 1;
for (iter=0;iter<totalit;iter++) //main loop for program
{
//alert("Hello World!");
a=0;
sawSkull=0;
while (a<3)
{
b=Math.floor(Math.random()*15)+1; //random number from 1 to 15, first card is 1, dice
if (!dice[0]) //dice hasn't already been picked
{
dice[0]=1;
a++;
c=Math.floor(Math.random()*6)+1; //random number from 1 to 6, first card is 1, side
if (dice[c])
{
sawSkull=1;
}
}
}
totalwin=totalwin+sawSkull;
for(a=1;a<=15;a++) //reset picked status on whole lot to 0
{
dice[a][0]=0;
}
} //end of main loop
var writeOut=document.getElementById("whereAnswer");
var endTime = new Date();
//alert(endTime);
var durationTime = endTime - startTime;
//durationTime = 10;
//alert(durationTime);
writeOut.innerHTML="After " + totalit + " goes the average win ratio " + totalwin/totalit +" in " + durationTime + " milliseconds";
}
}
</script>[/PHP]
(i butchered an old page, which is why it's fancy.)
my simulation would seem to agree:
After 50000000 goes the average win ratio 0.64286588 in 55943 milliseconds
i don't think that is right. i have the same result by simulation as pavster calculated.
I don't think there is an elegant solution.
I'm toying with adding this puzzle to my site, I like that I can show the approximate solution, the simulation, and the calculation. but it's the inelegance that's stopping me.
the arbitrary and unpatterned distribution of dice means that the solutions we've got are as tidy as it gets I reckon...
I did simplify the game for the specific question we were trying to answer.
In the actual game, having rolled the first three dice, you then choose another three dice from the bag - and so on until all dice have been rolled or until you roll four skulls. You can chose to stop rolling at any time. Roll four skulls and you cannot collect any of the prizes that are represented on the other faces of the dice (the faces that don't have skulls).
So estimating when to stop rolling is a key skill.
There is a penalty associated with rolling any skull at any time so the reason we were interested in the thread question was to assess whether the chance of rolling a skull on the first throw was too high in terms of penalty and rendered the game flawed.
odds on 'going bust' after drawing various colour combinations anyone?
In terms of gameplay I think it would be more in terms of:
No of skulls rolled already
No of dice of different colours left in bag
Decision: Roll or not?
So, for instance:
3 skulls rolled
3 dice left in bag, all red
Decision: No brainer. DON'T ROLL
Intuitively you always roll until 3 skulls have been rolled then make an assessment, but there may be some combinations where you should stop with only two skulls already rolled ... I don't know.
Anyway, that's asking a bit much unless anyone is particularly interested. But I am genuinely grateful for all the hard work everyone has contributed. I have learnt a lot and I am always pleasantly surprised by how generous people on the forum are with their time.