# You need to guess the number from 1 to 999 (0 < n < 1000). # You have 10 attempts! # For each attempt Riddler will say if the number is less or greater. # If the guessed number is less than your try, then a munchkin ogre appears. # Else a scout ogre appears. lowestPossible = 1 highestPossible = 999 word = (lowestPossible+highestPossible) / 2 while True: # You need to defeat the enemy before the next attempt. enemy = hero.findNearest(hero.findEnemies()) if enemy: # "scout" is 'greater', "munchkin" is less. # Prepare for the next attempt and wipe out the ogre. if enemy.type == "scout": highestPossible = word word = (word + lowestPossible)/2 if enemy.type == "munchkin": lowestPossible = word word = (word+highestPossible)/2 hero.attack(enemy) else: # Make your next attempt and say it. hero.say(word)
Never mind i figured it out
Congrats on figuring out yourself.