[SOLVED] Hunting Party help (Python)

or @Deadpool198 what about you?

Sure…pls post a fresh copy of your code. And you are right about the indent…looking at the pick, it was not obvious that the last line wrapped…it looked like an indent.

# You can use findNearestEnemy() on your soldiers to get their nearest enemy instead of yours.
while True:
    friends = hero.findFriends()
    # Use for-loop and for each friend:
    for friend in friends:
        # If they see an enemy then command to attack.
        if enemy = friend.findNearestEnemy():
            hero.command(friend, "attack", enemy)
        # Command to move east by small steps.
        else:
            hero.command(friend, "move", {ā€œxā€: friend.pos.x + 1, ā€œyā€: friend.pos.y})

what does this mean?

Try to put this before the if statement and only check if enemy.

Andrei

ok so my troops are moving :partying_face: but they just keep going to the left :cry:

and dont attack at all

Can I see the code?

Andrei

# You can use findNearestEnemy() on your soldiers to get their nearest enemy instead of yours.
while True:
    friends = hero.findFriends()
    # Use for-loop and for each friend:
    for friend in friends:
        # If they see an enemy then command to attack.
        enemy = hero.findNearestEnemy()
        if enemy:
            hero.command(friend, "attack", enemy)
        # Command to move east by small steps.
        else:
            hero.command(friend, "move", {"x": friend.pos.x + 1, "y": friend.pos.y})

and its a little laggy

Here put friend instead of hero.

Andrei

:partying_face: :partying_face: (sorry couldnt help but put 2 emojis) now im just wondering how to et the bonus

Just put instead of 1 a lower number (like 0.27).

Andrei

how do you blur something out? like you did?

im confused on that but, on the bright side i got the bonus!!!

No. I will explain that to you in a PM. And congratulations for completing the level and the bonus! :partying_face:

Andrei

ok and thanks! and thanks to you to @dedreous

Andrei, be sure to cover the ā€˜badge’ too :wink:

quick question, why does a text like this need to be 20 characters?

To prevent people from spamming.

Andrei