iut-cse/OOKata

Battle For the Title

sadatbs opened this issue · 0 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!!).
About 60 people play in a match in teams of 3. There is a ranking system in the match. The Player who defeats 3 enemies first gets the title of "POINTS LEADER". He remains points leader as long as he has the highest points. If any other player earns more points than him/her at any point of time in the match the later is appointed the title of point leader. But there exists only one point leader at any point of time in a match.

Example

  • At 3rd minute of the game
    player1 = 2 points
    player2 = 1 point
    No points leader
  • At 5th minute of the game
    player1 = 3 points ( points leader)
    player2 = 2 points
  • at 8th minute of the game
    player1 = 3 points
    player2 = 5 points (points leader)

Above are assuming that the other players have lower points than player 1 and player 2.

Assumptions

  • There exists only One points leader at any point of time in the match.
  • the title is created only once and the same title transferred to other players.
  • Even if two players attain the highest points or 3 points at the same time the title is assigned to only one of them based on the difference in the fraction of time. The faster one gets the title.

Task

  • implement code so that point leader title is only created once when no player in the current match has the title.
  • the title transfers to a new player when he earns it. The title is not created again.
  • make your code safe so that title creation is done only once.

Notes

Don't bother with the implementation of the point system rather focus on the creation and transfer of title.

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.