Serpent Savings - code issue?

The yellow duck keeps on saying this:

Screenshot 2023-02-03 4.45.13 PM

My code:

# You cannot collect coins.
# Summon peasants to collect coins for you.
# Collecting coins spawns a growing 'tail' behind the peasants.
# When a peasant touches a tail, they are destroyed.
# Collect 200 gold to pass the level.
# The following APIs are available on your team's peasants: "snakeBackward"
# The following APIs are available on neutral peasants: "snakeBackward", "snakeHead", "snakeForward"


while True:
    friends = hero.findFriends()
    tails = hero.findEnemies()
    coins = hero.findItems()
    for friend in friends:
        # Command the peasant to collect a coin, while avoiding the tails.
        if hero.canCast("haste", friend):
            hero.cast("haste", friend)
        elif hero.isReady("reset-cooldown") and not friend.hasEffect("haste"):
            hero.resetCooldown("haste")
        hero.command(friend, "move", friend.findNearest(coins).pos);

Hm, works fine for me…
Can you show us your gear, please?

You can’t check friend’s effect

You need to checks if theres item

My gear:

Screenshot 2023-02-03 10.46.45 PM

It still says this:

Because your hero can’t reset cooldown

And your hero can’t cast haste

Collect items:

items = hero.findItems()
for item in items:
    hero.command(friend, "move", item.pos)

The problem is that you aren’t using a wizard. You can’t cast haste unless you have an elemental codex (idk which one), which you can only equip to a wizard. Try using Hushbaum or Pender if you don’t have any of the more costly wizards.

-Marmite

All wizards
20chars is annoying

I have no wizards and I can’t see any wizards to buy in the first place, is it because i’m using a student account?

Hm, maybe.
The code would also work without Haste though so if you remove that you should be able to complete the level.

I took your advice and it still says “Ran out of time”, I also submitted it a few times but it didn’t work:

Try what i said in post

Also, let the peasant dodge

How to collect items

When I use your item collection code, the peasant avoids the coins.

You should command peasants to dodge from enemy peasants, collect coins

You need to learn how to dodge