Dice Games

Dice games are similar to card games, but the values of the dice are simpler.  Dice have number values between 1 and 6.  Some games, like craps, involves adding the total of 2 dice.  Other games, like Yatzee (Kniffel) involve matching pairs of equal dice.

Here is a very simple prototype with only 2 dice.  In this program, the [Roll] button rolls both dice.  Clicking on either of the pictures rolls just that one die.  Get a copy of the program and the pictures here:  GUIDice3.zip

img1.gif

 
Here are a few specific problems to solve:
  1. Add one more DIE, so there are 3 dice total.  The checkDice method should
    show the total for all 3 dice.
     
  2. Change checkDice so that it looks for, and announces, any of the following:
    (a) three 6's
    (b) three of a kind (any number)
    (c) any pair (any 2 of the 3 dice)
    (d) make sure that if all three dice match, the method does NOT say "pair".
    (e) if all 3 numbers are different, it says "bust"
     
  3. Add a new button above each of the DIE pictures.
    Make each button CHANGE the die below it.
    Use the corresponding rollDice1 or rollDice2 or rollDice3
    to re-roll the corresponding DIE picture.
    Check that the [CHECK] buttons still produce correct results
    after pressing any or all of these buttons.
     
  4. Make a game with the following rules:
    - There are 3 dice.
    - At the beginning, all 3 dice are rolled.
    - The user may then click 1 time on each die.  Do not permit the user
       to click the same DIE button twice - this can be accomplished
       by disabling the button after it is clicked. 
       Then  when the [ROLL] button is clicked, it should re-enable all the DIE buttons.
    - The player is not required to click 3 times.  They may stop whenever they like.
        Then they click the [checkDice] button, and score according to the following rules:
       --  Add up the three dice.
       --  If all 3 dice are equal, then multiply the total by 3.
       --  If there is a pair (and not 3 of a kind), multiply the total by 2.
       
  5. Make a new button for [Roll 1000 Times]
    This should roll 3 dice 1000 times and keep track of how many times:
    -  a pair occurred
    - 3 of a kind occurred
    - a total over 15 occured
    Then it displays the total results