def turn(self, gameState): thisZombie = gameState['CURRENT_ZOMBIE'] highestScoreThatIsntMine = max([ zombieScore for zombieName, zombieScore in gameState['SCORES'].items() if zombieName != thisZombie ]) diceRollResults = zombiedice.roll() shotguns = 0 brains = 0 while diceRollResults is not None: shotguns += diceRollResults['shotgun'] brains += diceRollResults["brains"] #print(gameState['SCORES']) #print(highestScoreThatIsntMine) if brains <= 12 and highestScoreThatIsntMine >= 13: diceRollResults = zombiedice.roll() try: brains += diceRollResults["brains"] except: pass if brains >= 13: break elif shotguns < 2: diceRollResults = zombiedice.roll() # roll again elif shotguns == 2 and brains == 0: diceRollResults = zombiedice.roll() else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() while diceRollResults is not None: if random.randint(1, 2) == 1: diceRollResults = zombiedice.roll() else: break
def turn(self, gameState): zombiedice.roll() #randomly decide to stop or continue a = 1 while a == True: zombiedice.roll() a = random.randint(0, 1)
def turn(self, gameState): # gameState is a dict with info about the current state of the game. # You can choose to ignore it in your code. diceRollResults = zombiedice.roll() # first roll # roll() returns a dictionary with keys 'brains', 'shotgun', and # 'footsteps' with how many rolls of each type there were. # The 'rolls' key is a list of (color, icon) tuples with the # exact roll result information. # Example of a roll() return value: # {'brains': 1, 'footsteps': 1, 'shotgun': 1, # 'rolls': [('yellow', 'brains'), ('red', 'footsteps'), # ('green', 'shotgun')]} # A bot that stops rolling after it has rolled two brains while diceRollResults is not None: randomNumber = random.randint(0, 1) if randomNumber == 1: diceRollResults = zombiedice.roll() # roll again else: break # A bot that stops rolling after it has rolled two shotguns while diceRollResults is not None: randomNumber = random.randint(0, 1) if randomNumber == 1: diceRollResults = zombiedice.roll() # roll again else: break
def turn(self, gameState): # gameState is a dict with info about the current state of the game. # You can choose to ignore it in your code. diceRollResults = zombiedice.roll() # first roll # roll() returns a dictionary with keys 'brains', 'shotgun', and # 'footsteps' with how many rolls of each type there were. # The 'rolls' key is a list of (color, icon) tuples with the # exact roll result information. # Example of a roll() return value: # {'brains': 1, 'footsteps': 1, 'shotgun': 1, # 'rolls': [('yellow', 'brains'), ('red', 'footsteps'), # ('green', 'shotgun')]} # REPLACE THIS ZOMBIE CODE WITH YOUR OWN: brains = 0 shotgun = 0 while diceRollResults is not None: brains += diceRollResults['brains'] shotgun += diceRollResults['shotgun'] if shotgun < 2: diceRollResults = zombiedice.roll() # roll again else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() while diceRollResults is not None: if diceRollResults["brains"] > diceRollResults["shotgun"]: diceRollResults = zombiedice.roll() else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() # first roll # A bot that, after the first roll, randomly decides if it will continue or stop while diceRollResults is not None: randomNumber = random.randint(0, 1) if randomNumber == 1: diceRollResults = zombiedice.roll() # roll again else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() # first roll while diceRollResults is not None: if random.randint(0, 1): diceRollResults = zombiedice.roll() else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() while diceRollResults is not None: continue_rolling = random.randint(0, 1) if continue_rolling == 0: diceRollResults = zombiedice.roll() else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() choice = [0, 1] while diceRollResults is not None: if random.choice(choice) == 1: diceRollResults = zombiedice.roll() else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() shotgun = 0 while diceRollResults is not None: shotgun += diceRollResults['shotgun'] if shotgun < 2: diceRollResults = zombiedice.roll() else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() brains = 0 while diceRollResults is not None: brains += diceRollResults['brains'] if brains < 2: diceRollResults = zombiedice.roll() else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() shotgun = 0 for i in range(random.randint(1, 4)): shotgun += diceRollResults['shotgun'] if shotgun < 2: diceRollResults = zombiedice.roll() else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() # first roll choice = randint(0, 1) if choice == 1: while diceRollResults is not None: diceRollResults = zombiedice.roll() # roll again
def turn(self, gameState): while True: diceRollResults = zombiedice.roll() if diceRollResults == None: break elif diceRollResults["shotgun"] == 2: break else: zombiedice.roll()
def turn(self, gameState): results = zombiedice.roll() shotguns = 0 while results: shotguns += results['shotgun'] if shotguns < 2: results = zombiedice.roll() else: break
def turn(self, gameState): results = zombiedice.roll() brains = 0 while results: brains += results['brains'] if brains < 2: results = zombiedice.roll() else: break
def turn(self, gameState): shotguns = 0 diceRollResults = zombiedice.roll() # first roll while diceRollResults is not None: shotguns += diceRollResults['shotgun'] if shotguns < 2: diceRollResults = zombiedice.roll() # roll again else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() # first roll shotguns = 0 # A bot that initially decides it’ll roll the dice one to four times, but will stop early if it rolls two shotguns for i in range(random.randint(1, 4)): shotguns += diceRollResults['shotgun'] if shotguns < 2: diceRollResults = zombiedice.roll() # roll again else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() # first roll brains = 0 # A bot that stops rolling after it has rolled two brains while diceRollResults is not None: brains += diceRollResults['brains'] if brains == 2: break else: diceRollResults = zombiedice.roll() # roll again
def turn(self, gameState): diceRollResults = zombiedice.roll() # first roll while diceRollResults is not None: brains = 0 brains += diceRollResults['brains'] if brains == 2: break else: diceRollResults = zombiedice.roll() #rolls again
def turn(self, gameState): diceRollResults = zombiedice.roll() while diceRollResults is not None: shotguns = 0 shotguns = diceRollResults['shotgun'] if shotguns == 2: break else: diceRollResults = zombiedice.roll()
def turn(self, gameState): shotgun_count = 0 dice_roll_results = zombiedice.roll() # first roll shotgun_count += dice_roll_results['shotgun'] while shotgun_count < 2: dice_roll_results = zombiedice.roll() if dice_roll_results['shotgun'] is not None: shotgun_count += dice_roll_results['shotgun']
def turn(self, gameState): diceRollResults = zombiedice.roll() shotgun = 0 brains = 0 while diceRollResults is not None: shotgun += diceRollResults['shotgun'] brains += diceRollResults['brains'] if brains < shotgun: break else: diceRollResults = zombiedice.roll()
def turn(self, gameState): diceRollResults = zombiedice.roll() # first roll # Stops rolling if it gets 2 brains brains = 0 while diceRollResults is not None: brains += diceRollResults['brains'] if brains != 2: diceRollResults = zombiedice.roll() # roll again else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() # first roll # Stops after rolling two shotguns - already included in example shotguns = 0 while diceRollResults is not None: shotguns += diceRollResults['shotgun'] if shotguns != 2: diceRollResults = zombiedice.roll() # roll again else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() # initial roll shotgun = 0 rolls = 1 max_rolls = random.randint(1, 4) while diceRollResults and rolls <= max_rolls: if shotgun < 2: diceRollResults = zombiedice.roll() if diceRollResults is None: # AKA when you die: return shotgun += diceRollResults['shotgun'] rolls += 1
def turn(self, gameState): results = zombiedice.roll() brains = 0 shotguns = 0 while results: brains += results['brains'] shotguns += results['shotgun'] if shotguns <= brains: results = zombiedice.roll() else: break
def turn(self, gameState): dice_roll_results = zombiedice.roll() # first roll brain_count = 0 while dice_roll_results is not None: # Add number of brains collected from roll brain_count += dice_roll_results['brains'] if brain_count < 2: dice_roll_results = zombiedice.roll() # roll again else: break
def turn(self, gameState): diceRollResults = zombiedice.roll() roll = [1, 2, 3, 4] rolls = random.choice(roll) shotguns = 0 for i in range(rolls): shotguns += diceRollResults['shotgun'] if shotguns < 2: diceRollResults = zombiedice.roll() else: break