Sunday, July 19, 2009

PYGAME DICE

PYGAME DICE

Extending the idea of tossing a coin to the throw of a pair of dice. The throw doesn't have equal probable events , ie: Probability of getting a cumulative sum of 10 is not the same of getting a cumulative sum of 7.

The probabilities of rolling a cumulative sum of 'n' is maximum for rolling a 7 (16.67% , lucky seven) while it is the lowest for rolling a 2 or 12 (2.78%).

To allow the user to have the 12 choices (2-12 and Quit) two variables are used as posx and posy (single variable pos used in the toss of a coin), to make a grid.

Fig1. The start up screen

Fig2. The user interface

Fig3. The Result screen (1)

Fig 4. The Result screen (2)

The coding gets lengthy due to the 36 possible outcomes of the event. The lines of codes tally to nearly 1450 across 2 python files.

It is worth noting that throw of a single die is an equal-probable event with all events bearing a 16.67% probability thus programming such an interface would be lot easier and just matter to add on to the toss of a coin code.



Video 1. Pyagame Dice














2 comments:

12win said...

Amazing blog you have! Get best live casino experience with slot game malaysia. The most amazing things about this live casino gambling are it offers 100% sign up bonus as a welcome to its newly signed up users and with valuable bonus points with each deposit.

Under Water Coconut said...


Thank you for the informative post. Emperor Clubs is an Online Casino in Malaysia that offers more than just casino games. We offer more than 100 Slot Games Malaysia that really can help reduce stress, have fun as well as refreshing your mind.