Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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
def getSteemUser(self):
return "@scorpil"
def think(self, context):
moves = {
Bet.TEN: 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
You can’t perform that action at this time.