Click to See Complete Forum and Search --> : [RESOLVED] Math issue for my game, could use a mathematicians help
neicedover1982
Aug 19th, 2005, 01:02 PM
Ok, first off, i am not good at math, not my favorite subject. I need some help with the math for my game, either a formula or a chart to refer to.
My game has 6 dice, but at times can range from 1-6. I want to have a little "cheat sheet" in my game that tells you the probability of the winning outcomes based on the amoutn of dice your rolling with so you can decide if you want to roll or stick with what you have already.
I need the probablility of...
rolling a 1
rolling a 5
rolling 3 of a kind, 4 of a kind, 5 of a kind, 6 of a kind
a straight (1 through 6)
I need to beable to calculate on the fly becuase I know rolling a 1 on a single die is 1/6. so about 16% chance of it. but I need a formula to caculate the different odds. I will have a module with the functions so if I have 5 dice, one function is called, if 3 dice, another is called. so i dont need variables and such.
I stink at math and could never get this type of probability work memorized. Thank you. :wave:
NoteMe
Aug 19th, 2005, 02:59 PM
I moved your thread to a place where you might find a mathematician..:)
- ии -
kedaman
Aug 19th, 2005, 10:10 PM
the probability of rolling x of a kind is 6Cx/6^5 i.e. 6!/((6-x)!x!6^5) (of a given kind divde by 6). With n die you have nCx/6^(n-1), and of a given kind nCx/6^n
a straight should be 6!/6^6
neicedover1982
Aug 22nd, 2005, 08:55 AM
The equations make no sense to me, i cant follow them. I have listed the actual probabilities I need on my website at http://moonsofneptune.com/RollPercents.txt, if someone could give me the % chance of rolling each of the one I have X'ed off on the list, it would help me more than anything.
neicedover1982
Aug 23rd, 2005, 07:31 AM
I could really use someones help. I need to get this list built before I can call my game done. If someone could either do the math or explain simply how to do it, i would appreciate it greatly.
kedaman
Aug 24th, 2005, 04:12 AM
I'll try to explain. First X! means the factorial of X, which is defined:
0! = 1 and for higher factorials recursively:
X! = X * (X-1)!
for instance 5! is 5*4*3*2*1.
Next xCy means the amount of order independent combinations you can make with y elements in a set of x elements. It is defined:
xCy= x!/((x-y)!y!)
For instance, how many ways can your arrange two apples and three bananas in a row? It would be much easier if they all were different fruits, but now that there are three bananas and two apples, you can switch places between bananas and between apples, and still ending up with the same banana-apple configuration. For example BABAB where A is apple and B is banana if you switch places between the first and the last, then you have the same arrangement. Thus we must calculate how many ways the apples can fit into the 5 places, independently of the bannas. This is done using the formula,
The amount of order independent combinations you can make with 2 apples in a set of 5 fruits
= 5C2
= 5!/((5-2)!2!)
= 5!/(3!2!)
= 5*4*3*2*1/(3*2*1*2*1)
= 10
In other words there are 10 ways of putting 2 apples in a row of 5 fruits.
Now you should be able to do the same for dice outcomes. Still this is not all. You may know how many dice outcomes there are of a certain sort, but in order to get the probability you must divide that number with the total amount of possible outcomes, with order relevance. For instance throwing 123456 is different from throwing 654321. Since each die has 6 sides, the outcomes are when adding another die, multiplied by 6. Thus 6^X for X dice. X^Y means X to the power of Y if that's being confusing as well.
neicedover1982
Aug 27th, 2005, 06:02 PM
Thanks. I managed to get the table built and my friend says its correct, he got the same answers. Thanks for the help.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.