Play with different strategies:
import random
# Modify strategy here
def turn():
toss = random.randint(0, 1)
guess = random.randint(0, 1)
# Uncomment to make A/B win
# guess = toss
return toss, guess
random.seed()
score_ab, score_c = 0, 0
for i in range(1, 1001):
score_ab -= 1
score_c += 1
toss_a, guess_a = turn()
toss_b, guess_b = turn()
if toss_a == guess_b and toss_b == guess_a:
score_ab += 3
score_c -= 3
print i, 'ab:', score_ab, 'c:', score_c
if score_ab > score_c:
print "Players A, B win"
else:
print "Player C wins"
The first is described by: 'If I get heads, I will guess you got heads, otherwise I will guess you got tails' The second: 'If I get heads, I will guess you got tails, otherwise I will guess you got heads'
These are functionally identical, in that in half of the cases they get the same result (first strategy wins these) and in the other half they get opposite results (second strategy wins these) - they get 2$ for winning and give 1$ when they lose, since they win half the time under either strategy C should not play this game.