diff --git "a/ITERATIVE PRISONER\342\200\231S DILEMMA.pdf" "b/ITERATIVE PRISONER\342\200\231S DILEMMA.pdf" new file mode 100644 index 0000000..f33079d Binary files /dev/null and "b/ITERATIVE PRISONER\342\200\231S DILEMMA.pdf" differ diff --git a/__pycache__/bad_guy.cpython-37.pyc b/__pycache__/bad_guy.cpython-37.pyc new file mode 100644 index 0000000..aa0bc2d Binary files /dev/null and b/__pycache__/bad_guy.cpython-37.pyc differ diff --git a/__pycache__/grudger.cpython-37.pyc b/__pycache__/grudger.cpython-37.pyc new file mode 100644 index 0000000..c696d7a Binary files /dev/null and b/__pycache__/grudger.cpython-37.pyc differ diff --git a/__pycache__/mainly_bad.cpython-37.pyc b/__pycache__/mainly_bad.cpython-37.pyc new file mode 100644 index 0000000..fbb39f2 Binary files /dev/null and b/__pycache__/mainly_bad.cpython-37.pyc differ diff --git a/__pycache__/mainly_nice.cpython-37.pyc b/__pycache__/mainly_nice.cpython-37.pyc new file mode 100644 index 0000000..495e7c1 Binary files /dev/null and b/__pycache__/mainly_nice.cpython-37.pyc differ diff --git a/__pycache__/nice_guy.cpython-37.pyc b/__pycache__/nice_guy.cpython-37.pyc new file mode 100644 index 0000000..d6c3b77 Binary files /dev/null and b/__pycache__/nice_guy.cpython-37.pyc differ diff --git a/__pycache__/prisoners_dilemma.cpython-37.pyc b/__pycache__/prisoners_dilemma.cpython-37.pyc new file mode 100644 index 0000000..98d2820 Binary files /dev/null and b/__pycache__/prisoners_dilemma.cpython-37.pyc differ diff --git a/__pycache__/tit_for_2_tats.cpython-37.pyc b/__pycache__/tit_for_2_tats.cpython-37.pyc new file mode 100644 index 0000000..708fac5 Binary files /dev/null and b/__pycache__/tit_for_2_tats.cpython-37.pyc differ diff --git a/__pycache__/tit_for_tat.cpython-37.pyc b/__pycache__/tit_for_tat.cpython-37.pyc new file mode 100644 index 0000000..a502552 Binary files /dev/null and b/__pycache__/tit_for_tat.cpython-37.pyc differ diff --git a/bad_guy.py b/bad_guy.py new file mode 100644 index 0000000..ed8d7de --- /dev/null +++ b/bad_guy.py @@ -0,0 +1,14 @@ +#### +# Each team's file must define four tokens: +# team_name: a string +# strategy_name: a string +# strategy_description: a string +# move: A function that returns 'c' or 'b' +#### + +team_name = 'A2' +strategy_name = 'Bad guy' +strategy_description = 'Always betray.' + +def move(my_history, their_history, my_score, their_score): + return 'b' diff --git a/bad_guy.pyc b/bad_guy.pyc new file mode 100644 index 0000000..c699406 Binary files /dev/null and b/bad_guy.pyc differ diff --git a/grudger.py b/grudger.py new file mode 100644 index 0000000..736edc7 --- /dev/null +++ b/grudger.py @@ -0,0 +1,12 @@ +team_name = 'A2' +strategy_name = 'Grudger' +strategy_description = 'Starts with cooperation and once if the opponent betrays then always grudger betrays irrespective of the opponent move.' + +def move(my_history, their_history, my_score, their_score): + if(len(my_history) == 0 and len(their_history) == 0): + return 'c' + if(my_history[-1] == 'c' and their_history[-1] == 'c'): + return 'c' + if(my_history[-1] == 'b' or their_history[-1] == 'b'): + return 'b' + diff --git a/grudger.pyc b/grudger.pyc new file mode 100644 index 0000000..100577e Binary files /dev/null and b/grudger.pyc differ diff --git a/mainly_bad.py b/mainly_bad.py new file mode 100644 index 0000000..b1d9091 --- /dev/null +++ b/mainly_bad.py @@ -0,0 +1,21 @@ +#### +# Each team's file must define four tokens: +# team_name: a string +# strategy_name: a string +# strategy_description: a string +# move: A function that returns 'c' or 'b' +#### + +team_name = 'A5' +strategy_name = 'Mainly bad' +strategy_description = 'Mainly bad.' + +def move(my_history, their_history, my_score, their_score): + + if len(my_history) < 5: + return 'b' + else: + if len(my_history) % 2 == 0: + return 'c' + else: + return 'b' diff --git a/mainly_bad.pyc b/mainly_bad.pyc new file mode 100644 index 0000000..a5a19fc Binary files /dev/null and b/mainly_bad.pyc differ diff --git a/mainly_nice.py b/mainly_nice.py new file mode 100644 index 0000000..0805a40 --- /dev/null +++ b/mainly_nice.py @@ -0,0 +1,21 @@ +#### +# Each team's file must define four tokens: +# team_name: a string +# strategy_name: a string +# strategy_description: a string +# move: A function that returns 'c' or 'b' +#### + +team_name = 'A4' +strategy_name = 'Mainly nice' +strategy_description = 'Mainly nice.' + +def move(my_history, their_history, my_score, their_score): + + if len(my_history) < 5: + return 'c' + else: + if len(my_history) % 2 == 0: + return 'c' + else: + return 'b' diff --git a/mainly_nice.pyc b/mainly_nice.pyc new file mode 100644 index 0000000..e41a7e3 Binary files /dev/null and b/mainly_nice.pyc differ diff --git a/nice_guy.py b/nice_guy.py new file mode 100644 index 0000000..5d0f607 --- /dev/null +++ b/nice_guy.py @@ -0,0 +1,14 @@ +#### +# Each team's file must define four tokens: +# team_name: a string +# strategy_name: a string +# strategy_description: a string +# move: A function that returns 'c' or 'b' +#### + +team_name = 'A1' +strategy_name = 'Nice guy' +strategy_description = 'Always co-operate.' + +def move(my_history, their_history, my_score, their_score): + return 'c' diff --git a/nice_guy.pyc b/nice_guy.pyc new file mode 100644 index 0000000..48472b7 Binary files /dev/null and b/nice_guy.pyc differ diff --git a/outputs/all_startegy.png b/outputs/all_startegy.png new file mode 100644 index 0000000..6be67f7 Binary files /dev/null and b/outputs/all_startegy.png differ diff --git a/outputs/all_strategies.png b/outputs/all_strategies.png new file mode 100644 index 0000000..b9871d7 Binary files /dev/null and b/outputs/all_strategies.png differ diff --git a/outputs/bad_guy_and_tit_for_two_tats.png b/outputs/bad_guy_and_tit_for_two_tats.png new file mode 100644 index 0000000..f37d792 Binary files /dev/null and b/outputs/bad_guy_and_tit_for_two_tats.png differ diff --git a/outputs/first.png b/outputs/first.png new file mode 100644 index 0000000..b1de1d4 Binary files /dev/null and b/outputs/first.png differ diff --git a/outputs/mainly_bad_grudger.png b/outputs/mainly_bad_grudger.png new file mode 100644 index 0000000..6808e57 Binary files /dev/null and b/outputs/mainly_bad_grudger.png differ diff --git a/outputs/task_1.png b/outputs/task_1.png new file mode 100644 index 0000000..344e113 Binary files /dev/null and b/outputs/task_1.png differ diff --git a/outputs/task_1_tournament.png b/outputs/task_1_tournament.png new file mode 100644 index 0000000..bb6d10c Binary files /dev/null and b/outputs/task_1_tournament.png differ diff --git a/outputs/task_3.png b/outputs/task_3.png new file mode 100644 index 0000000..4906f75 Binary files /dev/null and b/outputs/task_3.png differ diff --git a/outputs/task_3_user.png b/outputs/task_3_user.png new file mode 100644 index 0000000..8d938aa Binary files /dev/null and b/outputs/task_3_user.png differ diff --git a/outputs/tit_for_tat_grudger.png b/outputs/tit_for_tat_grudger.png new file mode 100644 index 0000000..3708304 Binary files /dev/null and b/outputs/tit_for_tat_grudger.png differ diff --git a/outputs/tournament_1.txt b/outputs/tournament_1.txt new file mode 100644 index 0000000..e3a27b9 --- /dev/null +++ b/outputs/tournament_1.txt @@ -0,0 +1,624 @@ +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Nice guy + Always co-operate. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Nice guy +(P1): 125 points with Nice guy +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Bad guy + Always betray. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 400 +vs. P1 : 0 0 +TOTAL : 0 400 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P1): 200 points with Bad guy +(P0): 0 points with Nice guy +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Mainly nice + Mainly nice. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 323 +vs. P1 : 128 0 +TOTAL : 128 323 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P1): 161 points with Mainly nice +(P0): 64 points with Nice guy +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Mainly bad + Mainly bad. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 327 +vs. P1 : 120 0 +TOTAL : 120 327 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P1): 163 points with Mainly bad +(P0): 60 points with Nice guy +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Tit for Tat + Tit for tat. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Nice guy +(P1): 125 points with Tit for Tat +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Nice guy +(P1): 125 points with Grudger +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Nice guy +(P1): 125 points with Tit for 2 Tats +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Bad guy + Always betray. +Player 1 (P1): Bad guy + Always betray. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 100 +vs. P1 : 100 0 +TOTAL : 100 100 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 50 points with Bad guy +(P1): 50 points with Bad guy +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Bad guy + Always betray. +Player 1 (P1): Mainly nice + Mainly nice. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 48 +vs. P1 : 253 0 +TOTAL : 253 48 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 126 points with Bad guy +(P1): 24 points with Mainly nice +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Bad guy + Always betray. +Player 1 (P1): Mainly bad + Mainly bad. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 51 +vs. P1 : 245 0 +TOTAL : 245 51 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 122 points with Bad guy +(P1): 25 points with Mainly bad +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Bad guy + Always betray. +Player 1 (P1): Tit for Tat + Tit for tat. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 99 +vs. P1 : 102 0 +TOTAL : 102 99 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 51 points with Bad guy +(P1): 49 points with Tit for Tat +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Bad guy + Always betray. +Player 1 (P1): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 99 +vs. P1 : 102 0 +TOTAL : 102 99 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 51 points with Bad guy +(P1): 49 points with Grudger +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Bad guy + Always betray. +Player 1 (P1): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 98 +vs. P1 : 103 0 +TOTAL : 103 98 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 51 points with Bad guy +(P1): 49 points with Tit for 2 Tats +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly nice + Mainly nice. +Player 1 (P1): Mainly nice + Mainly nice. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 176 +vs. P1 : 176 0 +TOTAL : 176 176 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 88 points with Mainly nice +(P1): 88 points with Mainly nice +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly nice + Mainly nice. +Player 1 (P1): Mainly bad + Mainly bad. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 184 +vs. P1 : 167 0 +TOTAL : 167 184 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P1): 92 points with Mainly bad +(P0): 83 points with Mainly nice +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly nice + Mainly nice. +Player 1 (P1): Tit for Tat + Tit for tat. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 201 +vs. P1 : 201 0 +TOTAL : 201 201 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 100 points with Mainly nice +(P1): 100 points with Tit for Tat +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly nice + Mainly nice. +Player 1 (P1): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 249 +vs. P1 : 60 0 +TOTAL : 60 249 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P1): 124 points with Grudger +(P0): 30 points with Mainly nice +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly nice + Mainly nice. +Player 1 (P1): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 129 +vs. P1 : 322 0 +TOTAL : 322 129 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 161 points with Mainly nice +(P1): 64 points with Tit for 2 Tats +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly bad + Mainly bad. +Player 1 (P1): Mainly bad + Mainly bad. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 170 +vs. P1 : 170 0 +TOTAL : 170 170 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 85 points with Mainly bad +(P1): 85 points with Mainly bad +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly bad + Mainly bad. +Player 1 (P1): Tit for Tat + Tit for tat. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 196 +vs. P1 : 196 0 +TOTAL : 196 196 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 98 points with Mainly bad +(P1): 98 points with Tit for Tat +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly bad + Mainly bad. +Player 1 (P1): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 244 +vs. P1 : 53 0 +TOTAL : 53 244 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P1): 122 points with Grudger +(P0): 26 points with Mainly bad +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly bad + Mainly bad. +Player 1 (P1): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 123 +vs. P1 : 317 0 +TOTAL : 317 123 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 158 points with Mainly bad +(P1): 61 points with Tit for 2 Tats +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Tit for Tat + Tit for tat. +Player 1 (P1): Tit for Tat + Tit for tat. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Tit for Tat +(P1): 125 points with Tit for Tat +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Tit for Tat + Tit for tat. +Player 1 (P1): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Tit for Tat +(P1): 125 points with Grudger +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Tit for Tat + Tit for tat. +Player 1 (P1): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Tit for Tat +(P1): 125 points with Tit for 2 Tats +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +Player 1 (P1): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Grudger +(P1): 125 points with Grudger +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +Player 1 (P1): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Grudger +(P1): 125 points with Tit for 2 Tats +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Tit for 2 Tats + Tit for 2 tats. +Player 1 (P1): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Tit for 2 Tats +(P1): 125 points with Tit for 2 Tats diff --git a/outputs/tournament_2.txt b/outputs/tournament_2.txt new file mode 100644 index 0000000..8c60801 --- /dev/null +++ b/outputs/tournament_2.txt @@ -0,0 +1,43 @@ +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Bad guy + Always betray. +Player 2 (P2): Mainly nice + Mainly nice. +Player 3 (P3): Mainly bad + Mainly bad. +Player 4 (P4): Tit for Tat + Tit for tat. +Player 5 (P5): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +Player 6 (P6): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 P2 P3 P4 P5 P6 +vs. P0 : 0 400 322 327 250 250 250 +vs. P1 : 0 0 48 52 99 99 98 +vs. P2 : 129 253 0 185 200 249 130 +vs. P3 : 121 242 166 0 196 245 124 +vs. P4 : 250 102 204 198 0 250 250 +vs. P5 : 250 101 61 53 250 0 250 +vs. P6 : 250 104 321 316 250 250 0 +TOTAL : 1000 1202 1122 1131 1245 1343 1102 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P5): 191 points with Grudger +(P4): 177 points with Tit for Tat +(P1): 171 points with Bad guy +(P3): 161 points with Mainly bad +(P2): 160 points with Mainly nice +(P6): 157 points with Tit for 2 Tats +(P0): 142 points with Nice guy diff --git a/outputs/tournament_3.txt b/outputs/tournament_3.txt new file mode 100644 index 0000000..2bb44fb --- /dev/null +++ b/outputs/tournament_3.txt @@ -0,0 +1,93 @@ +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +Player 1 (P1): Tit for Tat + Tit for tat. +Player 2 (P2): Mainly nice + Mainly nice. +Player 3 (P3): Mainly bad + Mainly bad. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 P2 P3 +vs. P0 : 0 250 62 52 +vs. P1 : 250 0 201 197 +vs. P2 : 249 201 0 184 +vs. P3 : 245 194 166 0 +TOTAL : 744 645 429 433 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 186 points with Grudger +(P1): 161 points with Tit for Tat +(P3): 108 points with Mainly bad +(P2): 107 points with Mainly nice +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +Player 1 (P1): Tit for Tat + Tit for tat. +Player 2 (P2): Mainly nice + Mainly nice. +Player 3 (P3): Mainly bad + Mainly bad. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 P2 P3 +vs. P0 : 0 250 59 54 +vs. P1 : 250 0 204 195 +vs. P2 : 248 200 0 183 +vs. P3 : 242 195 167 0 +TOTAL : 740 645 430 432 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 185 points with Grudger +(P1): 161 points with Tit for Tat +(P3): 108 points with Mainly bad +(P2): 107 points with Mainly nice +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +Player 1 (P1): Tit for Tat + Tit for tat. +Player 2 (P2): Mainly nice + Mainly nice. +Player 3 (P3): Mainly bad + Mainly bad. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 P2 P3 +vs. P0 : 0 250 57 54 +vs. P1 : 250 0 202 196 +vs. P2 : 248 202 0 181 +vs. P3 : 242 196 169 0 +TOTAL : 740 648 428 431 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 185 points with Grudger +(P1): 162 points with Tit for Tat +(P2): 107 points with Mainly nice +(P3): 107 points with Mainly bad diff --git a/prisoners_dilemma.py b/prisoners_dilemma.py new file mode 100644 index 0000000..59e4ac4 --- /dev/null +++ b/prisoners_dilemma.py @@ -0,0 +1,149 @@ +import random + +def main_play(modules): + scores, moves = play_tournament(modules) + # section0, section1, section2, section3 = make_reports(modules, scores, moves) + # print(section0+section1+section2) + # post_to_file(section0+section1+section2 ) + return scores, moves + +def play_tournament(modules): + + zeros_list = [0]*len(modules) + scores = [zeros_list[:] for module in modules] + moves = [zeros_list[:] for module in modules] + for first_team_index in range(len(modules)): + for second_team_index in range(first_team_index): + player1 = modules[first_team_index] + player2 = modules[second_team_index] + score1, score2, moves1, moves2 = play_iterative_rounds(player1, player2) + scores[first_team_index][second_team_index] = score1/len(moves1) + moves[first_team_index][second_team_index] = moves1 + scores[second_team_index][first_team_index] = score2/len(moves2) + moves[second_team_index][first_team_index] = moves2 + + scores[first_team_index][first_team_index] = 0 + moves[first_team_index][first_team_index] = '' + return scores, moves + + +def play_iterative_rounds(player1, player2): + + number_of_rounds = random.randint(100, 200) + moves1 = '' + moves2 = '' + score1 = 0 + score2 = 0 + for round in range(number_of_rounds): + score1, score2, moves1, moves2 = play_round(player1, player2, score1, score2, moves1, moves2) + return (score1, score2, moves1, moves2) + +def play_round(player1, player2, score1, score2, moves1, moves2): + + RELEASE = 250 + TREAT = 400 + SEVERE_PUNISHMENT = 0 + PUNISHMENT = 100 + + # Keep T > R > P > S + # Keep 2R > T + S + + ERROR = -250 + + action1 = player1.move(moves1, moves2, score1, score2) + action2 = player2.move(moves2, moves1, score2, score1) + if (type(action1) != str) or (len(action1) != 1): + action1=' ' + if (type(action2) != str) or (len(action2) != 1): + action2=' ' + + actions = action1 + action2 + if actions == 'cc': + score1 += RELEASE + score2 += RELEASE + elif actions == 'cb': + score1 += SEVERE_PUNISHMENT + score2 += TREAT + elif actions == 'bc': + score1 += TREAT + score2 += SEVERE_PUNISHMENT + elif actions == 'bb': + score1 += PUNISHMENT + score2 += PUNISHMENT + else: + score1 += ERROR + score2 += ERROR + + if action1 in 'bc': + moves1 += action1 + else: + moves1 += ' ' + if action2 in 'bc': + moves2 += action2 + else: + moves2 += ' ' + + return (score1, score2, moves1, moves2) + +def make_reports(modules, scores, moves): + section0 = make_section0(modules, scores) + section1 = make_section1(modules, scores) + section2 = make_section2(modules, scores) + return section0, section1, section2 + +def make_section0(modules, scores): + + section0 = '-'*80+'\n' + section0 += 'Section 0 - Line up\n' + section0 += '-'*80+'\n' + for index in range(len(modules)): + section0 += 'Player ' + str(index) + ' (P' + str(index) + '): ' + section0 += str(modules[index].strategy_name) + '\n' + strategy_description = str(modules[index].strategy_description) + while len(strategy_description) > 1: + newline = strategy_description[:72].find('\n') + if newline> -1: + section0 += ' '*8 + strategy_description[:newline+1] + strategy_description = strategy_description[newline+1:] + else: + section0 += ' '*8 + strategy_description[:72] + '\n' + strategy_description = strategy_description[72:] + return section0 + +def make_section1(modules, scores): + + section1 = '-'*80+'\nSection 1 - Player vs. Player\n'+'-'*80+'\n' + section1 += 'Each column shows pts/round earned against each other player:\n' + section1 += ' ' + for i in range(len(modules)): + section1 += '{:>7}'.format('P'+str(i)) + section1 += '\n' + for index in range(len(modules)): + section1 += 'vs. P' + str(index) + ' :' + for i in range(len(modules)): + section1 += '{:>7}'.format(scores[i][index]) + section1 += '\n' + + section1 += 'TOTAL :' + for index in range(len(modules)): + section1 += '{:>7}'.format(sum(scores[index])) + return section1+'\n' + +def make_section2(modules, scores): + + section2 = '-'*80+'\nSection 2 - Leaderboard\n'+'-'*80+'\n' + section2 += 'Average points per round:\n' + section2 += '(P#): Score with strategy name\n' + + section2_list = [] + for index in range(len(modules)): + section2_list.append(( + 'P'+str(index), + str(sum(scores[index])/len(modules)), + str(modules[index].strategy_name))) + section2_list.sort(key=lambda x: int(x[1]), reverse=True) + + for team in section2_list: + Pn, n_points, strategy_name = team + section2 += '({}): {:<10} points with {:<40}\n'.format( Pn, n_points, strategy_name[:40]) + return section2 diff --git a/prisoners_dilemma.pyc b/prisoners_dilemma.pyc new file mode 100644 index 0000000..da1faf1 Binary files /dev/null and b/prisoners_dilemma.pyc differ diff --git a/tit_for_2_tats.py b/tit_for_2_tats.py new file mode 100644 index 0000000..fa5ca1f --- /dev/null +++ b/tit_for_2_tats.py @@ -0,0 +1,15 @@ +team_name = 'A3' +strategy_name = 'Tit for 2 Tats' +strategy_description = 'Tit for 2 tats.' + +def move(my_history, their_history, my_score, their_score): + if len(my_history)==0: + return 'c' + x = len(their_history) + if(x >= 2): + if(their_history[x-1] == 'b' and their_history[x-2] == 'b'): + return 'b' + else: + return 'c' + else: + return 'c' \ No newline at end of file diff --git a/tit_for_2_tats.pyc b/tit_for_2_tats.pyc new file mode 100644 index 0000000..626a22d Binary files /dev/null and b/tit_for_2_tats.pyc differ diff --git a/tit_for_tat.py b/tit_for_tat.py new file mode 100644 index 0000000..d4d90e6 --- /dev/null +++ b/tit_for_tat.py @@ -0,0 +1,17 @@ +#### +# Each team's file must define four tokens: +# team_name: a string +# strategy_name: a string +# strategy_description: a string +# move: A function that returns 'c' or 'b' +#### + +team_name = 'A3' +strategy_name = 'Tit for Tat' +strategy_description = 'Tit for tat.' + +def move(my_history, their_history, my_score, their_score): + if len(my_history)==0: + return 'c' + else: + return their_history[-1] \ No newline at end of file diff --git a/tit_for_tat.pyc b/tit_for_tat.pyc new file mode 100644 index 0000000..836f8e8 Binary files /dev/null and b/tit_for_tat.pyc differ diff --git a/tournament.py b/tournament.py new file mode 100644 index 0000000..b45f4de --- /dev/null +++ b/tournament.py @@ -0,0 +1,154 @@ +import math +import random +import os.path +import prisoners_dilemma +import matplotlib.pyplot as plt + +import nice_guy, bad_guy, mainly_nice, mainly_bad, tit_for_tat, grudger, tit_for_2_tats + +strategies = [nice_guy, bad_guy, mainly_nice, mainly_bad, tit_for_tat, grudger, tit_for_2_tats] + +print("select the task to be performed :") +print("Task 1: \n Implement a simple IPD between two players implementing two given strategies. \n Study the evolution along the tournament confronting different strategies; \n study the overall outcome in the different configurations.") +print("Task 2: \n Implement a multiple players IPD (MPIPD) where several strategies play against each other in a roud-robin scheme") +print("Task 3: \n Iterate what done in the task_2 (repeated MPIPD, rMPIPD) by increasing the population \n implementing a given strategy depending on the results that strategy achieved in the previous iteration") +# print("Task 4: \n Implement a rMPIPD where strategies are allowed to mutate. \n The goal is to simulate the effect of genetic mutations and the effect of natura selection. \n A parameter (gene) should encode the attidue of an individual to cooperate, such gene can mutate randomly and \n the corresponding phenotype should compete in the MPIPD such that the best-fitted is determined.") +task_num = int(input()) + +def main(): + if(task_num == 1): + task_one() + if(task_num == 2): + task_two() + if(task_num == 3): + task_three() + +def task_one(): + number_of_players = 2 + players_strategies = [0]*number_of_players + strategies_length = len(strategies) + all_section = '' + i = 0 + while(i < strategies_length): + players_strategies[0] = strategies[i] + j = i + while(j < strategies_length): + players_strategies[1] = strategies[j] + modules = players_strategies + scores, moves = tournament(modules) + plt.title('Result of the game between '+modules[0].strategy_name+' and '+modules[1].strategy_name) + plot_graph(scores,modules, colors = ['blue','red'], width = 0.2) + all_section = create_reports(modules, scores, moves, all_section) + j = j+1 + i = i+1 + post_to_file(all_section,'1') + +def task_two(): + all_section = '' + modules = strategies + scores, moves = tournament(modules) + plt.title('Result of all strategies towards all other strategies') + plot_graph(scores,modules,colors = ['green'], width = 0.4) + all_section = create_reports(modules, scores, moves,all_section) + post_to_file(all_section,'2') + +def task_three(): + all_section = '' + number_of_players = int(input('Enter the number of players \n')) + if(number_of_players > 1): + number_of_repeatitions = int(input('Enter number of repeatitions to be performed \n')) + if(number_of_repeatitions < 1): + print("Please enter valid number of repeatitions to be performed which should be > 0") + number_of_repeatitions = int(input('Enter number of repititions to be performed \n')) + if(number_of_repeatitions < 1): + print("Invalid enter of repeatitions please start the tournament again \n") + return "" + print("select the strategies for all players") + print("1: nice guy \n 2: bad guy \n 3: mainly nice guy \n 4: mainly bad guy \n 5: tit for tat \n 6: Grudger \n 7: tit for 2 tats \n") + players_strategies = [0]*number_of_players + for each_player in range(number_of_players): + print("select strategy for player "+str(each_player)) + strategy_number = int(input()) + players_strategies[each_player] = strategies[strategy_number-1] + current_repeatition = 0 + while(current_repeatition < number_of_repeatitions): + modules = players_strategies + scores, moves = tournament(modules) + plt.title('Result of the game ') + plot_graph(scores,modules, colors = ['orange','cyan'], width = 0.2) + all_section = create_reports(modules, scores, moves,all_section) + if current_repeatition < number_of_repeatitions-1: + print("Enter 0: to change the strategies of the players \n 1: to continue with existing strategies \n ") + change_strategy = int(input()) + if(change_strategy == 0): + print("1: nice guy \n 2: bad guy \n 3: mainly nice guy \n 4: mainly bad guy \n 5: tit for tat \n 6: Grudger \n 7: tit for 2 tats \n") + players_strategies = [0]*number_of_players + for each_player in range(number_of_players): + print("select strategy for player "+str(each_player)) + strategy_number = int(input()) + players_strategies[each_player] = strategies[strategy_number-1] + current_repeatition = current_repeatition + 1 + else: + print("Tournament is not possible with "+str(number_of_players)+" players") + post_to_file(all_section,'3') + +# def task_four(): +# number_of_players = int(input('Enter the number of players \n')) +# number_of_repeatitions = int(input('Enter number of repeatitions to be performed \n')) +# players_strategies = [0]*number_of_players +# strategies = [mainly_nice, nice_guy, tit_for_tat] +# for each_player in range(number_of_players): +# strategy = random.choice(strategies) +# players_strategies[each_player] = strategy +# current_repeatition = 0 +# while(current_repeatition < number_of_repeatitions): +# modules = players_strategies +# tournament(modules) +# #task 4 is pending +# current_repeatition = current_repeatition + 1 + + +def tournament(modules): + for module in modules: + reload(module) + for required_variable in ['strategy_name', 'strategy_description']: + if not hasattr(module, required_variable): + setattr(module, required_variable, 'missing assignment') + + scores, moves = prisoners_dilemma.main_play(modules) + return scores, moves + +def create_reports(modules, scores, moves, all_section): + section0, section1, section2 = prisoners_dilemma.make_reports(modules, scores, moves) + print(section0+section1+section2) + prev_all_section = all_section + all_section = section0 + section1 + section2 + all_section = prev_all_section + all_section + return all_section + +def post_to_file(string, number, filename='', directory=''): + filename = 'tournament_'+number+'.txt' + if directory=='': + directory = os.path.dirname(os.path.abspath(__file__)) + filename = os.path.join(directory, filename) + filehandle = open(filename,'w') + filehandle.write(string) + + +def plot_graph(scores,modules,colors,width): + left = list(range(1,len(modules)+1)) + height = [0]*len(modules) + players_strategies = [0]*len(modules) + i = 0 + for each_player_score in scores: + height[i] = sum(each_player_score)/len(modules) + players_strategies[i] = modules[i].strategy_name + i = i+1 + plt.bar(left,height, tick_label = players_strategies, width = width, color = colors) + plt.xlabel('x-axis') + plt.ylabel('y-axis') + plt.show() + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/tournament_1.txt b/tournament_1.txt new file mode 100644 index 0000000..e3a27b9 --- /dev/null +++ b/tournament_1.txt @@ -0,0 +1,624 @@ +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Nice guy + Always co-operate. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Nice guy +(P1): 125 points with Nice guy +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Bad guy + Always betray. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 400 +vs. P1 : 0 0 +TOTAL : 0 400 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P1): 200 points with Bad guy +(P0): 0 points with Nice guy +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Mainly nice + Mainly nice. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 323 +vs. P1 : 128 0 +TOTAL : 128 323 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P1): 161 points with Mainly nice +(P0): 64 points with Nice guy +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Mainly bad + Mainly bad. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 327 +vs. P1 : 120 0 +TOTAL : 120 327 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P1): 163 points with Mainly bad +(P0): 60 points with Nice guy +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Tit for Tat + Tit for tat. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Nice guy +(P1): 125 points with Tit for Tat +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Nice guy +(P1): 125 points with Grudger +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Nice guy +(P1): 125 points with Tit for 2 Tats +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Bad guy + Always betray. +Player 1 (P1): Bad guy + Always betray. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 100 +vs. P1 : 100 0 +TOTAL : 100 100 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 50 points with Bad guy +(P1): 50 points with Bad guy +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Bad guy + Always betray. +Player 1 (P1): Mainly nice + Mainly nice. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 48 +vs. P1 : 253 0 +TOTAL : 253 48 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 126 points with Bad guy +(P1): 24 points with Mainly nice +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Bad guy + Always betray. +Player 1 (P1): Mainly bad + Mainly bad. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 51 +vs. P1 : 245 0 +TOTAL : 245 51 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 122 points with Bad guy +(P1): 25 points with Mainly bad +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Bad guy + Always betray. +Player 1 (P1): Tit for Tat + Tit for tat. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 99 +vs. P1 : 102 0 +TOTAL : 102 99 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 51 points with Bad guy +(P1): 49 points with Tit for Tat +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Bad guy + Always betray. +Player 1 (P1): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 99 +vs. P1 : 102 0 +TOTAL : 102 99 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 51 points with Bad guy +(P1): 49 points with Grudger +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Bad guy + Always betray. +Player 1 (P1): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 98 +vs. P1 : 103 0 +TOTAL : 103 98 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 51 points with Bad guy +(P1): 49 points with Tit for 2 Tats +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly nice + Mainly nice. +Player 1 (P1): Mainly nice + Mainly nice. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 176 +vs. P1 : 176 0 +TOTAL : 176 176 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 88 points with Mainly nice +(P1): 88 points with Mainly nice +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly nice + Mainly nice. +Player 1 (P1): Mainly bad + Mainly bad. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 184 +vs. P1 : 167 0 +TOTAL : 167 184 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P1): 92 points with Mainly bad +(P0): 83 points with Mainly nice +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly nice + Mainly nice. +Player 1 (P1): Tit for Tat + Tit for tat. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 201 +vs. P1 : 201 0 +TOTAL : 201 201 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 100 points with Mainly nice +(P1): 100 points with Tit for Tat +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly nice + Mainly nice. +Player 1 (P1): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 249 +vs. P1 : 60 0 +TOTAL : 60 249 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P1): 124 points with Grudger +(P0): 30 points with Mainly nice +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly nice + Mainly nice. +Player 1 (P1): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 129 +vs. P1 : 322 0 +TOTAL : 322 129 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 161 points with Mainly nice +(P1): 64 points with Tit for 2 Tats +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly bad + Mainly bad. +Player 1 (P1): Mainly bad + Mainly bad. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 170 +vs. P1 : 170 0 +TOTAL : 170 170 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 85 points with Mainly bad +(P1): 85 points with Mainly bad +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly bad + Mainly bad. +Player 1 (P1): Tit for Tat + Tit for tat. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 196 +vs. P1 : 196 0 +TOTAL : 196 196 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 98 points with Mainly bad +(P1): 98 points with Tit for Tat +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly bad + Mainly bad. +Player 1 (P1): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 244 +vs. P1 : 53 0 +TOTAL : 53 244 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P1): 122 points with Grudger +(P0): 26 points with Mainly bad +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Mainly bad + Mainly bad. +Player 1 (P1): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 123 +vs. P1 : 317 0 +TOTAL : 317 123 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 158 points with Mainly bad +(P1): 61 points with Tit for 2 Tats +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Tit for Tat + Tit for tat. +Player 1 (P1): Tit for Tat + Tit for tat. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Tit for Tat +(P1): 125 points with Tit for Tat +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Tit for Tat + Tit for tat. +Player 1 (P1): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Tit for Tat +(P1): 125 points with Grudger +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Tit for Tat + Tit for tat. +Player 1 (P1): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Tit for Tat +(P1): 125 points with Tit for 2 Tats +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +Player 1 (P1): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Grudger +(P1): 125 points with Grudger +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +Player 1 (P1): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Grudger +(P1): 125 points with Tit for 2 Tats +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Tit for 2 Tats + Tit for 2 tats. +Player 1 (P1): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 +vs. P0 : 0 250 +vs. P1 : 250 0 +TOTAL : 250 250 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 125 points with Tit for 2 Tats +(P1): 125 points with Tit for 2 Tats diff --git a/tournament_2.txt b/tournament_2.txt new file mode 100644 index 0000000..8c60801 --- /dev/null +++ b/tournament_2.txt @@ -0,0 +1,43 @@ +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Nice guy + Always co-operate. +Player 1 (P1): Bad guy + Always betray. +Player 2 (P2): Mainly nice + Mainly nice. +Player 3 (P3): Mainly bad + Mainly bad. +Player 4 (P4): Tit for Tat + Tit for tat. +Player 5 (P5): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +Player 6 (P6): Tit for 2 Tats + Tit for 2 tats. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 P2 P3 P4 P5 P6 +vs. P0 : 0 400 322 327 250 250 250 +vs. P1 : 0 0 48 52 99 99 98 +vs. P2 : 129 253 0 185 200 249 130 +vs. P3 : 121 242 166 0 196 245 124 +vs. P4 : 250 102 204 198 0 250 250 +vs. P5 : 250 101 61 53 250 0 250 +vs. P6 : 250 104 321 316 250 250 0 +TOTAL : 1000 1202 1122 1131 1245 1343 1102 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P5): 191 points with Grudger +(P4): 177 points with Tit for Tat +(P1): 171 points with Bad guy +(P3): 161 points with Mainly bad +(P2): 160 points with Mainly nice +(P6): 157 points with Tit for 2 Tats +(P0): 142 points with Nice guy diff --git a/tournament_3.txt b/tournament_3.txt new file mode 100644 index 0000000..2bb44fb --- /dev/null +++ b/tournament_3.txt @@ -0,0 +1,93 @@ +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +Player 1 (P1): Tit for Tat + Tit for tat. +Player 2 (P2): Mainly nice + Mainly nice. +Player 3 (P3): Mainly bad + Mainly bad. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 P2 P3 +vs. P0 : 0 250 62 52 +vs. P1 : 250 0 201 197 +vs. P2 : 249 201 0 184 +vs. P3 : 245 194 166 0 +TOTAL : 744 645 429 433 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 186 points with Grudger +(P1): 161 points with Tit for Tat +(P3): 108 points with Mainly bad +(P2): 107 points with Mainly nice +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +Player 1 (P1): Tit for Tat + Tit for tat. +Player 2 (P2): Mainly nice + Mainly nice. +Player 3 (P3): Mainly bad + Mainly bad. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 P2 P3 +vs. P0 : 0 250 59 54 +vs. P1 : 250 0 204 195 +vs. P2 : 248 200 0 183 +vs. P3 : 242 195 167 0 +TOTAL : 740 645 430 432 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 185 points with Grudger +(P1): 161 points with Tit for Tat +(P3): 108 points with Mainly bad +(P2): 107 points with Mainly nice +-------------------------------------------------------------------------------- +Section 0 - Line up +-------------------------------------------------------------------------------- +Player 0 (P0): Grudger + Starts with cooperation and once if the opponent betrays then always gru + dger betrays irrespective of the opponent move. +Player 1 (P1): Tit for Tat + Tit for tat. +Player 2 (P2): Mainly nice + Mainly nice. +Player 3 (P3): Mainly bad + Mainly bad. +-------------------------------------------------------------------------------- +Section 1 - Player vs. Player +-------------------------------------------------------------------------------- +Each column shows pts/round earned against each other player: + P0 P1 P2 P3 +vs. P0 : 0 250 57 54 +vs. P1 : 250 0 202 196 +vs. P2 : 248 202 0 181 +vs. P3 : 242 196 169 0 +TOTAL : 740 648 428 431 +-------------------------------------------------------------------------------- +Section 2 - Leaderboard +-------------------------------------------------------------------------------- +Average points per round: +(P#): Score with strategy name +(P0): 185 points with Grudger +(P1): 162 points with Tit for Tat +(P2): 107 points with Mainly nice +(P3): 107 points with Mainly bad