Resource Valleys [level help]

we should probably take this to a PM

1 Like

now it says this

# Collect all the coins!

def commandPeasant(peasant, coins):
    # Find the nearest coin to the `peasant` from the `coins` array,
    for peasant in peasants:
        if peasant:
            coins = peasant.findItems()
            if coins:
                for coin in coins:
                    if coin:
                        hero.command(peasant, "move", coin.pos)
       
    pass

friends = hero.findFriends()
peasants = {
    "Aurum": friends[0],
    "Argentum": friends[1],
    "Cuprum": friends[2]
}

while True:
    items = hero.findItems()
    goldCoins = []
    silverCoins = []
    bronzeCoins = []
    
    for item in items:
        if item.value == 3:
            goldCoins.append(item)
        # Put bronze and silver coins in their approriate array:
        if item.value == 2:
            silverCoins.append(item)
        if item.value == 1:
            bronzeCoins.append(item)
    
    commandPeasant(peasants.Aurum, goldCoins)
    commandPeasant(peasants.Argentum, silverCoins)
    commandPeasant(peasants.Cuprum, bronzeCoins)

image

You don’t need this.

now it says image

Remove that and you should be good.

now all my minions move together and one gets hit by a yak

@Jake_Doggy Can you send me the link to the level?
Lydia

i’m on glacier and i’ve never seen it except when i do javascript

codecombat.com/play/level/resource-valleys?

Thanks.
Lydia
20 char