Skip to content

Instantly share code, notes, and snippets.

@alea12
Last active December 18, 2015 21:09
Show Gist options
  • Save alea12/5845519 to your computer and use it in GitHub Desktop.
Save alea12/5845519 to your computer and use it in GitHub Desktop.
囚人のジレンマ
# input:
# strategy_i - strategy of player 1, 2.
# output:
# payoff_i - payoff rewarded to player 1, 2.
def prisoner (strategy_1, strategy_2)
if strategy_1 == "m"
if strategy_2 == "m"
payoff_1 = -1
payoff_2 = -1
elsif strategy_2 == "f"
payoff_1 = -9
payoff_2 = -0
end
elsif strategy_1 == "f"
if strategy_2 == "m"
payoff_1 = 0
payoff_2 = -9
elsif strategy_2 == "f"
payoff_1 = -6
payoff_2 = -6
end
end
return payoff_1, payoff_2
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment