Description:
Once upon a time in the land of Asgard there lived 3 wizards Gandalf, Merlin and Dumbledore. These 3 wizards often had an argument over which one of them was the greatest software developer of all time. To end the argument once and for all, they agreed on a fight to the death. Gandalf was a poor shooter and only hit his target with a probability of 1/3. Merlin was a bit better and hit his target with a probability of 1/2. Dumbledore was an expert marksman and never missed. A hit means a kill and the person hit drops out of the duel. To compensate for the inequities in their marksmanship skills, the three decided that they would fire in turns, starting with Gandalf, followed by Merlin, and then by Dumbledore. The cycle would repeat until there was one man or creature standing, and that man or creature would be the greatest software developer of All Time.
An obvious and reasonable strategy is for each wizard to shoot at the most accurate shooter still alive, on the grounds that this shooter is the deadliest and has the best chance of hitting back.
Write a program to simulate the duel using this strategy. Your program should use random numbers and the probabilities given in the problem to determine whether a shooter hits the target.
Output:
LEADERBOARD – AFTER 10000 DUELS
Contestant Number of Wins Winning Percentag
Gandalf 3595 35.95%
Merlin 1355 13.55%
Dumbledore 5050 50.50%
Installation:
- Download the project in open in any IDE like Netbeans, Eclipse, etc.
- Run the project and see the results