subject

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

Required:
a. Write a function to simulate a single shot. It should use the following declaration: void shoot (bool&targetAlive, doubleaccuracy); This would simulate someone shooring attargetAlive with the given accuracy by generating a random number between 0 and 1. If the random number is less than accuracy, then the target is hit and targetAlive should be set to false. For example, if Bob is shooting at Charlie, this could be invoked as: shoot(charlieAlive, 0.5);

b. An obvious strategy is for each man to shoot at the most accurate shooter still alive on the grounds that this shooter is the deadliest andhas the best chance of hitting back. Write a second function named startDuel that uses the shootfunction to simulate an entire duel using this strategy. It should loop until only one contestant is left, invoking hte shoot function with the proper target andprobability of hitting the target according to who isshooting. The function should return a variable that indicate who won the duel.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:50
Drag each label to the correct location on the image list the do’s and don’ts of safeguarding your password. a. keep yourself logged in when you leave your computer.b. don’t write your password down and leave it where others can find it.c. share your password with your friends.d.each time you visit a website,retain the cookies on your computer.e. use a long password with mixed characters.1. do's 2. don'ts
Answers: 2
question
Computers and Technology, 24.06.2019 08:20
Evaluate the scenario below and indicate how to handle the matter appropriately. situation: michael received an e-mail from what he thought was his doctor’s office, requesting his social security number. since he had just been in to see his doctor last week, he replied to the e-mail with his social security number.
Answers: 2
question
Computers and Technology, 24.06.2019 16:00
Which of the following characters is acceptable to use in a filename? ? / – %
Answers: 1
question
Computers and Technology, 24.06.2019 17:40
Anewly established internet company with 40 employees needs your advice. they are looking for a collaboration tool and have narrowed their choices to gotomeeting, webex, and my web conferences. after reading the information presented in this chapter and other sources, prepare a two- page document ( double spaced) that includes two advantages and two disadvantages of each tool. which one is your final recommendation? why did you choose that tool over the other two?
Answers: 3
You know the right answer?
In the land of Puzzlevania, Aaron, Bob and Charlie had anargument over which one of them was the gre...
Questions
question
Mathematics, 30.01.2022 21:20
question
Mathematics, 30.01.2022 21:20
question
Mathematics, 30.01.2022 21:20
question
English, 30.01.2022 21:20
Questions on the website: 13722360