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
The Monty Hall game is a statistical problem: there is a TV show (like the Monty Hall show) that allows contestants to choose between three doors, A, B, and C. Behind one of these doors is a new car (the winning door), and behind the other two are goats (the losing doors). After the contestant makes a choice, the game show host shows a goat behind one of the doors NOT chosen. The contestant is then given a choice to either switch to the other, non-opened door, or stick with their original guess. The interesting part of this “game" is the statistics involved-a person has a 1/3 chance of originally picking a winning door. The other door chosen – actually has a 2/3 chance of being a winning door. Therefore, it is in the contestant's best interest to switch doors. that which is not revealed to have a goat but also was not originally You will create a program that simulates the Monty Hall game, where the computer plays the role of the host. The program must have no outputs, but 1) Ask the…
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…
A coin is flipped 8 times in a row (assume all outcomes are equally likely). For each of the following questions, you should write your answer as an expression. Do not give the final numeric value. For example, you should write C(4,2)/24 instead of 0.375. Q1.1 What is the probability that it lands on heads exactly four times?

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Which of the following expressions return true? After writing your answers on paper, open the Code Pad in Bl...

Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)

Give an example of a data constraint.

Database Concepts (8th Edition)

What will the following program display? public class Checkpoint { public static void main (String [] args) { i...

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

Describe a method that can be used to gather a piece of data such as the users age.

Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)

Use a comment to state that a program performs a sample payroll calculation.

Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)

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
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
6 Stages of UI Design; Author: DesignerUp;https://www.youtube.com/watch?v=_6Tl2_eM0DE;License: Standard Youtube License