Lab 3-2-The Duel

Due: Thu, Feb 16, 11:59pm

 

payrol

Programming Project 15 in Chp 5 of the Textbook: Duel Simulation

In the land of Puzzlevania, Aaron, Bob, and Charlie had an argument over which one of them was the greatest puzzler of all time. To end the argument once and for all, they agreed on a duel to the death. Aaron is a poor shooter and only hits his target with a probability of 1/3. Bob is a bit better and hits his target with a probability of 1/2. Charlie is an expert marksman and never misses. A hit means a kill and the person hit drops out of the duel.
To compensate for the inequities in their marksmanship skills, it is decided that the contestants would fire in turns starting with Aaron, followed by Bob, then by Charlie, then back to Aaron. The cycle would repeat until there was only one man standing. And that man would be remembered as the greatest puzzler of all time.

Please do parts a)- d) in the project statement in the textbook. You can either write two similar programs that use the different strategies, or you can write a single program with two versions of duel, e.g. duel1 (the first strategy) and duel2 (the second strategy), and have it first run the test with duel1, then with duel2.

After each set of 1000 duels, print the probability that each contestant will win for that strategy. Example Run:

Strategy one: always shoot at the best shot.
Out of a 1000 duels:
  Aaron wins 374 times, probability of winning 0.374
  Bob wins 419 times, probability of winning 0.419
  Charlie wins 207 times, probability of winning 0.207
Strategy two: always shoot at the best shot. Aaron misses first shot
Out of a 1000 duels:
  Aaron wins 356 times, probability of winning 0.356
  Bob wins 422 times, probability of winning 0.422
  Charlie wins 222 times, probability of winning 0.222

(The above answers are examples, not the correct numbers).

Turn in

 

Grading Table

Requirement

Score

Correct output on sample runs   70  
Good clean, easy to understand input and output operations   10  
Code is appropriartely broken up into functions.   10  
Complete source code with good formatting and organization, variables names, and comments   10  
Total   100