Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] Help with Guess my number

# 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
        # Make your next attempt and say it.


whats wrong? :crying_cat_face:


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


Never mind i figured it out


Congrats on figuring out yourself. :hugs: