Absolute C++
Absolute C++
6th Edition
ISBN: 9780133970784
Author: Walter Savitch, Kenrick Mock
Publisher: Addison-Wesley
bartleby

Videos

Textbook Question
Book Icon
Chapter 4, Problem 12PP

In the land of Puzzlevania, Aaron, Bob, and Charlie had an argument over which one of them was the greatest puzzle-solver of all time. To end the argument once and for all, they agreed on a duel to the death. Aaron was a poor shot and only hit his target with a probability of 1/3. Bob was a bit better and hit his target with a probability of 1/2. Charlie 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 Aaron, followed by Bob, and then by Charlie. The cycle would repeat until there was one man standing. That man would be remembered for all time as the Greatest Puzzle-Solver of All Time. An obvious and reasonable strategy is for each man 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 his target. You will likely want to create multiple subroutines and functions to complete the problem. Once you can simulate a duel, add a loop to your program that simulates 10,000 duels. Count the number of times that each contestant wins and print the probability of winning for each contestant (e.g., for Aaron your program might output "Aaron won 3595/10,000 duels or 35.95%").

An alternate strategy is for Aaron to intentionally miss on his first shot. Modify the program to accommodate this new strategy and output the probability of winning for each contestant. What strategy is better for Aaron, to intentionally miss on the first shot or to try and hit the best shooter?

Blurred answer
Students have asked these similar questions
In a classroom election, two presidential candidates, namely, Lisa and Teddy, both garnered the same number of total votes. As such, they decided to play a custom dice game to determine the winner of the election. In this game, a player needs to roll a pair of dice. Teddy will win the game if the sum is odd whereas Lisa will be declared winner if the sum results to even. However, prior to the start of the game, Teddy complained that the custom dice game is biased because according to him, the probability of an even result is 6/11, and for odd - only 5/11. Verify Teddy's claim and evaluate the fairness of the game.  CLEAR SOLUTION
Jack and Jill will play a game called Hotter, Colder. Jill chooses a number from 0 to 100, and Jack makes repeated attempts to guess it. For each guess, Jill will respond with: hotter - if the current guess is closer to her number than the previous guess is colder - if the current guess is farther to her number than the previous guess is same - if the current guess is as far (to her number) as the previous guess is For Jack’s first guess, since there is no previous guess yet, Jill will just answer same. Describe an algorithm or a systematic approach that Jack can follow to win the games faster (fewer guesses).   Example: Jill chooses number 40.      Note: Jack can guess any number from 0 to 100 at any point of the game. Jack guesses 100.        Jill responds same      (first guess) Jack guesses 60.          Jill responds hotter    (60 is closer to 40 than previous guess 100) Jack guesses 80.          Jill responds colder    (80 is farther from 40 than previous guess 60) Jack guesses…
Tom and Jerry recently saw the movie inception. Inspired by that movie they decided to play a complicated game. Analogous to the movie inception, Jerry is the dreamer and Tom is the thief who enters Jerry's dream in order to extract the secret code. Tom wins the game if he is able to extract the secret code, else Jerry wins the game. Note that here Tom has to extract the idea from Jerry. Tom after performing a lot of mathematical analysis finally ended up to one last step for which he requires a little computation. He has got an array of positive integers. If atleast one of them is prime, he will be able to crack the secret code and win the game, else Jerry wins the game. Input The first line contains a single integer t (1≤t≤106) the number of test cases. Description of each test case is as follows. The first line of each test case contains a single integer n (1≤n≤2⋅106) the number of elements in the array. The second line of each test case contains n positive integers…

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
F414. Determine the magnitude of the moment of the force F = {300i 200j + 150k} N about the OA axis.

INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)

Assume that both of the inputs in the following circuit are 1. Describe what would happen if the upper input we...

Computer Science: An Overview (13th Edition) (What's New in Computer Science)

Write an if-else statement that assigns 1 to x when y is equal to 100. Otherwise, it should assign 0 to x.

Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
6 Stages of UI Design; Author: DesignerUp;https://www.youtube.com/watch?v=_6Tl2_eM0DE;License: Standard Youtube License