[SOLVED] Help with Guess my number


#1
# 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)


#2

whats wrong? :crying_cat_face:


#3

@Chaboi_3000 @Gamestack @Seojin_Roy_Lee could you guys help me pls. I don’t know what is wrong.


#4

Never mind i figured it out


#5

Congrats on figuring out yourself. :hugs: