Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Rich forager - infinite loop?


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)
    elif enemy:
        if self.isReady("cleave"):
    elif item:
        hero.moveXY(item.pos.x, item.pos.y)


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


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