Goals

  • Use linked structures to hold and manipulate data
  • Modify an existing parent abstract class (for use by the derived classes)

Assignment

In this assignment, you will make a program to run a tournament. Start with your assignment 3 program for creatures if possible. If you had issues with assignment 3 and need to begin fresh, reference the creature descriptions from assignment 3 to build your fighters.

This is a one-user-two-players game. A user will enter the number of fighters both players will use. The user should also enter the type of creatures and names. The first player supplies a lineup of creatures in order. The second player then supplies his lineup of creatures in order. By lineup I mean something like a batting order in baseball or softball. The head of each lineup fights. The winner gets put at the back of his teams lineup; the other goes to the container for those who lost. The lineup order cannot be changed once the players are entered. Similarly, the loser pile should have the last loser at the top and the first loser at the bottom.

Even if a creature wins, she may have taken damage. You should restore some percentage of the damage when they get back in line. Make this simple as you are adding a new member function to the parent class. Some examples are: generate a random integer in some ranges, e.g., on a roll of 5 they recover 50% of the damage they lost, or some scheme of your own. If you want to use a different recovery function for each character, that is fine. Remember to use polymorphism if the recovery is different for different creatures!

After each round, you will display which type of creatures fought and which won (For example, Round 1: Team A Blue man VS. Team B Harry Potter, Harry Potter won!). At the end of the tournament (when one team or both run out of fighters in the lineup), your program will display final total points for each team (you can determine how to score each round of fight, for example, winner team +2, loser team -1, tie +1). You should display which team (player) won the tournament. This is another element you must define in the analysis and design stage. You must have a method to determine the winner and you can determine it by yourself. To help your testing and that of the graders, provide an option to display the winner and the updated scores for each round. Also provide an option at the end of the tournament to display the contents of the loser pile, i.e. print them out in order with the loser of the first round displayed last.

You should be using polymorphism and all creatures will inherit from the Creature class. Each object should be instantiated and put into their lineup. You will only use pointers to creatures in your program. A creature pointer can then be used to indicate an object of a subclass and polymorphism will ensure the correct function is called. Ask your TA if you are uncertain what this means.

NOTE: Depending upon your implementation in Assignment 3, you could have ties. How does that tie change your end of match logic? What do you do if the final match is a tie? Specifically, where do you put the fighters?

For this program, you must use the structures from Lab 6 to hold the lineups and the loser pile. Which (stack-like or queue-like) will you use for the lineup? Which will you use for the loser pile?

This is a programming assignment and not a complete game! Other than entering the lineup, the players just wait for the results. They should take no further actions. Make sure you test your program with instances of all creature types youve created. You may not be able to do an exhaustive test, but make it as extensive as you can.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.