INSTRUCTIONS
You must finish this assignment with the provided files.
Download them in the Download page.
You task is to complete all the missing function
implementations in Arena.cpp, Fighter.cpp and
Weapon.cpp according to the corresponding header
files, the main.cpp, and this assignment description
webpage.
For submission details, please refer to the Submission
and Deadlinepage.
Most instructions are in the provided files. Please read
and follow them carefully. The description below
provides the only missing information and helps you
understand the requirements. Also read the FAQ for
some common clarifications. Refer to the sample output
and/or the demo program for the expected output
produced by a finished work.
ARENA MANAGEMENT SYSTEM
This fight management system should provide caesar
with some especial powers. In this fight management
system, caesar is able to recruit or dismiss any fighter
whenever he wants. While recruiting a fighter, caesar
can assign values to the fighter's strength and
durability. Furthermore, the caesar can add or delete a
weapon from the game. Three types of weapons are
included within these gladiator games which are melee,
ranged and magic in name. It should be noted that all of
the fighters are unarmed in the first place and should be
given a weapon by caesar. Each of these weapons
should be given merely to a fighter at a time. However,
the caesar's power is not limited to these and caesar
can alter the regulations of the arena through the arena
options. In another words, caesar can decide on the
format of fighting to be either armed or unarmed; plus,
he can assign a value to the reward (money) which will
be gifted to the winner of battle at the end of the game.
It is clear that assigned weapon's of the fighters will
have no effect on an unarmed type of battle.
Throughout these games, the reward is important in a
sense that if the budget (money) of a fighter hit zero,
caesar will be asked to decide about the destiny of that
fighter either by killing him or keeping him alive. Finally,
the program should be capable of recruiting some basic
legions and stock weapons whenever it is asked for.
TASKS
Your duty is to complete the provided C++ files,
Arena.cpp, Fighter.cpp and Weapon.cpp, according to
the corresponding header files, the main.cpp, and this
description webpage. Your implemented arena
management system will need to provide the ability to
recruit/dismiss fighters to/from the arena, add/remove
weapons, assign weapons to fighters, set the rules for
arena and also to report the result of a battle. Please
refer to the demo for the details of the program.
ASSUMPTIONS
The main.cpp and the header files are already
completed and should not be modified. For scenarios
not already handled in the main.cpp and not specified in
the comments/description, you do not need to address
them.
The fighters being added to the arena management
system are identified by their names, weapons
assigned, strength and durability (health point).
The weapons can merely be assigned to a fighter at a
time.
If the health points of two fighters hit zero or below at
the same time, the result of game should be reported
as draw.
The game should ask you whether you like to keep or
delete a fighter whenever his money budget hits zero.
REFERENCE (C++ STRING CLASS)
You will use the C++ string class (instead of C-string,
i.e., null-terminated char array) in this assignment. You
may refer to the COMP2011 lecture note on C++ string
class here.
It will simplify a lot of your implementation as you don't
have to deal with character pointers directly. (The
beauty of abstraction!) It also makes certain tasks
easier. For example, to check whether string
objects a and b have the same content, you may
simply do:
if (a == b) { /* ... */ }
Note that the comparison is case-sensitive, and our
assignment does require that for all kinds of string
comparison involved.
SAMPLE OUTPUT
Your program should produce the exact output as
follows. Make sure your submitted program does not
output anything else (e.g. debugging messages). You
can also download a finished demo program in
the Download page.
The following sample run doesn't test all scenarios. It is
part of the assessment for you to design your own test
cases to test your programs to fulfill all written
requirements.
All user inputs are colored green below.
Welcome to the ARENA
1. Check Fighters
2. Go to Armory
3. Recruit fighter
4. Dismiss a fighter
5. Arena Options
6. Fight
7. Recruit basic legion and stock weapons
8. Test copy constructor
0. Quit
What would you like to do, your grace? [0-8]? 3
What is the name of this mighty warrior? Jack
What is the strength of the fighter? [1-20]? 15
How durable is the warrior? [60-250]? 200
Jack has been added.
1. Check Fighters
2. Go to Armory
3. Recruit fighter
4. Dismiss a fighter
5. Arena Options
6. Fight
7. Recruit basic legion and stock weapons
8. Test copy constructor
0. Quit
What would you like to do, your grace? [0-8]? 3
What is the name of this mighty warrior? Aku
What is the strength of the fighter? [1-20]? 5
How durable is the warrior? [60-250]? 70
Aku has been added.
1. Check Fighters
2. Go to Armory
3. Recruit fighter
4. Dismiss a fighter
5. Arena Options
6. Fight
7. Recruit basic legion and stock weapons
8. Test copy constructor
0. Quit
What would you like to do, your grace? [0-8]? 1
Listing all the fighters(2) fighters...
0
Jack :
Str: 15, Hp: 200
Weapon: None(unarmed)
Money: 1000
1
Aku :
Str: 5, Hp: 70
Weapon: None(unarmed)
Money: 1000
1. Check Fighters
2. Go to Armory
3. Recruit fighter
4. Dismiss a fighter
5. Arena Options
6. Fight
7. Recruit basic legion and stock weapons
8. Test copy constructor
0. Quit
What would you like to do, your grace? [0-8]? 2
What would you like to do in armory, your
highness?
1. View Weapons
2. Forge a new Weapon
3. Arm a Fighter
4. Destroy a Weapon
0. Return
[0-4]? 2
How would you like to name the weapon? Sword
What is the type of the weapon? magic
How powerful is the weapon? [0-15]? 10
Sword has been added.
1. Check Fighters
2. Go to Armory
3. Recruit fighter
4. Dismiss a fighter
5. Arena Options
6. Fight
7. Recruit basic legion and stock weapons
8. Test copy constructor
0. Quit
What would you like to do, your grace? [0-8]? 2
What would you like to do in armory, your
highness?
1. View Weapons
2. Forge a new Weapon
3. Arm a Fighter
4. Destroy a Weapon
0. Return
[0-4]? 1
Listing all our weapons(1) weapon...
0
Sword
Owner: None
Power: 10(magic)
1. Check Fighters
2. Go to Armory
3. Recruit fighter
4. Dismiss a fighter
5. Arena Options
6. Fight
7. Recruit basic legion and stock weapons
8. Test copy constructor
0. Quit
What would you like to do, your grace? [0-8]? 2
What would you like to do in armory, your
highness?
1. View Weapons
2. Forge a new Weapon
3. Arm a Fighter
4. Destroy a Weapon
0. Return
[0-4]? 3
What is the name of weapon, you want to give, your
majesty? Sword
What is the name of fighter, you want to give, your
majesty? Jack
Sword has been given to Jack
1. Check Fighters
2. Go to Armory
3. Recruit fighter
4. Dismiss a fighter
5. Arena Options
6. Fight
7. Recruit basic legion and stock weapons
8. Test copy constructor
0. Quit
What would you like to do, your grace? [0-8]? 5
My lord you want to change the rules of the arena?
My lord, what shall be the new reward? [1-1000]?
500
My lord, please select the rules for fighting:
unarmed[0], armed[1] [0-1]? 1
New reward is set to 500
Rule has been set to armed
1. Check Fighters
2. Go to Armory
3. Recruit fighter
4. Dismiss a fighter
5. Arena Options
6. Fight
7. Recruit basic legion and stock weapons
8. Test copy constructor
0. Quit
What would you like to do, your grace? [0-8]? 6
Your highness i require the name of the
contestants:
What is the first fighters's name? Jack
What is the second fighter's name? Aku
Fighter 1:
Jack :
Str: 15, Hp: 200
Weapon: Sword(magic)
Money: 1000
Aku :
Str: 5, Hp: 70
Weapon: None(unarmed)
Money: 1000
Jack hits Aku for 50 damage
Aku remaining hp: 20
Aku hits Jack for 6 damage
Jack remaining hp: 194
Jack hits Aku for 50 damage
Aku remaining hp: -30
Aku hits Jack for 6 damage
Jack remaining hp: 188
Jack wins
1. Check Fighters
2. Go to Armory
3. Recruit fighter
4. Dismiss a fighter
5. Arena Options
6. Fight
7. Recruit basic legion and stock weapons
8. Test copy constructor
0. Quit
What would you like to do, your grace? [0-8]? 8
Testing copy constructor, otherwise functionless
kakaka
Printing Arena2
Listing all the fighters(3) fighters...
0
Warrior :
Str: 10, Hp: 60
Weapon: Sword(melee)
Money: 1000
1
Ranger :
Str: 10, Hp: 60
Weapon: Bow(ranged)
Money: 1000
2
Mage :
Str: 10, Hp: 60
Weapon: Staff(magic)
Money: 1000
Printing Arena3
Listing all the fighters(3) fighters...
0
Warrior :
Str: 10, Hp: 60
Weapon: Sword(melee)
Money: 1000
1
Ranger :
Str: 10, Hp: 60
Weapon: Bow(ranged)
Money: 1000
2
Mage :
Str: 10, Hp: 60
Weapon: Staff(magic)
Money: 1000
Making changes
Printing Arena2
There is no fighter in the arena yet.
Printing Arena3
Listing all the fighters(3) fighters...
0
Warrior :
Str: 10, Hp: 60
Weapon: Sword(melee)
Money: 1000
1
Ranger :
Str: 10, Hp: 60
Weapon: Bow(ranged)
Money: 1000
2
Mage :
Str: 10, Hp: 60
Weapon: Staff(magic)
Money: 1000
Copy constructors tested
1. Check Fighters
2. Go to Armory
3. Recruit fighter
4. Dismiss a fighter
5. Arena Options
6. Fight
7. Recruit basic legion and stock weapons
8. Test copy constructor
0. Quit
What would you like to do, your grace? [0-8]? 4
My lord, which warrior dissappointed you, give me
the name and I will get rid of him.
Aku
Aku has been removed.
1. Check Fighters
2. Go to Armory
3. Recruit fighter
4. Dismiss a fighter
5. Arena Options
6. Fight
7. Recruit basic legion and stock weapons
8. Test copy constructor
0. Quit
What would you like to do, your grace? [0-8]? 0
Till next time