You should also check whether ‘exec’ is in the program code string, because someone could call getopponentsource with exec and caesar-encryption, otherwise you will be DQ’d if someone submits a program like that. (However, rebinding getopponentsource is probably more elegant than this type of static analysis.)
I don’t know whether it’s a competitive entry (it would be a FoldBot in Zvi’s taxonomy), but as a quick piece of software, I’m pretty proud of
AbstractSpyTreeBot
!You should also check whether ‘exec’ is in the program code string, because someone could call getopponentsource with exec and caesar-encryption, otherwise you will be DQ’d if someone submits a program like that. (However, rebinding getopponentsource is probably more elegant than this type of static analysis.)
This seems to only simulate the opponent’s first move, and then act as if the opponent will make that move every round.
For the most part this is a good reference implementation though, and I expect I’ll be borrowing from it in my submission.
An interesting bot for simulators to grapple with is this:
class BullyBot:
def __init__(self, round=0):
self.opponentThreesPlayed = 0
def move(self, previous=None):
if self.opponentThreesPlayed > 3:
return previous
elif previous == 3:
self.opponentThreesPlayed+=1
if self.opponentThreesPlayed > 3:
return 2
return 3
Something that holds out just long enough to get a naive simulator to fold to it forever, but will probably end up cooperating with most others.
Competitive or not it is technically competing. Welcome to the game!