Inheritance is a powerful and integral tool in object-oriented programming. Hierarchies existing in the real world can be modeled using inheritance; such a practice can simplify code.
Due to the added measure of complexity associated with inheritance, this assignment will be verified by a TA-written test driver.
The assignment is meant to be a review of what should have been learned in CS 142, or as a consequence of equivalent experience.
- CS 142 Class Text
A major part of modern computer use is video games, and it's all fun and games until someone has to program them. Even the most simple video games, like the ancient Pong, require a lot of code to work properly. Many of the most basic concepts in programming appear in simple, text-based role playing games, or RPGs.
For old time's sake, a friend has hired you to help write just such a game for his new company. Your first assignment is to implement the fighters awaiting battle at an arena. With three kinds of fighters and many stats for each fighter, you will need all of your previous programming experience to do well and keep your new job.
You will need these files(Windows) to complete the assignment. Details for method constraints are found in these documents and are still a part of the requirements. (If you downloaded the test driver documents before 8/30 12:00pm you will need to re-download them. An error was fixed.)
Part 1 - Construct the Arena (5 points)
- Extend the
ArenaInterfaceprovided; the arena is simply a collection of fighters, each with a unique name
- For Part 1 only, you may assume all strings passed to the arena's adding method will be of the correct format
- For Part 1 only, you may assume all strings passed to the arena's getting and removing methods will be names already existing in the arena
Part 2 - Let the Battle Begin (8 points)
- Extend the
FighterInterfaceprovided; details about abilities, stats, and more can be found in the
- For Part 3, the test driver will not call your
regenerate()methods, so it is possible to receive credit for Part 3 without these methods being complete
Completion of Part 1 is required to submit Part 2
Part 3 - Fortify the Walls (5 points)
- Make adding new fighters to your arena bullet-proof
- This involves rejecting any string that is not of the correct format or that would add a duplicate name to the arena
- Make getting and removing existing fighters in your arena bullet-proof Completion of Part 1 is required to submit Part 3
Part 4 - Let Me Show You My True Form... (12 points, 4 points per fighter type)
- Add functionality to the
useAbility()method and the
regenerate()method for each fighter type
isSimplified()method must return false for each fighter type to be tested to alert the test driver that full testing should occur for that fighter type
Completion of Part 1 is required to submit Part 4
- You are required to use inheritance to implement the three kinds of fighters. The TAs reserve the right to deny pass off to programs utilizing incorrect inheritance practices.
- Unless otherwise instructed, use standard integer division for all division operations specified. This means all fractional results should be rounded down (ex: 17/10 = 1).
Fighter String Format
- Fighters are represented as strings when added to the arena. The following format is expected:
- (name) (type) (maximum hit points) (strength) (speed) (magic)
- Example: Xephos A 200 13 21 10
- The name is a single word; the type is a single capital letter ((R)obot, (A)rcher, or (C)leric); the remaining four stats are positive integers.
- When adding to the arena, reject any string that does not follow this format to receive credit for Part 3.
- The algorithm for fighting is provided in
Battle.h. Given two fighters, its
fight()function will use the fighters' stats and abilities to determine a winner, which will always be the same given the same two fighters in the same order.
- This table can be used to help you test your characters, but understand that its results simply show who should win given your implementation of the
FighterInterface, not the correct implementation.
- The following is a table of battles that will be run by the test driver:
|First Fighter||Second Fighter|
|Fumblemore C 100 10 10 100||Creeper R 10 100 1 1|
|Creeper R 10 100 1 1||Sheep A 5 1 1 1|
|Cow R 10 2 1 3||Sheep A 5 1 1 1|
|Tinman R 100 5 1 7||Spacker R 50 1 1 1|
|Joshua R 1000 10 80 10||NORAD R 750 20 40 1|
|Honeydew R 150 14 8 11||HoneydewClone R 150 14 8 11|
|Israphel A 90 12 16 1||IsraphelClone A 90 12 16 1|
|Father_Braeburn C 90 4 12 20||Father_BraeburnClone C 90 4 12 20|
|Honeydew R 150 14 8 11||Israphel A 90 12 16 1|
|Israphel A 90 12 16 1||Father_Braeburn C 90 4 12 20|
|Honeydew R 150 14 8 11||Father_Braeburn C 90 4 12 20|