Level Mountain mercenaries error


#1

Hello!

I have this error in python solution:
Error Cannot read property ‘start’ of undefined

This is my code on this level:

def bestValue(item):
    return item.value / hero.distanceTo(pet.fetch(item)

def findGoodItem(items):
    g_item = items[0]
    for item in items:
        if BestValue(item)>BestValue(g_item):
            g_item = item
    return g_item


while True:
    item = findGoodItem(hero.findItems())
    hero.move(item)

    if hero.gold > hero.costOf("soldier"):
        hero.summon("soldier")

    enemy = hero.findNearest(hero.findEnemies())
    if enemy:
        soldiers = hero.findFriends()
        for soldier in soldiers:
            hero.command(soldier, "attack", enemy

        while enemy.health>0:
            hero.attack(enemy)

#2

return item.value / hero.distanceTo(pet.fetch(item)
odd number of brackets?


#3

Thank you, It’s help!)


#4

(Solution removed)

New code!


#5

Please do not post working code/solutions. The purpose of this board is to help people learn and simply providing/posting completed solutions is counterproductive to that goal. Thank you.