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

[Adventurer] Wise Moves

ok i am going to try it again

rly u try it it doesnt work

I was able to defeat the brawler, but didn’t pass the level. I triggered the decoys anytime he passed x:65 and had the gold. I only used two of the three moves though. Wasn’t sure if using all three was a requirement.

1 Like

There is changed version - the trees are leafless and the level can be finished. I’m not sure if there still aren’t freezes with right code - i deleted my first version of the code i thought as correct.
There’s not a table with player achievements

to check my progress used this code:

            console.log("\nenemy name: " + enemy.id + 
                            "\nposition: " + enemy.pos +
                            "\nhealth: " + enemy.health + 
                            "\ntime passed: " +  hero.time );

output:
enemy name: Grognar
position: {x: 53.74, y: 35.14, z: 2.00}
health: 0
time passed: 44.53333333333333

I think the level execution must end when the goals are achieved.

Same code completes the level now. :grinning:

can you send me link?

It’s the same one: https://codecombat.com/play/level/wise-moves

still doesnt work do you need to use firefox?

it really doesnt work here is my code

while True:
    coin = hero.findNearestItem()
    if hero.gold >= 50:
        hero.moveXY(30, 50)
    elif coin:
        hero.moveXY(coin.pos.x, coin.pos.y)

Your code works, it just doesn’t complete the level. You need to mix up your strategy by attacking with archers or distracting with decoys.

Thanks everyone! Nick is planning to add this level to the campaign! It might take a while because Nick still has other tasks to do. :slight_smile:

ok
(20 characters and doritos i hope)

rly whyy doesnt it work here is my code

while True:
    coin = hero.findNearestItem()
    if hero.gold >= 50:
        hero.moveXY(30, 50)
    if hero.gold >= 75:
        hero.moveXY(30, 38)
    if hero.gold >= 100:
        hero.moveXY(30, 26)
    elif coin:
        hero.moveXY(coin.pos.x, coin.pos.y)

Since your first if statement is the lowest number, you will always run that code and not the other two. You need to think of a way to prevent the first if statement from running and save the gold for the other ones. Something like, if the ogre passes a certain mark, send a decoy, otherwise nail him with the lightning bolt or archers. Need enchanted lenses or twilight glasses to see the ogre from a good distance.

Also, I suggest switching your last moveXY() to a move() for the coin which will ensure you are chasing down the closest gold coin every step. Speed helps on this level too

i know but the level doesnt work when i stand on the button it doesnt work

You’re probably using the wrong coordinates.

what are the coordinates then?

Read the hints (20 chars)

i did and i put in the coordinates but it doesnt work

while True:
    coin = hero.findNearestItem()
    if hero.gold >= 100:
        hero.moveXY(30, 26)
    elif coin:
        hero.moveXY(coin.pos.x, coin.pos.y)

here is my code