Question: Implement the RPS game (Rock, Paper, Scissors) Rock breaks Scissors Paper covers Rock Scissors cuts Paper Player class Private member variable int choice 1: Rock
Implement the RPS game (Rock, Paper, Scissors)
Rock breaks Scissors
Paper covers Rock
Scissors cuts Paper
Player class
Private member variable int choice
1: Rock
2: Paper
3: Scissor
function play()
HumanPlayer class
Inherits Player
Redefine play() function
Ask user for input
Input can be R, P, S for Rock, Paper, Scissor
Convert input to number and store in choice variable
ComputerPlayer class
Inherits Player
Redefine play() function
Generate random number between 1 and 3 (inclusive)
void determineWinner(Player &a, Player &b) { //Although this is not recommended, you don't have to put Player as const for this exercise Call a.play(); Call b.play(); Logic to compare choice of a and b and determine who won Print out a message for the winner } int main() { srand(1); Computer comp; Human human; determineWinner(human, comp); determineWinner(comp, comp); } 
include kiostream 2 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
