Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem Description Objective This practical tests your skills of writing classes. It also requires planned application of logic and code structure. Problemm In this practical
Problem Description Objective This practical tests your skills of writing classes. It also requires planned application of logic and code structure. Problemm In this practical assignment, you are going to implement a simple Rock, Paper, Scissors game in C++. Two players compete and, independently, choose one of Rock, Paper, or Scissors. They then simultaneously declare their choices. The winner of the game is determined by comparing the choices of the players. Rock beats Scissors, Scissors beats Paper, Paper beats Rock. Your task is to produce a set of classes that will allow a human player, typing instructions from the keyboard, to interact with a computer player. An independent referee class will decide whether the human or computer wins the game. In your design, there should at least exist a human player class, a computer player class and a referee class. You probably want to use a game controller class as well but the details are left up to you. Your submission should contain main.cpp (for your main code), Human. cpp Computer.cpp Referee.cpp Your submission should also include proper header files and a design.pdf The next practical assignment will build on this practical so you should make your code "future-proof". In Practical 3, we will consider more complex computer strategies, but for this assignment, to make things simple, we assume that the computer player only plays Rock. The human player's strategy is read from the input which consists of one single line. The line starts with a positive integer k, then followed by k moves (separated by spaces). A move is a character among R, P, and S For example, the input "3 S PR" means that the human player plays three times and each of the moves is scissors, paper, and rock. The referee class will match two players and return their competition results. For this practical, your referee class matches the dumb computer player (who only plays rock) and the human player. In Practical 3, your referee class may need to match different computer players against each other Your program should output the competition results between the human player and the dumb computer player. For the sample input "3 S P R", the output should be "L WT (L human loses; w human wins; T tie). Another example can be that for input 4 RRPS", the output should be 'TTW L (recall the dump computer player always plays rock). Finally, the main purpose of this practical is for you to practise organizing and writing classes. The point is not just to get the result correct (which is trivial as you can see) The main objective is producing code that is concise, well-structured, and future-proof
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started