The main objective of this assignment is to make sure that everyone has learned enough about C and the UNIX system to write a simple program with a loop, compile it, run it and turn in the program.
Your assignment is to write a program to play the game of craps. Craps is a casino game where the player (called the shooter) throws two six-sided dice. The outcome of the game depends on the results of several throws. According to Encyclopedia Britannica, the rules for craps are as follows:
For example, if the player's first throw is 6, he will roll the dice again and again until either 6 or 7 is rolled. If he rolls 6 he wins; 7 he loses.
Your program will help the shooter keep track of the game. Your program should ask the shooter to enter the result of each throw. You may assume that the shooter always enters a legal number between 2 and 12. After each entry, your program should tell the shooter if he/she has won the game, lost the game or should roll the dice again.
When you are sure that your program is properly documented and that it is working correctly and assuming that you already have a directory called bin in your account, you should use the following command to copy the mail2chang command to your account:
% cp ~chang/pub/cs201/mail2chang ~/bin/Then you can turn in your project using the mail2chang command. The program will ask you for a project number (1 in this case) and the name of the file that has your project. When the program asks you for an output file, answer none (for this project only). The mail2chang program simply mails your project to the e-mail address chang@gl.umbc.edu. You will get an e-mail message that your project was received. The response is automatically generated and may take as long as an hour to get to you (usually it takes 5 minutes). A copy of your submission is included in the reply, so you can double check that you sent the correct file by checking the reply.
Please do not use any other program (e.g., elm, pine, submit, etc.) to turn in your project.
This project is due by midnight on Wednesday, September 27, 1995. We will use the system clock as the final arbiter of time and date. If you turn in your project after the due date, a 4% penalty will be assessed. The penalty doubles every 24 hour period, including the weekend. For example, if you turn in the project on Saturday, September 30, a 16% penalty will be assessed.
If you wish, you can embellish your program by making sure that the shooter does not enter an illegal dice roll. If the shooter enters 13, for example, your program can prompt the shooter to enter a legal value.
The following is a sample run of one version of the project. Your program should behave in a similar manner, but it does not have to be identical to this one.
lassie% a.out Ready for a game of craps. Enter the first throw: 7 You win!!! lassie% a.out Ready for a game of craps. Enter the first throw: 11 A natural! You win!!! lassie% a.out Ready for a game of craps. Enter the first throw: 12 Craps, you lose lassie% a.out Ready for a game of craps. Enter the first throw: 2 Oh well, you lose lassie% a.out Ready for a game of craps. Enter the first throw: 6 Roll again and enter the throw: 8 Roll again and enter the throw: 9 Roll again and enter the throw: 12 Roll again and enter the throw: 3 Roll again and enter the throw: 2 Roll again and enter the throw: 6 You made your point! You win!!! lassie% a.out Ready for a game of craps. Enter the first throw: 5 Roll again and enter the throw: 4 Roll again and enter the throw: 6 Roll again and enter the throw: 6 Roll again and enter the throw: 7 You crapped out, you lose