COMP 142 Project 2: Rock-Paper-Scissors-Lizard-Spock, C++ Version
For this project you will convert a simplified Python version of "Rock, Paper, Scissors, Lizard, Spock"
into an equivalent C++ program. This version of RPSLS is slightly different than Project 1;
this is not a multi-round game of RPSLS. There are two players to this game and the game
ends after one throw (unless there's a tie). So everyone gets practice converting Python functions,
lists, and matrices, you will all convert the same Python code (not your own code from Project 1).
[ Download starting Python code to convert ]
Your C++ code should be very similar to the starting Python code. Here are some additional guidelines.
- Your code should contain the exact same functions as the starter code.
That is, your C++ functions should take in similar
parameters and return similar values. The only difference is that C++'s main function will
return 0, while Python's main returns nothing.
- You should use function prototypes so that the main function can come first in your code.
- You should have comments for every function indicating the goal of the function and
any arguments or parameters.
- Your code should use the exact same variables, data types, and algorithms as the starter code, and should
work in
the exact same manner.
- Do not try to solve the project a different way; the idea of this project is to get you familiar
with coding in C++.
Hints
- For the global constants, be sure to use the const keyword.
- Do not use vectors for this code; normal C++ arrays work fine for constants
and vectors are a pain to initialize with constant values.
- For the gestures array, use a data type of string gestures[5].
See section 6.4 (particularly page 238) for a reminder on how to initialize an array.
- For the winloss array, use a data type of int winloss[5][5].
See section 6.8 for a reminder on how to initialize multidimensional arrays.
- You will need to #include <string> as well as <iostream>.
Coding style
- Use good indentation. Just because C++ lets you get away with bad indentation doesn't mean you
should. Stick to the same indentation style and placement of curly braces throughout your code.
- All of the same coding style guidelines from the first project still apply, including
the rules on commenting your code.
Testing your program
You should test your program thoroughly to make sure it works correctly.
What to turn in
Through Moodle, turn in your code as a file called rpsls_yourLastName_yourFirstName.cpp.
You do not need to turn in anything other than the .cpp file; I do not need all the other
files that Visual Studio creates.
Challenge Problems
None for this assignment. :(