[ ] Provide a group of C++ classes that implements the execution of orders following the official rules of the Warzone
game. The code that implements the execution of the orders must be placed within the execute() method of the
order class/subclasses in the Orders.cpp/Orders.h files.
[ ] Each specific order kind (listed below) must be a subclass of an abstract class named Order that has a pure virtual method named execute().
[ ] Deploy order: A deploy order tells a certain number of army units taken from the reinforcement pool to deploy to
a target territory owned by the player issuing this order.
• If the target territory does not belong to the player that issued the order, the order is invalid.
• If the target territory belongs to the player that issued the deploy order, the selected number of army units
is added to the number of army units on that territory.
[ ] Advance order: An advance order tells a certain number of army units to move from a source territory to a target
adjacent territory.
• If the source territory does not belong to the player that issued the order, the order is invalid.
• If the target territory is not adjacent to the source territory, the order is invalid.
• If the source and target territory both belong to the player that issued the order, the army units are moved
from the source to the target territory.
• If the target territory belongs to another player than the player that issued the advance order, an attack is
simulated when the order is executed. An attack is simulated by the following battle simulation
mechanism:
o Each attacking army unit involved has 60% chances of killing one defending army. At the same time,
each defending army unit has 70% chances of killing one attacking army unit.
o If all the defender's army units are eliminated, the attacker captures the territory. The attacking army
units that survived the battle then occupy the conquered territory.
o A player receives a card at the end of his turn if they successfully conquered at least one territory
during their turn, i.e. a player cannot receive more than one card per turn.
[ ] Airlift order: An airlift order tells a certain number of army units taken from a source territory to be moved to a
target territory, the source and the target territory being owned by the player issuing the order. The airlift order can
only be created by playing the airlift card.
• The target territory does not need to be adjacent to the source territory.
• If the source or target territory does not belong to the player that issued the order, the order is invalid.
• If both the source and target territories belong to the player that issue the airlift order, then the selected
number of army units is moved from the source to the target territory.
[ ] Bomb order: A bomb order targets a territory owned by another player than the one issuing the order. Its result is
to remove half of the army units from this territory. The bomb order can only be created by playing the bomb card.
• If the target belongs to the player that issued the order, the order is invalid.
• If the target territory is not adjacent to one of the territory owned by the player issuing the order, then the
order is invalid.
• If the order is valid, half of the army units are removed from this territory.
[ ] Blockade order: A blockade order targets a territory that belongs to the player issuing the order. Its effect is to
double the number of army units on the territory and to transfer the ownership of the territory to the Neutral player.
The blockade order can only be created by playing the blockade card.
• If the target territory belongs to an enemy player, the order is declared invalid.
If the target territory belongs to the player issuing the order, the number of army units on the territory is
doubled and the ownership of the territory is transferred to the Neutral player, which must be created if it
does not already exist.
[ ] Negotiate order: A negotiate order targets an enemy player. It results in the target player and the player issuing
the order to not be able to successfully attack each others’ territories for the remainder of the turn. The negotiate
order can only be created by playing the diplomacy card.
• If the target is the player issuing the order, then the order is invalid.
• If the target is an enemy player, then the effect is that any attack that may be declared between territories
of the player issuing the negotiate order and the target player will result in an invalid order.
[ ] You must deliver a driver as a free function named testOrderExecution() that demonstrates that
(1) each order is validated before being executed according to the above descriptions;
(2) ownership of a territory is transferred to the attacking player if a territory is conquered as a result of an advance order;
(3) one card is given to a player if they conquer at least one territory in a turn (not more than one card per turn);
(4) the negotiate order prevents attacks between the two players involved;
(5) the blockade order transfers ownership to the Neutral player;
(6) all the orders described above can be issued by a player and executed by the game engine. This driver
function must be in the OrdersDriver.cpp file.
[ ] Provide a group of C++ classes that implements the execution of orders following the official rules of the Warzone game. The code that implements the execution of the orders must be placed within the execute() method of the order class/subclasses in the Orders.cpp/Orders.h files.
[ ] Each specific order kind (listed below) must be a subclass of an abstract class named Order that has a pure virtual method named execute().
[ ] Deploy order: A deploy order tells a certain number of army units taken from the reinforcement pool to deploy to a target territory owned by the player issuing this order. • If the target territory does not belong to the player that issued the order, the order is invalid. • If the target territory belongs to the player that issued the deploy order, the selected number of army units is added to the number of army units on that territory.
[ ] Advance order: An advance order tells a certain number of army units to move from a source territory to a target adjacent territory. • If the source territory does not belong to the player that issued the order, the order is invalid. • If the target territory is not adjacent to the source territory, the order is invalid. • If the source and target territory both belong to the player that issued the order, the army units are moved from the source to the target territory. • If the target territory belongs to another player than the player that issued the advance order, an attack is simulated when the order is executed. An attack is simulated by the following battle simulation mechanism: o Each attacking army unit involved has 60% chances of killing one defending army. At the same time, each defending army unit has 70% chances of killing one attacking army unit. o If all the defender's army units are eliminated, the attacker captures the territory. The attacking army units that survived the battle then occupy the conquered territory. o A player receives a card at the end of his turn if they successfully conquered at least one territory during their turn, i.e. a player cannot receive more than one card per turn.
[ ] Airlift order: An airlift order tells a certain number of army units taken from a source territory to be moved to a target territory, the source and the target territory being owned by the player issuing the order. The airlift order can only be created by playing the airlift card. • The target territory does not need to be adjacent to the source territory. • If the source or target territory does not belong to the player that issued the order, the order is invalid. • If both the source and target territories belong to the player that issue the airlift order, then the selected number of army units is moved from the source to the target territory.
[ ] Bomb order: A bomb order targets a territory owned by another player than the one issuing the order. Its result is to remove half of the army units from this territory. The bomb order can only be created by playing the bomb card. • If the target belongs to the player that issued the order, the order is invalid. • If the target territory is not adjacent to one of the territory owned by the player issuing the order, then the order is invalid. • If the order is valid, half of the army units are removed from this territory.
[ ] Blockade order: A blockade order targets a territory that belongs to the player issuing the order. Its effect is to double the number of army units on the territory and to transfer the ownership of the territory to the Neutral player. The blockade order can only be created by playing the blockade card. • If the target territory belongs to an enemy player, the order is declared invalid. If the target territory belongs to the player issuing the order, the number of army units on the territory is doubled and the ownership of the territory is transferred to the Neutral player, which must be created if it does not already exist.
[ ] Negotiate order: A negotiate order targets an enemy player. It results in the target player and the player issuing the order to not be able to successfully attack each others’ territories for the remainder of the turn. The negotiate order can only be created by playing the diplomacy card. • If the target is the player issuing the order, then the order is invalid. • If the target is an enemy player, then the effect is that any attack that may be declared between territories of the player issuing the negotiate order and the target player will result in an invalid order.
[ ] You must deliver a driver as a free function named testOrderExecution() that demonstrates that (1) each order is validated before being executed according to the above descriptions; (2) ownership of a territory is transferred to the attacking player if a territory is conquered as a result of an advance order; (3) one card is given to a player if they conquer at least one territory in a turn (not more than one card per turn); (4) the negotiate order prevents attacks between the two players involved; (5) the blockade order transfers ownership to the Neutral player; (6) all the orders described above can be issued by a player and executed by the game engine. This driver function must be in the OrdersDriver.cpp file.