The Prisoner's Dilemma, but with 3 choices, and the payoffs are random!
Each round, your bot recieves a 3x3 grid and chooses a row to play. The grid might be this:
4 5 7 3 1 9 9 9 0
Each number in the grid is between 0 and 10 (inclusive). Your score for the round is
grid[your_play][their_play], and your opponent's is
You play 100(+/-10) rounds in sequence, keeping any information you wish. The winner is the bot with a higher score at the end (draws are 0.5 wins for both bots).
Using the grid above:
Player 1: row 2
Player 2: row 2
Both players get 0 points.
Player 1: row 1
Player 2: row 0
Player 1 gets 3 points, Player 2 gets 5 points.
Each bot will play 10 games of ~100 rounds against each bot (including itself!). Your bot can win in two categories:
- Score: the total scores will be summed and the bot with the most points at the end will win.
- Wins: a 'win' is counted for the bot with the highest score after the ~100 rounds have been played.
The overall winner will be determined by combining the two tables. A winner will be accepted about 1 week after the most recent entry, but I will probably continue to update the highscore table if new entries are added.
Write two functions in Python 3 with these signatures:
def strategize(grid: list[list[int]], store: object) -> int
def interpret(grid: list[list[int]], moves: tuple(int, int), store: dict) -> None
strategizeis called each round and should return
gridis the 3x3 grid of possible payouts.
storeis an empty dict to store any kind of information you'd like to.
interpretis called after every round.
movesis a tuple containing (
Put your code in the first code block in your answer so the controller can easily pull in your bot.
'Naiive' chooses the row with the highest average payout.
def strategize(grid, store): sums = [(sum(x), i) for (i, x) in enumerate(grid)] return max(sums) def interpret(grid, moves, store): pass
'Random' picks a random row.
import random def strategize(grid, store): return random.randint(0, 2) def interpret(grid, moves, store): pass
- No cheating by interfering directly with your opponent (through global variables etc.).
- Your function should be relatively quick to execute - the quicker it is, the better.
- You may submit multiple entries.
The controller is available at https://github.com/Nucaranlaeg/KOTH-random-prisoner.
This controller is largely adapted from https://github.com/jthistle/KOTH-counting.
A couple of example bots are provided along with it to demonstrate how to use it.
arena.py is what I'll be using to calculate final scores. It pits each bot against each other bot.
update.py will fetch all submitted bots from the contest page.
Using the flag
-constant will cause games to be played without randomizing the grid between rounds, purely for interest's sake.
By score: 1: Blendo with 11750.0 points 2: Naiive with 11010.6 points 3: Analyst with 10957.0 points 4: Min-Maxer with 10560.3 points 5: Rafaam with 10548.2 points 6: Naive Variation with 10358.9 points 7: Villain with 10266.2 points 8: Gradient-Mehscent with 10233.1 points 9: WhatDoYouExpect with 10162.0 points 10: Gentleman with 10067.6 points 11: Thief with 9172.7 points 12: Minimum Maximizer with 9135.5 points 13: HermitCrab with 9113.5 points 14: crab with 8533.4 points 15: Investigator with 8220.9 points 16: Random with 8198.4 points By wins: 1: Blendo with 14.5/15 wins 2: WhatDoYouExpect with 13.8/15 wins 3: Rafaam with 13.7/15 wins 4: Naiive with 11.2/15 wins 5: Analyst with 10.8/15 wins 6: Min-Maxer with 10.5/15 wins 7: Villain with 8.1/15 wins 8: Naive Variation with 8.1/15 wins 9: HermitCrab with 7.3/15 wins 10: crab with 6.4/15 wins 11: Thief with 5.1/15 wins 12: Minimum Maximizer with 3.9/15 wins 13: Gradient-Mehscent with 1.9/15 wins 14: Random with 1.7/15 wins 15: Investigator with 1.7/15 wins 16: Gentleman with 1.4/15 wins Combined leaderboard (fewer pts = better): 1: Blendo (2 pts) 2: Naiive (6 pts) 3: Analyst (8 pts) 3: Rafaam (8 pts) 5: Min-Maxer (10 pts) 6: WhatDoYouExpect (11 pts) 7: Naive Variation (14 pts) 7: Villain (14 pts) 9: Gradient-Mehscent (21 pts) 10: Thief (22 pts) 10: HermitCrab (22 pts) 12: Minimum Maximizer (24 pts) 12: crab (24 pts) 14: Gentleman (26 pts) 15: Investigator (30 pts) 15: Random (30 pts)