Introducing the Poker Dice Program

Introducing the Poker Dice Program

The main program for this chapter is a simplified dice game. In this game, you are given $100 dollars of virtual money. On each turn, you bet two dollars. The computer will roll five dice. You can elect to keep each die or roll it again. On the second roll, the computer checks for various combinations. You can earn money back for rolling pairs, triples, four and five of a kind, and straights (five numbers in a row) Figures 4.1 and 4.2 illustrate the game in action.

Click To expand
Figure 4.1: After the first roll, you can choose to keep some of the dice by selecting the checkboxes underneath each die.
Click To expand
Figure 4.2: The player has earned back some money with a full house!

The basic concepts of this game are much like the ones you used in the earlier programs. Keeping track of all five dice can get very complicated, so this program uses arrays and loops to manage all the information.