Created
October 9, 2013 04:12
-
-
Save catermelon/6896090 to your computer and use it in GitHub Desktop.
ZombieBot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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