Question: #include #include using namespace std; //constants const float PLAYERA_ACCURACY = 100 / 3; const float PLAYERB_ACCURACY = 50; const float PLAYERC_ACCURACY = 100; const int

 #include #include using namespace std; //constants const float PLAYERA_ACCURACY = 100

#include  #include  using namespace std; //constants const float PLAYERA_ACCURACY = 100 / 3; const float PLAYERB_ACCURACY = 50; const float PLAYERC_ACCURACY = 100; const int NUMDUELS = 1000; //function for a player to shoot at a target player void shoot(bool &targetAlive, double accuracy) { //if the intended target is alive if (targetAlive) { //generate a random number for hitting a target float hit = float(rand()) / float((RAND_MAX)) * 100.0; //if the random hit is less than accuracy then the target is hit if (hit   b. An obvious strategy is for each player 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 second function named startDuel that uses the shoot function to simulate an entire duel using this strategy (or code for the second strategy below). It should loop until only one contestant is left, invoking the shoot function with the proper target and probability of hitting the target according to who is shooting. The function should return a variable that indicates who won the duel. The prototype for startDuel is simple: int startDuel(); C. In your main function, invoke the startDuel function 1,000 times in a loop, keeping track of how many times each contestant wins. A counterintuitive strategy is for Player A to intentionally miss on his first shot. Thereafter, everyone uses the strategy of shooting at the most accurate shooter left in the game. This strategy means that Player A is guaranteed to live past the first round, since Player B and Player C will fire at each other. Code the program to accommodate either one or the other, exclusive) strategy and output the probability of winning for each contestant. The code to output the probability for strategy two, for example, from inside of main could possibly look like this (excluding variable naming): std::cout 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!