Accurate Shooting
sadatbs opened this issue · 1 comments
Overview
In a multiplayer game called apex-nites, a player needs to find guns and shoot at other players to earn points. The last player to stay alive wins the game.(It's a Battle Royale game)
Initially the gun a player gets doesn't have any attachments. And without attachments the guns have high recoil( the backward momentum when a gun is shot) and low accuracy.
The players can buy and attach attachments to the gun to reduce recoil and increase accuracy. The attachments and their advantages are:
-
Barrel stabilizer: +15 unit accuracy
-
Standard stalk: +40 unit accuracy
-
Hop up: +30 unit accuracy
Increased accuracy in guns offer advantages to player in defeating their opponents.
Example
- player-1: attaches only hop-up.
- player-2: attaches hop-up first then barrel stabilizer.
- player-3: attaches barrel stabilizer first then hop-up.
- player-3: attaches barrel stabilizer first then hop-up then Standard stalk.
Assumptions
- A gun with no attachments has low accuracy.(1 unit accuracy).
- A player buys attachments with the points he earns by shooting other players. So the gamer earns
game currency as the game advances. - Higher accuracy attachments are costly and lower accuracy attachments are cheap.
Task
-
Code so that a player can attach attachments to a basic gun in any combination.
-
The attachments are to be attached at runtime.
Notes
- The problem could be done with inheritance but the goal is to accomplish it at runtime.
Reminders
- React to the problem if you find it interesting and helpful. This will help others to easily identify good problems to solve.
- Feel free to comment about the problem. Is the description unclear? Do you think it is too easy or too difficult than what is mentioned? Comment about it.
- Discussion about the solution is OK. But do not paste a solution here. Give a link to the solution instead.
- Do you have an interesting problem? Post it.
@sadatbs01: This is an excellent problem. I think the difficulty should be "hard".