Forget the math: If P kills E, A gets first shot at P (2/3 success chance) PLUS another chance if P misses A on the return: P's chances of survival are thus less than 1/3.
If P misses E: If A kills E (2/3 chance), P then has the first shot at A (better chance of survival than the other way around...at least 1/3). If A misses E, E will kill A, and it is P's turn (at exactly 1/3 chance, since E will then kill P with certainty if P misses E).
So P needs to miss E on purpose.
Originally posted by jasperdash😲, after all of the nice math done by PBE6, you choose to award the answer to banana king and his poor spelling? No offense intended to either you or Banana.
YES!! you are right banana king!
and if you mean the book Jasper Dash and the Flame Pits of Delaware, i have read that. if you mean read in general, then yes.
Also, at forkedknight, how did you run this simulation? I am interested 😲
Originally posted by camilliWhat if Poor, being such a poor shot, misses at missing, and is then screwed over by Average 😀!
Forget the math: If P kills E, A gets first shot at P (2/3 success chance) PLUS another chance if P misses A on the return: P's chances of survival are thus less than 1/3.
If P misses E: If A kills E (2/3 chance), P then has the first shot at A (better chance of survival than the other way around...at least 1/3). If A misses E, E will kill A, and it i ...[text shortened]... e, since E will then kill P with certainty if P misses E).
So P needs to miss E on purpose.
Originally posted by range blastsIt's a python script I whipped up. If there was a way to post it without losing all formatting, I would.
😲, after all of the nice math done by PBE6, you choose to award the answer to banana king and his poor spelling? No offense intended to either you or Banana.
Also, at forkedknight, how did you run this simulation? I am interested 😲
Originally posted by forkedknightAfter many experiments, I found a fairly good way to indent code in postings was to insert the word quote in square brackets where the indentation level needed to be increased, and insert the word /quote in square brackets where the indentation level needed to be decreased.
It's a python script I whipped up. If there was a way to post it without losing all formatting, I would.
The method has a side effect that, as well as changing the indentation, the rhp formatter automatically inserts a new line after each quote or /quote. Therefore, for perfect results, you should delete one new line from the input after each of these. The method is not perfect because sometimes there is not a corresponding new line to delete in the input text, however this does not greatly mess up the result.
see my posting:
http://www.redhotpawn.com/board/showthread.php?threadid=119240&page=3#post_2256356
for an example of the result (when the method is applied to a perl program).
the key to this puzzle is to analyse what e will do. if he gets to shoot he will shoot A as this gives him a 2/3 chance of winning vs. 1/3 if he shoots P. therefore A will be gone after e shoots his first shot.
if A and E are still alive after P shoots[ie P missed whoever he shot at], A has to shoot E because he knows if he does not kill E he will be dead because E will shoot him if P does not shoot E first. therefore P knows that he will get to shoot again as long as A survives because he knows E will shoot and eliminate A on the first shot. therefore P has to shoot E.
the key to this puzzle is to analyse what e will do. if he gets to shoot he will shoot A as this gives him a 2/3 chance of winning vs. 1/3 if he shoots P. therefore A will be gone after e shoots his first shot.
if A and E are still alive after P shoots[ie P missed whoever he shot at], A has to shoot E because he knows if he does not kill E he will be dead because E will shoot him if P does not shoot E first. therefore P knows that he will get to shoot again as long as A survives because he knows E will shoot and eliminate A on the first shot. therefore P has to shoot E.
#! /usr/bin/python
import random
import sys
import math
random.seed()
accuracy = {'P': 0.33333, 'A': 0.66667, 'E': 1}
strategy = {'P': ['E','A'], 'A': ['E','P'], 'E': ['A','P']}
trials = 100000
winners = []
#players = ['A','E','P'] #uncomment for player P to miss first
players = ['P','A','E'] #player P shoots first
for i in range(trials):
remainingplayers = set(players)
while len(remainingplayers) > 1:[quote]
for player in players:[quote]
# print player
if player in remainingplayers:[quote]
randnum = random.random()
hit = randnum < accuracy[player]
# print "hit", hit
s = strategy[player]
if hit:[quote]
if s[0] in remainingplayers:[quote]
remainingplayers.remove(s[0])
else:
[/quote][/quote][/quote][/quote]
remainingplayers.discard(s[1])
winner = remainingplayers.pop()
# print "winner", winner
winners.append(winner)[/quote]
print 'P: ', float(winners.count('P'😉) / trials
print 'A: ', float(winners.count('A'😉) / trials
print 'E: ', float(winners.count('E'😉) / trials