Rich Forager (when submitted)

On Rich Forager I can’t finish the level because when I press submit I place the flags. After my 3rd flag it dose not want to continue the level. I try again. The same thing happens only with for the 7th. Can enyone help?

Code please @Xzanos(20 chars)

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

But it is not the code. It is when I submit then put down the flags is when the troubel starts

Ok I get it @Xzanos, change this code:

elif flag:
    self.moveXY(flag.pos.x, flag.pos.y)
    self.pickUpFlag(flag) 

to an if statement
and change this:

if enemy: 
    if self.isReady("cleave"):
        self.cleave(enemy)
    else:
        self.attack(enemy)

To an elif statement.

1 Like

Indentation error???

Do you know how to fix that @Xzanos?

all it say is Indentation error for this part of the code

    elif enemy: 
        if self.isReady("cleave"):
            self.cleave(enemy)
        else:
            self.attack(enemy)

I was just asking, do you know how to fix that.

no.
No I do not at all

can you take a screenshot of the code?

Change the elif to an if.

I did that but the same thing happen.

Change if enemy: to elif enemy:``

From the screenshot of your code I noticed that the elif enemy seemingly has an extra space after it as well as the loop and other elif. I am not sure what if that is the problem but it could effect the code. Also you do not need elifs unless using it as an else but with something after it.

if enemy:
     if self.isReady("cleave"):
          self.cleave(enemy)
elif item:
     self.moveXY(itemX, itemY)

So it could assume that the elif is an indention error when it should be if.

It is not the code it is the game

It just stops in the middle of the submit

I just tryed to use java script. It did not work.

FYI it is not J.S (20 chars)

But no matter what I do the game freezes but animations are still going and it is not the code, it is codecombat.

1 Like