Useful Competitors - unbeatable

I resubmit my code 5k times and still nothing. It either defeats all of the ogres or gathers all of the coins. I use:

while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        if enemy.type != "peon":
    item = hero.findNearestItem()
    if item:
        # Gather the item only if the type is NOT equal to "poison".
        if item.type != "poison":
            hero.moveXY(item.pos.x, item.pos.y)

Try combining the two code together like this if item and item.type != "poison":.


Thanks for the help but unfortunately, that did not help… );

1 Like

I think this is definite bug you need @nick, @Serg or @Bryukh .

1 Like

Can you give me a screenshot?

1 Like

So I’ve edited the code, so that my hero gathers all of the coins, however the peon at the end cannot reach the poison in time.

1 Like

I don’t think you need if hero.distanceTo(enemy) < 5. If that didn’t help try resubmitting a few more time.

1 Like

That distanceTo code does almost nothing, except from how my testing revealed, it brung the peon closer to the poison.

1 Like

How about try resubmitting a few more time?

1 Like

Doesn’t make a difference,

What item do you got equip?

Could you say your codecombat nickname? I’ll try to investigate your case. Also could you say which code (I see two - one in the first message and another one on the screenshot) you are using?

nickname: ignas04.
Both codes do not work but the main one I use is in the screenshot.

I am also testing out new ways.

Thanks. I see. There are two problems were: you used really slow boots. I’ve changed them for the simple boots. However, there can be “bad seed” too. Sorry, I’ve completed the level with your account accidently.

I’ve added issues to prevent that case in future.

1 Like

Ah, next time I should spend more time shopping.

It’s not that you should spend more time shopping (though, do that too! :slight_smile: ) – it’s that you have to be aware of what you’re equipping.

If you put on slow boots, you might be too slow to complete something.

If you put on the speed ring, you might go too fast to do something else.

If you upgrade your sword, then your code that has two attacks in it might not work because your first attack defeats the enemy and the second one has nothing to hit.


1 Like

Thank you…for mine it worked