Simulate what the opponent will do on the current turn, and what they would do on the next two turns if I defect twice in a row.
If the results of the simulations are [cooperate, defect, defect], play tit-for-tat. Otherwise, defect.
This will defect against DefectBots, CooperateBots, and most of the silly bots that don’t pay attention to the opponent’s moves. Meanwhile, it cooperates against tit-for-tats and grim triggers and the like.
There are a bunch of details and optimizations and code-golf-ifications, but the big one is that instead of simulating the opponent using the provided function f, I use a code-golfed version of the code used to create bots in the tournament program (in createBot()). This prevents the anti-simulator bots from realizing they’re in a simulation—arguments.callee.name is “f”, and the variable a isn’t defined.
The simulation this bot is doing pits the opposing bot against tit-for-tat, rather than against the winning bot itself, to avoid the infinite regress that would occur if the opposing bot also runs a simulation.
The last paragraph is because I wrote the tournament code poorly, and the function that’s provided to the bots to let them simulate other bots was slightly different from the way the top-level bots were run, which allowed bots to tell if they were in a simulation and output different behavior. (In particular someone submitted a “simulator killer” that would call process.exit() any time it detected it was in a simulation, which would shut down the entire tournament, disqualifying the top-level bot that had run the simulation.) This submission modifies the simulation function to make it indistinguishable.
The greek letters as variable names were for style points.
It’s conceptually pretty simple; 240 characters isn’t room for a lot. Here’s how the writer explained it:
The simulation this bot is doing pits the opposing bot against tit-for-tat, rather than against the winning bot itself, to avoid the infinite regress that would occur if the opposing bot also runs a simulation.
The last paragraph is because I wrote the tournament code poorly, and the function that’s provided to the bots to let them simulate other bots was slightly different from the way the top-level bots were run, which allowed bots to tell if they were in a simulation and output different behavior. (In particular someone submitted a “simulator killer” that would call process.exit() any time it detected it was in a simulation, which would shut down the entire tournament, disqualifying the top-level bot that had run the simulation.) This submission modifies the simulation function to make it indistinguishable.
The greek letters as variable names were for style points.
Is it safe to call this bot ‘tit for tat with foresight and feigned ignorance’?
I’m wondering what its’ actual games looked like and how much of a role the hidden foresight actually played.