.                                                . How to use this forum              The QBasic Forum

# Dice game project

April 30 2004 at 6:48 PM
S

Do one step at a time and post your code after you finish each step.

1- Start out with something simple. The user tosses 2 dice. Random number for each die is between 1 - 6. Total the 2 dice and tell the user the total. If the total is 7, 11, or 2, the user wins, otherwise he loses.

2- Ask the user how much he wants to bet. If the total comes up 7, he wins back double the bet. If it comes up 3 or 11, he wins triple the bet. If it comes up 2 or 12, he wins quadruple the bet. Otherwise he loses. Tell user how much he has now.

3- Ask the user how much money he has in the pot to start out with before the game begins. Now put the game into a DO loop. User may play as many games as he wants until his money (in the pot) runs out, or he wants to quit. Clear the screen at the beginning of each new toss. Tell the user how much money he started out with and how much money he now has in the pot. At the end of the toss, tell the user how much he won or lost and how much money is now in the pot. Ask if he wants to play again. At the end of the last game, tell the user how much he started out with, how much he has now, and how much he lost or won altogether.

4- Declare all variables by type. All numeric user inputs should be saved to string variables and converted to numbers with VAL. The user interface should be clean and neat. In America, all dollar amounts should be prefaced with a "\$" like this:

INPUT "How much money is in the pot? \$", spot\$

To do this with English pounds is a bit more complicated. You need to use the ASCII character for the pound sign in a PRINT statement and use the INPUT separately, like this:

PRINT "How much money is in the pot? "; CHR\$(156);
INPUT " ", spot\$

Check the ASCII table on pages 564-567 of your QB book for a list of characters.

 Respond to this message
 Response Title Author and Date *I'll get on to it View hread Andy Booth on May 1