Useful Competitors - unbeatable


#1

Hey!
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":
            hero.attack(enemy)
    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)
        pass

#2

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


#3

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


#4

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


#5

Can you give me a screenshot?


#6

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.


#7

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


#8

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


#9

How about try resubmitting a few more time?


#10

Doesn’t make a difference,


#11

What item do you got equip?


#12

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?


#13

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

I am also testing out new ways.


#14

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.


#15

Ah, next time I should spend more time shopping.
Thanks!


#16

Hi,
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.

Maka