Rich forager - infinite loop?


#1

My code stops halfway through. Could anyone give me a hint what could be the issue here?

while True:
    flag = hero.findFlag()
    enemy = hero.findNearestEnemy()
    item = hero.findNearestItem()
    if flag:
        hero.moveXY(flag.pos.x, flag.pos.y)
        hero.pickUpFlag(flag)
    elif enemy:
        if self.isReady("cleave"):
            hero.cleave(enemy)
        else:
            hero.attack(enemy)
    elif item:
        hero.moveXY(item.pos.x, item.pos.y)

#2

There doesn’t appear to be anything wrong with the code as far as I can tell. Maybe elif is causing issues?


#3

I changed the browser from FF to Chrome and it finally worked without any problems. Case closed. Thanks!