Desert Mine Sweep

When I get the last coin in MineSweep, I don’t get victory

Hiya!

You need to make it all the way across the board to the oasis as well. Good luck!

Thx for the tip I need some help though. Here’s my code so far:

loop:
    item = self.findNearestItem()
    

     if item:
        pos = item.pos
        itemx = item.pos.x
        itemy = item.pos.y
        self.moveXY(itemx, itemy)
        x = self.pos.x - 10
        y = self.pos.y
        self.moveXY(x, y)
        self.say("heal me")

You are not checking your health anywhere. the default code shows you how to figure out your healththreshold.

once you have that your main script (pseudo code) should be similar to this.

if (health < threshold) then step back 10 and say heal me else if item move to item else move to the right (or just movexy to the end of the map.

i tried the else thing
and it doesn’t work

Post your code them. because the first code you posted isnt even remotely close to what it’s supposed to be :slight_smile:

Also if you post a screenshot of where you and the peasants are at where you don’t get victory, maybe I can figure out what is going wrong.

I had a similar issue at first on that one…

What qualifies as “the oasis” is further to the right than the last coin. This means if you have a loop that just does { coin -> heal } repeat; You never get there.

The level probably wants the last coin in the oasis so the really young coders don’t need to figure out how to special case the situation. If you are a bit further along, think about the “if” check on an item and what you can do when “if item” returns false.

you need to move further towards the palm trees to win.

Ah, thanks guys–I see that the goal trigger too far over. I’ve made it humongous, so it should be much easier to get all the peasants onto it even without moving right forever.