Skip to content

Instantly share code, notes, and snippets.

@Scorpil
Created January 26, 2018 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Scorpil/0fb5bf9ffe512ccc63ca0f3a6229ea56 to your computer and use it in GitHub Desktop.
Save Scorpil/0fb5bf9ffe512ccc63ca0f3a6229ea56 to your computer and use it in GitHub Desktop.
from Game.Player import Player
from Game.Context import Context
from Game.Bet import Bet
class OffendablePlayer(Player):
"""
simple bot that "takes offense" if number of players that bet is
less that number of players that don't * OFFENSIVENESS factor
"""
OFFENSIVENESS = 3
def getSteemUser(self):
return "@scorpil"
def think(self, context):
moves = {
Bet.TEN: 0,
Bet.NOTHING: 0,
Bet.ALLIN: 0,
}
for pl in context.playerContexts.values():
if len(pl.previousMoves):
bet = pl.previousMoves[-1]
moves[bet] = moves.get(bet, 0) + 1
pos_score = moves[Bet.TEN] + moves[Bet.ALLIN]
neg_score = moves[Bet.NOTHING] * self.OFFENSIVENESS
if pos_score >= neg_score:
return Bet.TEN
return Bet.NOTHING
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment