Description: The game is a single player scenario, in which the player’s army needs to defeat the enemy’s (AI’s) army. There are 4 possible troops for an army: Archers, Spearman, Cavaliers, Footman. Each troop has some attributes and some actions. And to avoid excessive programming and calculation, we want to treat these troops as squadrons. The player always starts with 10 squadrons of their choices: they can choose any combinations of the 4 possible troop types. Each squadron should have 100 members of that troop type. Each turn, the player is allowed to choose one of their squadrons and perform an action which is allowed by that troop type. Player and the AI take turns to make actions. The game continues until either the player or the AI has no troops left. Troop Types and Descriptions: Archers: should be able to attack from range with no casualties, meaning the attack action should not cause any damage to themselves. They should be pretty fragile to anything themselves. They can’t be attacked by other 3 troop types unless there are no more melee troops alive in its army. Footman: nothing special, decent health, decent attack. They should be able to attack with some casualties. Cavaliers: Assaulting units. Their attack action deals super high damage while causing very small casualties unless they are against spearmen. But they are intrinsically fragile if being attacked. Spearmen: Defending units with a lot of health. Their attack actions do very little damage to all other units except for cavaliers. Requirements: Your game should be a single player game with multiple difficulty levels. Computers will have more squadrons based on the difficulty level. You should be sticking with OOP standards and implementing the concept of modular designs. Game doesn’t have to be perfectly balanced, but should be at least playable. Each Troop type should be an individual class. AI doesn’t have to be smart, you can simply let AI randomly choose what to attack. (Or it will get super complicated very fast)
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
Description:
The game is a single player scenario, in which the player’s army needs to defeat the enemy’s (
There are 4 possible troops for an army: Archers, Spearman, Cavaliers, Footman.
Each troop has some attributes and some actions. And to avoid excessive programming and calculation, we want to treat these troops as squadrons.
The player always starts with 10 squadrons of their choices: they can choose any combinations of the 4 possible troop types. Each squadron should have 100 members of that troop type.
Each turn, the player is allowed to choose one of their squadrons and perform an action which is allowed by that troop type. Player and the AI take turns to make actions.
The game continues until either the player or the AI has no troops left.
Troop Types and Descriptions:
Archers: should be able to attack from range with no casualties, meaning the attack action should not cause any damage to themselves. They should be pretty fragile to anything themselves. They can’t be attacked by other 3 troop types unless there are no more melee troops alive in its army.
Footman: nothing special, decent health, decent attack. They should be able to attack with some casualties.
Cavaliers: Assaulting units. Their attack action deals super high damage while causing very small casualties unless they are against spearmen. But they are intrinsically fragile if being attacked.
Spearmen: Defending units with a lot of health. Their attack actions do very little damage to all other units except for cavaliers.
Requirements:
- Your game should be a single player game with multiple difficulty levels. Computers will have more squadrons based on the difficulty level.
- You should be sticking with OOP standards and implementing the concept of modular designs.
- Game doesn’t have to be perfectly balanced, but should be at least playable.
- Each Troop type should be an individual class.
- AI doesn’t have to be smart, you can simply let AI randomly choose what to attack. (Or it will get super complicated very fast)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 3 steps with 5 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)