Who will win the second installment of the Manifold iterated prisoner's dilemma tournament?
8
288
295
Nov 16
21%
Multicore
4%
Isaac King
74%
Other

This is a sequel to /IsaacKing/which-240-character-program-wins-th, with a more robust ruleset and improved tournament structure.

This tournament will have three rounds. In each round, all participants privately submit a single bot via Google form. Once all submissions are in, the bots are played against each other and all bots from previous rounds, and each participant earns points equal to the total points scored by their bot for that round. All bots are made public after the round is over.

Each round of play is a round-robin tournament where each bot plays each bot once. (Including itself.) Each match between two bots consists of a random number of games that could be anywhere from 1 to 100. (The match lengths are determined individually, so your program will have to play matches of many different lengths.)

Each game uses the traditional payoff matrix for the prisoner's dilemma, converted to positive points; double cooperate gets 2 points each, double defect gets 1 point each, cooperate-defect gets 3 points to the defector and 0 to the cooperator. At the end of every match, points are normalized to a match length of 1 so that programs do not end up with more points just for lucking into a longer match. (For example, if your program played a 12-game match and ended with 21 points, that's normalized to 1.75 points towards its final total.)

For example:

  • In round 1, ten people submit bots and those bots play each other. Nobody gets to see anyone else's bot before submitting theirs.

  • I mark down everyone's scores, and those bots are then posted publicly.

  • In round 2, those ten people each privately submit a new bot. The participants can now take into account the bots from round 1, and design their round 2 bots with them in mind.

  • The round 2 bots are played against each other and the round 1 bots, in a round-robin tournament of 20 total bots.

  • For each bot that was submitted in round 2, I add its score to the total score of its creator, then post the round 2 bots publicly. (The scores obtained by the round 1 bots in round 2 are irrelevant.)

  • Same thing for round 3.

  • The person with the most points at the end wins.

If someone wants to join the tournament late, they receive points for any round they missed equal to the lowest-scoring bot in that round.

Bots must be written in Javascript, and are limited to a maximum of 300 characters. They should be a function that returns 0, false, "d", or "defect" for defection and 1, true, "c", or "cooperate" for cooperation. For example, this is a valid bot:

async function(opponentSource, mySource, simulate, history, opponentHistory) {return "cooperate";}

  • Argument 1 is a string that is the source code of the opponent.

  • Argument 2 is a string that is the program's own source code.

  • Argument 3 is an asynchronous function simulate(source, opponent, history, timeLimit) that runs the source bot against the provided opponent with the provided history, and returns either 1, 0, or null. If timeLimit (ms) is reached with no result or the bot returned an invalid answer, simulate returns null.

  • Argument 4 is an array with the history of all past games. Each entry of the array is an object with properties "m" and "o", (for "me" and "opponent") with values of 0 or 1 to denote defection or cooperation. For example, if they're playing for the 3rd time, and the first time they both cooperated and the second time your program defected and the other cooperated, h is [{"m":1,"o":1},{"m":0,"o":1}].

  • Argument 5 is the history with the players inverted, the m and o values swapped in each entry.

If a bot does not return a result for a game, either because it errored, or ran for longer than 1 second, or doesn't have a return statement, it gets 0 points.

If a bot does return a result but its opponent does not, that bot gets 3 points for that game, regardless of whether it cooperated or defected.

The exact code for the tournament can be seen on Github here. The bots are run within a web worker within a browser while my internet connection is turned off, meaning they are fully sandboxed from each other. As such, there are no restrictions on what a bot may or may not do.

(With one exception: due to a browser design flaw, terminating a worker does not terminate any child workers it spawned. A bot could create hundreds of infinitely looping child workers that will stick around even after that bot is terminated, lagging the whole tournament. If any bots do that I'll just disqualify them preemptively.)

The program with the highest final point total wins. If there is a tie, I will run a second tournament of the same structure that includes only the tied programs, repeating this process until there is a single winner. If this ends in a stable equilibrium of tied programs, I'll resolve to all of them equally.

I will be playing myself. I will finalize my own bot submissions before looking at anyone else's.

Side-channel collusion between players is against the spirit of this game; please don't do it. Your bots can collude with each other, but don't talk to other players and form a secret cooperation ring. This does not mean that every entry has to be a serious attempt to win. For example, it is acceptable to submit a bot for fun/chaos that only cooperates with other bots whose source code has an odd number of characters, but then it would be against the spirit of the game for some-but-not-all of the current players to be told about your submission in advance.

If you want to participate but are not familiar with Javascript, please don't submit potentially-broken code. Just describe to me what you'd like your bot to do in pseudocode (i.e. English, being very specific about exactly what it does and leaving no ambiguities), and I'll translate it into Javascript for you. Alternatively, we can set up a time to have a voice call on Discord, and I'll give you a crash course in the Javascript features you need for a challenge like this. Expect this to take 30-90 minutes.

Round 1 has begun! Submit your bots here. If you make a mistake or change your mind, you can edit your submission right up until the form closes.

Get Ṁ200 play money
Sort by:

If anyone is interested in testing their bot against some cannon fodder, I converted a bunch of bots from the previous tournament to the new format (removing ones that referenced ID or now-unavailable variables): https://pastebin.com/dCFyvDSs

The tournament code for this round seems to be at least a hundred times slower than the one for the last round, though. With the bots from this file there are ~1200 matchups, and my laptop was only able to do 200 of them in an hour.

@Multicore Oof. Yeah, spinning off subprocesses in JS is vastly slower than synchronous code. Looks like we're going to have fewer competitors this time, so hopefully it won't be an issue. (Worst case scenario I can just wait a few days for the final results.)

@IsaacKing I tried a bot with a bit of simulation, and calls to the third argument simulate() function would regularly time out even when simulating simple bots and given 200 ms.

This is probably somewhat hardware-dependent, but simulation using the provided function seems unreliable as a strategy right now.

Round 1 has begun! Contestants should submit your name as an answer to the market, and submit your bots here. I'll leave the form open until it doesn't seem like any new submissions will be forthcoming.

Note that I've added Benjamin's requested rule of "no collusion", so please don't collude.

Alright, doesn't look like there are any objections to us starting with the current rules?

@IsaacKing The thing I'd want to see added if possible would be a way to discourage meta-level collusion between players - I'd rather not have more people trying to sell their entry for a few hundred mana like last time.

@BenjaminCosman Hmm, how to operationalize that?

@IsaacKing I can't think of a good way to enforce it at the moment, but given the low stakes of this hopefully-friendly game, it might just work to ask people nicely? e.g.:

"Side-channel collusion between players is against the spirit of this game; please don't do it. This does not mean that every entry has to be a serious attempt to win. For example, it is acceptable to submit a bot for fun/chaos that only cooperates with other bots whose source code has an odd number of characters, but then it would be against the spirit of the game for some-but-not-all of the current players to be told about your submission in advance."

...but if you think people wouldn't listen anyway, or that this would cause other problems, then maybe better to just leave that behavior as allowed - unenforceable rules that people break just disadvantage conscientious people :)

Multicore

Accidental oops