Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

"Long-Range Division" is impossible - hostage dies


So I’ve gotten to the level “Long-Range Division”, and there is a problem. One of the level’s goals is that the hostage must survive, but whatever I do, the ogres kill him. According to other threads, my code is correct, but when I approach the two ogres, they immediately kill the hostage before I can fight them. Any ideas on what to do?

Here is my code:


Use say to call out the range to the mines.

Use division to calculate the range.

enemy = hero.findNearestEnemy()
distanceToEnemy = hero.distanceTo(enemy)

Say first Range: distanceToEnemy divided by 3


Say second range: distanceToEnemy divided by 1.5


Say these things for motivation. Really. Trust us.

hero.say(“Woo hoo!”)
hero.say(“Here we go!”)

Now, use a while-true loop to attack the enemies.

while True:
enemy = hero.findNearestEnemy()
if enemy:


Try equipping your hero with faster boots and the Speed Ring, if necessary. If you are a subscriber, try using a faster hero like Pender.


Hi there,
We made a few changes to the way CodeCombat runs, and it has made some older levels behave in slightly strange ways.

For example, on this level, it made the ogres attack the hostage before any warriors got close enough to fight.

Our good friend Bryukh has already fixed this, but there may be more out there. Please keep letting us know if you see something strange.

Please hide your code, @Enderhippo – we try not to have successful code on the forums.



Thank you so much! (the code is hidden now as well)