You are viewing a single comment's thread from:

RE: The AI Contest #1: public goods problem

in #aicontest7 years ago

Here's a Conservative bot to fuel the contest. Not a great one, I'm not here to grab the reward, but it will populate the arena. Feel free to provide more than one bot each.

Conservative will play ten until it sees that others are selfish, then becomes and stays selfish.

def getSteemUser(self):
  return "@gbd"

def think(self, context):
  self.lastMove = self.thinkDetails(context)
  return self.lastMove


def thinkDetails(self, context):
  # First round: TEN
  if (context.roundIndex == 0):
      return Bet.TEN

  # Other rounds: were they generous last turn?
  nbUrchins = sum(c.previousMoves[context.roundIndex-1] == Bet.NOTHING for c in context.playerContexts.values())

  if (self.lastMove == Bet.NOTHING or nbUrchins > 6):
    return Bet.NOTHING

  return Bet.TEN

Coin Marketplace

STEEM 0.21
TRX 0.25
JST 0.038
BTC 95337.35
ETH 3371.14
USDT 1.00
SBD 3.08