Java Advanced Programming



Objective

The objective of don is kill or eliminate all the non-dons such that the ratio of the alive dons to all others is 1:1.The player can be eliminated out by two ways: 1) By being killed by the don or by 2) Be eliminated in a vote out. Once a player is eliminated, they cannot be brought back to life. Dons cannot kill themselves.The objective for all other players(except the don) is to eliminate the dons through a vote out(as the dons cannot be killed). Therefore, by using special powers of finders and savers, they are required to save themselves and vote out the dons.


Role of different type of players:


1. Dons: To kill all other players to achieve a 1:1 ratio.

2. Finder: They can randomly test one of the players (except finder) to test whether the player is don or not. If they correctly identify a don, the caught don will be vote out in that round by default.

3. saver: They randomly select a player from the game to give him a boost of 500 HP (All

players, including dons and savers themselves).

4. Commoner: They don't have any special role. They only take part in the voting process.



End of Game:

The game ends when either all dons are voted out or the ratio of dons to others becomes 1:1. The don wins in the latter case and loses in the former.

You need to announce the winners at the end of the game along with the roles of each player. you must use OOP concepts, especially the topics on which this is based.


The design/working is as follows:

[A] On starting the game:

1) Each invocation of the game will be considered a new game. Hence, no need to create a database of users or saving their game. At the beginning of each execution, the user is

supposed to enter the number N, i.e., the total number of players in the game. The minimum number of players for the game is 4. If the player enters a number less than 4,

the program asks for N again. Under no circumstances should your program terminate unexpectedly.

(explained in test cases).


2) Then the user is given the option of either choosing their character (don, Commoner,

finder, or saver) on their own or be allotted a character randomly by the program.


After allocating the user his/her role, there should be N/5 dons, N/5 finders, max {1, N/10} savers, and the remaining players should be commoners. Here, the '/' operator is floored division. For example, for N=11, there will be 2 dons,2 finders, 1 saver, and 6 commoners.


[B] Gameplay

1) The game will run in rounds. In each round, there will be fixed steps that are followed.

  • a) Firstly the dons choose to kill a person(other than dons). If the user is a don player, then he/she will be asked to choose the target.

  • b) Then the finder will test a person to know whether he is don or not. If the user is a finder player, then he/she will be asked who they want to test.

  • c) Then the saver will heal a person by giving him an HP boost as defined in HP rules. If the user is a saver player, then he/she will be asked who they want to heal.

  • d) If after healing, the HP of the person killed by the don reaches 0, the player dies.

  • e) After this, there is a voting round where each player votes randomly, and the user(If alive) votes for whoever he/she wants to vote for. The person with the highest votes is kicked out of the game.

  • f) However, if the finder tests positive on a don, there will be no voting, and the caught don will be voted out by default. Once a player is out of the game, they can not re-enter the game.

  • g) If there are no finders left, there will be no test and/or if there are no savers left, there will be no HP boost. The game will keep on moving until we arrive at an end of game condition.

  • h) If there are multiple dons then they vote collectively i.e. they decide one player to kill. In the same way, all finders choose one player to test and savers choose one player to heal. At no point in time dons can kill multiple players in a single round, or finders can test multiple players, and/or savers can heal multiple players. Although when taking the vote, each player votes independently so as to protect his/her identity.

  • i) In each round, there is fresh voting that takes place. Votes from previous rounds are not counted. Only one player is voted out in each round.

  • j) In case the votes are tied, the voting process is repeated until there is no tie

2) HP Rules:


a) All commoners start with an HP of 1000 each.

b) All dons will start with 2500 HP each.

c) All finders and savers start with an HP of 800 each.

d) In each Round, savers can increase any players HP by 500.

e) When the dons choose a target, if their combined HP is equal to or more than that target's current HP, the target's HP becomes 0. However, if their combined HP is less than that targets current HP, the targets HP reduces by the combined HP of the dons.

f) Further, as damage, each dons HP will be reduced by X/Y, where X is the initial HP of the target(before being killed), and Y is the number of alive dons whose HP is greater than 0. If the target's HP falls below or equal to 0, the target dies.

For example, if there are 2 dons with HP 500 and 1000. Suppose the target has an HP of 1000. Then, since the combined HP of dons (1500) is greater than the target's HP, the target dies. And the new HP of the dons is 0 and 500, respectively.

Note that dons cannot be killed even if their HP falls to 0. They can only be voted out. Please note that HP can not fall below 0 for any player.

In case, at the time of selection of target, one of the dons has an HP less than X/Y, then this don will contribute to the damage by his total HP(making his HP to zero), and the remaining Damage will be equally divided. This process is continued until all Damage is absorbed, or the HP of all dons becomes 0.


For example, if there are two dons don1 and don2 with HP 100 and 200 respectively and they kill a player with HP 250, then the final HP of dons after the kill are 0 and 50.

g) If the saver chooses a person who was a target that died in that round itself, the

target is revived, and the new HP of the target is 500. No one dies in such a situation. However, the dons will still take the damage as explained earlier.

In other words, the target is chosen first, and then the dons and target take their damages, after which the saver chooses to heal someone. However, the target dies if his HP becomes zero and is not chosen by the saver to heal.

h) The saver can choose any player(including don) for the HP boost that is currently playing the game. Players that were killed/voted out in the previous rounds don't participate in any way and hence can't be chosen in any scenario.



Send your requirement directly at contact@codersarts.com and get instant help by our java programming expert and web developers

Contact Us

Tel: (+91) 0120  4118730  

Time :   10 : 00  AM -  08 : 00 PM IST 

Registered address: G-69, Sector 63, 

 Noida - 201301, India

We Provide Services Across The different countries

USA    Australia   Canada   UK    UAE    Singapore   New Zealand    Malasia   India   Ireland   Germany

CodersArts is a Product by Sofstack Technology Solutions Pvt. Ltd.

  • CodersArts | Linkedin
  • Instagram