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
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?
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Absolute C++
Additional Engineering Textbook Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Database Concepts (8th Edition)
Starting Out with C++: Early Objects (9th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
- Correct answer will be upvoted else Multiple Downvoted. Computer science. The I-th stage is named with an integer artificial intelligence (0≤ai≤n−i). At the point when the character is remaining on the I-th stage, the player can move the character to any of the j-th stages where i+1≤j≤i+ai. If the character is on the I-th stage where ai=0 and i≠n, the player loses the game. Since Gildong thinks the current game isn't adequately hard, he needs to make it considerably harder. He needs to change a few (perhaps zero) names to 0 so that there remains precisely one way of winning. He needs to alter the game as little as could really be expected, so he's requesting you to see as the base number from stages that ought to have their names changed. Two different ways are unique if and provided that there exists a stage the character gets to in one manner however not in the alternate manner. Input Each test contains at least one experiments. The main line contains the number of…arrow_forwardA random walk is a random path most often represented as a random number that changes over time. In particular, one common random walk is that in which the starting state is 0 and in each iteration we either add 1 or subtract 1 from the current value with equal probability. That is, in the first step, the next value would be 1 with probability 0.5 and -1 with probability 0.5. Use R to generate a random walk with 100 values starting at value 0 and store the values in a vector called random_walk. This vector should have length 100.arrow_forwardFive schoolgirls sat for an examination. Their parents – so they thought – showed an undue degree of interest in the result. They therefore agreed that, in writing home about the examination, each girl should make one true statement and one untrue one. The following are the relevant passages from their letters: Betty Kitty was 2nd I was 3rd Ethel I was on top Joan was 2nd Joan I was 3rd Ethel was last Kitty I came out 2nd Mary was only 4th Mary I was 4th Betty was 1stWrite a prolog program to solve this puzzle. A completely working solution is required for extra points, i.e. all or nothing proposition.arrow_forward
- Algorithmarrow_forwardMastermind is a code-breaking game for two players. In the original real-world game, one player A selects 4 pegs out of 6 colors and puts them in a certain fixed order; multiples of colors are possible (for example, red-green red-green). His opponent B does not know the colors or order but has to find out the secret code. To do so, B makes a series of guesses, each evaluated by the first player. A guess consists of an ordered set of colors which B believes is the code. The first player A evaluates the guess and feeds back to B how many positions and colors are correct. A position is correct ("black") if the guess and the secret code have the same color. Additional colors are correct ("white"), if they are in the guess and the code, but not at the same location. For example1 2 3 4secret: red-green red greenguess: red blue green purpleresults in one correct position ("black = 1") for the red peg at position one and one additional correct color ("white=1") for the green peg in the guess.…arrow_forwardMastermind is a code-breaking game for two players. In the original real-world game, one player A selects 4 pegs out of 6 colors and puts them in a certain fixed order; multiples of colors are possible (for example, red-green red-green). His opponent B does not know the colors or order but has to find out the secret code. To do so, B makes a series of guesses, each evaluated by the first player. A guess consists of an ordered set of colors which B believes is the code. The first player A evaluates the guess and feeds back to B how many positions and colors are correct. A position is correct ("black") if the guess and the secret code have the same color. Additional colors are correct ("white"), if they are in the guess and the code, but not at the same location. For example1 2 3 4secret: red-green red greenguess: red blue green purpleresults in one correct position ("black = 1") for the red peg at position one and one additional correct color ("white=1") for the green peg in the guess.…arrow_forward
- The Monte Carlo method is used in modeling a wide-range of physical systems at the forefront of scientific research today. Monte Carlo simulations are statistical models based on a series of random numbers. Let's consider the problem of estimating Pi by utilizing the Monte Carlo method. Suppose you have a circle inscribed in a square (as in the figure). The experiment simply consists of throwing darts on this figure completely at random (meaning that every point on the dartboard has an equal chance of being hit by the dart). How can we use this experiment to estimate Pi? The answer lies in discovering the relationship between the geometry of the figure and the statistical outcome of throwing the darts. Let's first look at the geometry of the figure. Let's assume the radius of the circle is R, then the Area of the circle = Pi * R^2 and the Area of the square = 4 * R^2. Now if we divide the area of the circle by the area of the square we get Pi / 4. But, how do we estimate Pi by…arrow_forwardMr Monkey is standing in front of a row of banana trees on Skull Island which actually belong to his rival King Kong. The banana trees are unusually high on that island. He wants to steal as many bananas as possible. Here is his plan. He will climb up one of the trees and then keep jumping from one tree to the immediately next one, while collecting all the bananas from each of them. But he will not switch the direction of his jumps. No longer being the agile young monkey he once used to be, he can only jump a total distance of L, after which he will climb down and run away before Kong crushes his head. Let the trees be labelled as t1, t2, ·.· tn. Let v;, Vi = 1, 2, · ..n be the number of bananas in tree t;. Further, let l;, i = 1,2, Can you write an algorithm to help Mr. Monkey steal as many bananas as possible ? Your algorithm should be a polynomial in n, L. Please show all the steps of DP as in the sample solution - subproblem definition, recurrences, pseudocode, runtime . (Statutory…arrow_forwardThe puzzle called the Towers of Hanoi consists of three pegs, one of which contains several rings stacked in order of descending diameter from bottom to top. The problem is to move the stack of rings to another peg. You are allowed to move only one ring at a time, and at no time is a ring to be placed on top of a smaller one. Observe that if the puzzle involved only one ring, it would be extremely easy. Moreover, when faced with the problem of moving several rings, if you could move all but the largest ring to another peg, the largest ring could then be placed on the third peg, and then the problem would be to move the remaining rings on top of it. Using this observation, develop a recursive algorithm for solving the Towers of Hanoi puzzle for an arbitrary number of rings.arrow_forward
- A hungry mouse wants to eat all four fruits in a maze such as the one below, in as few moves as possible.. At each turn the mouse can move any number of squares in one of the directions up, down, left or right, but it is not allowed to enter (or jump over) any walls (i.e., the black squares). Thus, the mouse moves just like a rook in chess. To eat a fruit, the mouse has to stop at that square. Assume that the maze has 4 fruits, and the size of b xh squares. 1. Give a suitable representatión of the states in this searching problem. 2. How many possible actions can the mouse perform at each move? (1.e., what is the branching factor?)arrow_forwardA chess knight, on one turn, moves either two squares vertically and one horizontally, or two horizontally and one vertically. If we consider a knight starting at the point ⟨x, y⟩ in Z × Z, it has eight possible moves, to ⟨x+1,y+2⟩,⟨x+1,y−2⟩,⟨x−1,y+2⟩,⟨x−1,y−2⟩,⟨x+ 2, y + 1⟩, ⟨x + 2, y − 1⟩, ⟨x − 2, y + 1⟩, or⟨x − 2, y − 1⟩. (a) Prove that given any two points ⟨x, y⟩ and ⟨x′, y′⟩ in Z × Z, there is a sequence of knight moves from the first point to the second. (b) Let a and b be different positive naturals. An (a, b)-knight also has eight possible moves, from ⟨x,y⟩ to ⟨x±a,y±b⟩ or ⟨x±b,y±a⟩. What conditions on a and b allow the (a, b)-knight to go from any point in Z × Z to any other? Prove your answer. (c) If a and b do not meet the conditions of part (b), exactly which points can the (a,b)- knight reach from ⟨x, y⟩arrow_forwardThere is a legend about a magical park with N × N trees. The trees are positioned in a square grid with Nrows (numbered from 1 to N from north to south) and N columns (numbered from 1 to N from west to east).The height (in metres) of each tree is an integer between 1 and N × N, inclusive. Magically, the height ofall trees is unique.Bunga is standing on the northmost point of the park and wants to count the number of visible trees for eachcolumn. Similarly, Lestari is standing on the westmost point of the park and wants to count the number ofvisible trees for each row. A tree X is visible if all other trees in front of the tree X are shorter than the treeX.For example, let N = 3 and the height (in metres) of the trees are as follows.6 1 87 5 32 9 4• On the first column, Bunga can see two trees, as the tree on the third row is obstructed by the othertrees.• On the second column, Bunga can see all three trees.• On the third column, Bunga can see only the tree on the first row, as the…arrow_forward
- Operations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks ColeProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage