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

Level Mountain mercenaries error



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())

    if > hero.costOf("soldier"):

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


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

1 Like

Thank you, It’s help!)


(Solution removed)

New code!


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.

1 Like