Skip to content

Instantly share code, notes, and snippets.

@catermelon
Created October 9, 2013 04:12
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 catermelon/6896090 to your computer and use it in GitHub Desktop.
Save catermelon/6896090 to your computer and use it in GitHub Desktop.
ZombieBot
class Rachel_ChanceItIfUsing(object):
def __init__(self, name):
self.name = name
self.minShotguns = 2
def turn(self, gameState):
green_dice_left = 6
red_dice_left = 3
shotguns = 0 # number of shotguns rolled this turn
while shotguns < self.minShotguns:
results = roll()
if results == []:
return
for i in results:
if i[ICON] == SHOTGUN:
shotguns += 1
if i[COLOR] == GREEN:
green_dice_left -= 1
if i[COLOR] == RED:
red_dice_left -= 1
highestScoreThatIsntMine = max([zombieScore for zombieName, zombieScore in gameState[SCORES].items() if zombieName != CURRENT_ZOMBIE])
myScore = gameState[SCORES][CURRENT_ZOMBIE]
if myScore < highestScoreThatIsntMine:
if green_dice_left > red_dice_left:
roll()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment