Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Description Objective This practical tests your knowledge of implementing classes with inheritance in mind. It also requires planned pplication of logic and code structure.

image text in transcribed

Problem Description Objective This practical tests your knowledge of implementing classes with inheritance in mind. It also requires planned pplication of logic and code structure. Design In a file named design.pdf, describe how you are going to solve the problem and test your implementation with the test cases you designed based on the stages below. Testing Hint: it's easier if you test things as a small piece of code, rather than building a giant lump of code that doesn't compile or run correctly. As part of your design,you should also sketch out how you are going to build and test each function in the code Problem In this practical, you are going to improve your Rock Paper Scissors (RPS) program, allawing for greater flexibility. The rules are the same as before:two players compete by choosing Rock, Paper or Scissors and the winner of the game is determined by comparing the choices of the players. Rack beats Scissors,Scissors beats Paper, Paper beats Rock. This practical builds upon the previous practical. As such, we assume that in your implementation, there exist files named Conputer.cpp You are asked to modify these casses with the names pravided in the following individual stages 1 New computer players: Create the following computer players making use of inher-itance. Use your computer player class for Practical 2 as the base class. Note: the derived Avalanche class may be identical to your base class. RandomCdrtputer.cpp: RandonCorputer naturris random 0ve- Avalanche always Bureducrat.pp: Bureaucrat alyschoosas Paper Toolbox.cpp: Toolbox dledys chooses Seissors Crescendo. cpp: Crescendo moves in the foll ing order: Paper, scissors, Rock PapeDoll.epp: Paper doll nves in the follewing order: Paper, Seissors, Scissors Fistful10Collars.epp: FistfulloCollars noves in the folloning order: Rock, Peper, Paper 2 New referee: Previously, referee only matches one human player against one com- puter player. Here, your referee class should be able to match any two players together. (Hint: If you think in advance in Practical 2 and implement a common base class for all players, you may save some efforts in this Tournament: Create a class called Tournament in file Tournament.h and Tournament.cpp. In Tournament.cpp there should be a function that reads in the eight players and sets them against each other. The bracket follows the illustration as follows. The rounds are run as illustrated in the picture below In every round, the winner is determined after five plays ldraws count as plays. That is, in every round, two players play against each other five times. The one who wins more advances. If both win the same number of plays, then the player with a lawer index advances.(e.g. if Player2 and Player4 reach a tie after 5 plays, then Player2 advances. Also, players "refresh their memories between rounds. That is, whenever Crescendo enters a round it plays paper first glzyers plzyerS our main.cpp file should have access to all your classes The input consists af one line: a list of computer player names (from the above Est, excluding RandomComputer divided by space where the i-th name represents Player iin the bracket. The output is the name of the grand winner Sample input: Avalanche Bureaucrat Bureaucrat Toolbox Toolbax Crescendo Crescendo FistfulIoDollars Sample output Toolbox

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Technology

Authors: Suad Alagic

1st Edition

354096276X, 978-3540962762

More Books

Students also viewed these Databases questions

Question

2. Describe why we form relationships

Answered: 1 week ago

Question

5. Outline the predictable stages of most relationships

Answered: 1 week ago