Assignment: Chuck-a-luck ($$$)
Write a program to play the dice game chuck-a-luck.
You pick a number from 1 to 6, the the computer rolls three dice.
If the number you pick does not show up on any of the dice, then you loose and your bet is subtracted from your winnings.
If the number you pick shows up on any one dice you win 1:1, you win 1 dollar for every dollar you bet, The amount you won would be added to your winnings.
If the number you pick shows up on two of the dice you win 2:1, you win 2 dollars for every dollar you bet, The amount you won would be added to your winnings.
If the number you pick shows up on all of the dice you win 10:1, you win 10 dollars for every dollar you bet, The amount you won would be added to your winnings.
The program should start you at 0 dollars of winning the first time you play. It should use a hidden field to remember the winnings as you play over an over again.
Here is a link to a working program in php so you can see how it should work. You can change the design of the page, but your program should have all the features of this program:
Try it at: checkaluck.php
You can use the expression (int)rand(1,6) to get a random integer from 1 to 6 to simulate one die.
You should tell the user each time he rolls dice what the three dice values he rolled.
If he won or loss, and how much he won or loss on that roll.
and what his winnings are after the roll from adding the amount won or subtracting the amount bet if he lost.
You should have a reset link that goes back to the page without using a form to reset the winnings to zero.
publish your chuck a luck program to topic3 and submit the link here when it is working.
You pick a number from 1 to 6, the the computer rolls three dice.
If the number you pick does not show up on any of the dice, then you loose and your bet is subtracted from your winnings.
If the number you pick shows up on any one dice you win 1:1, you win 1 dollar for every dollar you bet, The amount you won would be added to your winnings.
If the number you pick shows up on two of the dice you win 2:1, you win 2 dollars for every dollar you bet, The amount you won would be added to your winnings.
If the number you pick shows up on all of the dice you win 10:1, you win 10 dollars for every dollar you bet, The amount you won would be added to your winnings.
The program should start you at 0 dollars of winning the first time you play. It should use a hidden field to remember the winnings as you play over an over again.
Here is a link to a working program in php so you can see how it should work. You can change the design of the page, but your program should have all the features of this program:
Try it at: checkaluck.php
You can use the expression (int)rand(1,6) to get a random integer from 1 to 6 to simulate one die.
You should tell the user each time he rolls dice what the three dice values he rolled.
If he won or loss, and how much he won or loss on that roll.
and what his winnings are after the roll from adding the amount won or subtracting the amount bet if he lost.
You should have a reset link that goes back to the page without using a form to reset the winnings to zero.
publish your chuck a luck program to topic3 and submit the link here when it is working.