- #1
- 2,168
- 193
Problem:
A and B decide to duel but, being poor, they have just one gun (a six-shot revolver) and only one bullet. Being dumb, as well, this does not deter them and they agree to "duel" as follows: They will insert the lone bullet into the gun's cylinder, A will then spin the cylinder and shoot at B (who, standing inches away, is impossible to miss). If the gun doesn't fire then A will give the gun to B, who will spin the cylinder and then shoot at A. This back-and-forth duel will continue until one fool shoots the other. What is the probability that A will win?
I am getting 0.50 however the correct answer is 0.54 so I guess I am missing something abour related to the first shoot ? Anyone can help. Thanks
A and B decide to duel but, being poor, they have just one gun (a six-shot revolver) and only one bullet. Being dumb, as well, this does not deter them and they agree to "duel" as follows: They will insert the lone bullet into the gun's cylinder, A will then spin the cylinder and shoot at B (who, standing inches away, is impossible to miss). If the gun doesn't fire then A will give the gun to B, who will spin the cylinder and then shoot at A. This back-and-forth duel will continue until one fool shoots the other. What is the probability that A will win?
Python:
import random
a_wins = 0
for i in range(10**6):
Chances = ["d","nd","nd","nd","nd","nd"] #nd = not dead, d = dead
while len(Chances)> 0:
b = random.choice (Chances) #A shoots B
if b == "d":
a_wins += 1
break
else:
Chances.remove("nd")
a = random.choice(Chances) #B shoots A
if a == "d":
break #A cannot win
else:
Chances.remove("nd") #wasting antoher chance
print(a_wins/10**6)
I am getting 0.50 however the correct answer is 0.54 so I guess I am missing something abour related to the first shoot ? Anyone can help. Thanks