Results 1 to 7 of 7

Thread: [RESOLVED] Math issue for my game, could use a mathematicians help

  1. #1

    Thread Starter
    Fanatic Member neicedover1982's Avatar
    Join Date
    Jun 2005
    Posts
    566

    Resolved [RESOLVED] Math issue for my game, could use a mathematicians help

    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.
    Kevin | New England Iced Over | http://www.kevincawleyjr.com

  2. #2
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Math issue for my game, could use a mathematicians help

    I moved your thread to a place where you might find a mathematician..


    - ØØ -

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Re: Math issue for my game, could use a mathematicians help

    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
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4

    Thread Starter
    Fanatic Member neicedover1982's Avatar
    Join Date
    Jun 2005
    Posts
    566

    Re: Math issue for my game, could use a mathematicians help

    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.
    Kevin | New England Iced Over | http://www.kevincawleyjr.com

  5. #5

    Thread Starter
    Fanatic Member neicedover1982's Avatar
    Join Date
    Jun 2005
    Posts
    566

    Re: Math issue for my game, could use a mathematicians help

    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.
    Kevin | New England Iced Over | http://www.kevincawleyjr.com

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Re: Math issue for my game, could use a mathematicians help

    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.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7

    Thread Starter
    Fanatic Member neicedover1982's Avatar
    Join Date
    Jun 2005
    Posts
    566

    Re: Math issue for my game, could use a mathematicians help

    Thanks. I managed to get the table built and my friend says its correct, he got the same answers. Thanks for the help.
    Kevin | New England Iced Over | http://www.kevincawleyjr.com

Posting Permissions

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



Click Here to Expand Forum to Full Width