UMBC CS 201, Spring 00
UMBC CMSC 201 Spring '00 CSEE | 201 | 201 S'00 | lectures | news | help

CMSC 201
Programming Project Two
Rock - Paper - Scissors

Due Date: Before Midnight, 3/7/00

New sample output posted 2/22/00 3:15 PM

Clarification posted 2/21/00 7:40 PM

The Objective

The objective of this assignment is to give you practice with top-down design and writing functions. You will also write a sophisticated user interface and use the random number generator

The Background

In the old children's game called Rock-Paper-Scissors, each child puts his hand behind his back. One child counts to 3. At the count of 3, each child brings his hand forward. His hand is held to form the shape of a rock (a fist), a piece of paper (held open and flat) or a pair of scissors (index and middle finger wide apart). In this game the winner is determined by the following rules. If both children's hands are the same, it a tie.

Rock breaks Scissors

Paper covers Rock

Scissors cut Paper

The Task

Your assignment is to write a program that simulates playing Rock-Paper-Scissors. The user will be one player and your program ("the system") will be the other player. After an appropriate greeting, your program will prompt the user for a random number "seed" value, then display the following menu:

R -- Choose Rock P -- Choose Paper S -- Choose Scissors G -- Display current Game statistics H -- Display this Help menu Q -- Quit If the user enters R, P or S, your program will play the game by randomly choosing Rock, Paper or Scissors, then determining if the player wins, the system wins, or there is a tie. Your program will accumulate the number of wins, losses and ties for the player. This information will be displayed when the user chooses G (Game stats) or Q (quits). Your program must accept both upper and lowercase input. If your program detects an invalid menu choice, it should respond with an appropriate error message, then display the menu.

Clarification 2/21/00

When using random numbers to represent Rock, Paper, Scissors, you MUST use the following values. If you use any other values, you (and the grader) will not be able to match the sample output.

Use 1 for Paper, 2 for Rock and 3 for Scissors

Assumptions

Hints

Sample Run

New sample output posted 2/22/00 3:15PM

umbc9[1]% a.out Welcome to Rock-Paper-Scissors Please enter a random number seed: 555 Rock - Paper - Scissors R = Choose Rock P = Choose Paper S = Choose Scissors G = Current Game Status H = Display this Help Menu Q = Quit Please enter selection: R System Chooses Scissors Rock breaks Scissors YOU WIN!! Please enter selection: r System Chooses Scissors Rock breaks Scissors YOU WIN!! Please enter selection: P System Chooses Rock Paper covers Rock YOU WIN!! Please enter selection: p System Chooses Paper Both chose Paper It's a Tie Please enter selection: S System Chooses Scissors Both chose Scissors It's a Tie Please enter selection: s System Chooses Paper Scissors cut Paper YOU WIN!! Please enter selection: G Player Wins: 4 Losses: 0 Ties: 2 Please enter selection: X Invalid Choice Rock - Paper - Scissors R = Choose Rock P = Choose Paper S = Choose Scissors G = Current Game Status H = Display this Help Menu Q = Quit Please enter selection: H Rock - Paper - Scissors R = Choose Rock P = Choose Paper S = Choose Scissors G = Current Game Status H = Display this Help Menu Q = Quit Please enter selection: g Player Wins: 4 Losses: 0 Ties: 2 Please enter selection: p System Chooses Scissors Scissors cut Paper Sorry, you lose Please enter selection: q Thanks for Playing Rock-Paper-Scissors Final Stats: Player Wins: 4 Losses: 1 Ties: 2 umbc9[2]%

Although your output need not be identical to the above, all information (including the greeting) must be present.

Submitting the Program

Your C source code file for this project MUST be called proj2.c.
To submit your project, type the following at the Unix prompt. Note that the project name starts with uppercase 'P'.

submit cs201 Proj2 proj2.c

To verify that your project was submitted, you can execute the following command at the Unix prompt. It will show all files that you submitted in a format similar to the Unix 'ls' command.

submitls cs201 Proj2


CSEE | 201 | 201 S'00 | lectures | news | help

Tuesday, 22-Feb-2000 15:15:50 EST