CSCI 261 - Programming Concepts (C++)Fall 2016 - Assignment 03 - Rock, Paper, Scissors, Lizard, SpockQuick Links: Blackboard | EECS | Mines | Piazza | zyBooks |
|||||||||||
| Home | Contact | Syllabus | Assignments | Schedule | Resources | | |||||||||||
This assignment is due by September 14, 2016 08:00am.
In this homework assignment you have the opportunity you will continue to use boolean expressions and conditional statements.
Before you Begin CodingYou may want to use your A02 solution as the starting point for this assignment or you can start from scratch. Alternatively if you feel you struggled with the last assignment and need a strong starting point, then we have provided a working solution to A02 that you may use as a starting point for this assignment - access the code here.
It's easy for the logic in this assignment to get out of control very quickly. We strongly recommend that you sit down with a pencil and paper to sketch the flow of the logic that you'll need. Use pseudocode, rough flowcharts, boxes, arrows, stickmen, or whatever means you need to create a clear structure for the logic of your Rock, Paper, Scissors, Lizard, Spock game. After you have pseudocode for your solution, then
create yourself an empty project. You should know how to do this by now.
RPSLSMost of you have likely played the classic game Rock, Paper, Scissors but you can thank Sheldon for popularizing Rock, Paper, Scissors, Lizard, Spock. Feel free to practice a few games to fully understand what beats what. Below is the logic. An arrow points from X to Y following the "X beats Y" pattern. You will notice there are more ways to win or lose and a smaller possibility to tie.
InstructionsYour goal is to implement a Human-vs-Computer version of Rock, Paper, Scissors, Lizard, Spock. The Human Player will now enter a string of either "Rock" or "Paper" or "Scissors" or "Lizard" or "Spock".
The computer will generate a random number to make its decision. Specifically, generate a random number and then use (randNumGenerated % 5) to generate a 0 (Rock), 1 (Paper), 2 (Scissors), 3 (Lizard), or 4 (Spock) for the computer. Then assign "Rock", "Paper", "Scissors", "Lizard", or "Spock" to the computer's choice accordingly. Once each player has made a decision, print out who wins or if the game is a tie. Example outputs follows:
Welcome one and all to a round of Rock, Paper, Scissors, Lizard, Spock! (Enter your choice)
Player one: Rock Computer: Lizard Rock beats Lizard. You win! Here is another example:
Welcome one and all to a round of Rock, Paper, Scissors, Lizard, Spock! (Enter your choice)
Player one: Rock Computer: Spock Spock beats Rock. Computer wins! Here is a final example:
Welcome one and all to a round of Rock, Paper, Scissors, Lizard, Spock! (Enter your choice)
Player one: Scissors Computer: Scissors Scissors tie Scissors. Nobody wins. The solution you submit should provide output like the last
three example outputs.
Functional Requirements
Your solution must contiain the following features in your code:
Lastly a hint and some motivation. There are many more combinations that need to be checked in this version than in RPS. There are likewise many more ways to determine who wins a game. The logic operators will be very useful to simplify making comparisons to determine who wins.
For extra credit: You will receive 2 bonus points if your logic solution uses a single if, else if, and else structure to determine who wins. That is your solution would fit the following format and the output is always correct regardless of choices: if( /* condition1 */ ) { // something happens } else if( /* condition2 */ ) { // or something else happens } else { // otherwise this happens } Grading Rubric
Your submission will be graded according to the following rubric.
SubmissionAlways, always, ALWAYS update the header comments at the top of your main.cpp file. And if you ever get stuck, remember that there is LOTS of help available.
In summary, for homework due on Wednesday, September 14 follow these specific steps:
This assignment is due by September 14, 2016 08:00am.
| |||||||||||
Last Updated: 01/01/70 00:00
|