Cannot complete "Misty Island Mine" even with solution from video


Cannot completed “Misty Island Mine”.

Got error

My solution:

def findBestItem(friend, excludeItems):
    items = friend.findItems()
    bestItem = None
    bestItemValue = 0
    for item in items:
        if item in excludeItems:
        value = item.value / friend.distanceTo(item)
        if value > bestItemValue:
            bestItemValue = value
            bestItem = item
    return bestItem

while True:
    peasants = hero.findByType("peasant")
    claimedItems = []
    for peasant in peasants:
        nearest = peasant.findNearestEnemy()
        if nearest and peasant.distanceTo(nearest) < 15 and == peasant:
            if >= peasant.costOf("decoy"):
                self.command(peasant, "buildXY", "decoy", peasant.pos.x - 2, peasant.pos.y)
            item = findBestItem(peasant, claimedItems)
            if item:
                hero.command(peasant, "move", item.pos)


What kind of error did you receve, and what particularly not working about your code?


Line 12: TypeError: Can’t read protected property: hasOwnProperty.

Error points on following line:

if item in excludeItems:


Probably an Esper bug.
/cc @nick @rob


I tried using the code and messing with it, but always get the same error, as well as an invoke bookmark function. I susspect you are running in to the same problme as I have recently.



Should be fixed now with the latest interpreter version! Let me know if you are seeing any more problems.


I still get Error: Attempt to invoke bookmark for [Funciton]. I dont know if that is what got fixed. Where hero.say(histList.join(', ')) works, but hero.say(histList) calls up the error.