Question: Write a computer game based on rock-paper- scissors in C++. The 2-player game will be interactive: human vs. computer! Making the game interactive presents a
Write a computer game based on rock-paper- scissors in C++. The 2-player game will be interactive: human vs. computer! Making the game interactive presents a new issue for us -- how do we get the computer's choice? To solve this, we will use a "random number generator", which is the basis for all computer gaming. This enables the properly programmed computer to act like it is actually "thinking" and making its own decisions. This is the largest, most involved program we have yet written. It will require careful step-by- step development. You will be lead through this one in a series of steps, in an effort to train you in the software development process. In the coding for this game you will use code blocks, loops, and if and/or switch structures. Organizing code into "code blocks" will prepare you for moving code blocks into subprograms in coming labs. The game will replay until the human player decides to quit. Human input will be through the keyboard, entering R for rock, P for paper, S for scissors, or Q to quit. Computer input will be randomly generated. Here is sample output for the game, with the input prompt in blue, the human response in red, and the results in green: Choose: [Rock,Paper,Scissors,Quit]: p Computer:S, Human:P, Computer wins Choose: [Rock,Paper,Scissors,Quit]: p Computer:P, Human:P, tie Choose: [Rock,Paper,Scissors,Quit]: p Computer:R, Human:P, Human wins Choose: [Rock,Paper,Scissors,Quit]: p Computer:S, Human:P, Computer wins Choose: [Rock,Paper,Scissors,Quit]: x Choose: [Rock,Paper,Scissors,Quit]: p Computer:S, Human:P, Computer wins Choose: [Rock,Paper,Scissors,Quit]: q Do not color code your I/O!
Use only techniques taught in this class. Do NOT use regular expressions. Do NOT use arrays. Do NOT use subprograms. Do NOT use pointers. These are great programming tools, but we have not covered them.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
