Orge Gorge Gouger Help


#1

Could anyone tell me why this code works

    while self.now() < 20: 
    self.say("message")
    while self.gold < 60:
        item = self.findNearest(self.findItems())
        coins = self.findItems()
        coinIndex = 0
        while coinIndex < len(coins):
            coin = coins[coinIndex]
            if coin.value > 1:
                self.moveXY(coin.pos.x, coin.pos.y)
            coinIndex += 1
    
    while self.pos.x > 16:
        self.move({'x': 15, 'y': 38})
        
    self.buildXY("fence", 21, 37)    

while this code doesn’t

    while self.now() < 20: 
    
        while self.gold < 60:
            item = self.findNearest(self.findItems())
            coins = self.findItems()
            coinIndex = 0
            while coinIndex < len(coins):
                coin = coins[coinIndex]
                if coin.value > 1:
                    self.moveXY(coin.pos.x, coin.pos.y)                
                coinIndex += 1
    
    while self.pos.x > 16:
        self.move({'x': 15, 'y': 38})
        
    self.buildXY("fence", 21, 37)    

For some reason the self.say makes it work. why is this


#2

Please read the FAQ, so that your code is properly formatted. I added the ```s to your post but your formatting looks wrong, please check and fix it.


#3

Well, what happens when you run the first code? What happens when you run the second?


#4

The second code has no visible affect on the hero


#5

Are there any errors that come out when you run it?


#6

So my code works but it isn’t good enough to get the 60 coin bonus. Is it okay to post my code? Can anyone help me with this?


#7

Really, the only thing you can do at this point is to find a better coin collecting function, and maybe increase your speed.


#8

right now im using the compound boots which are the fastest availible. my coin collecting function finds the highest value coin and if its less than 15 distance it will go to that coin, otherwise it will just go to the closest. the most coins ive been able to get is like 43. any suggestions?


#9

I tried the first code (the working one) and it said that i needed a string to build a fire-trap, bear-trap, decoy, or arrow-tower. Any suggestions? Solutions?


#10

If you have the Stone Builder’s Hammer, it can’t build fences. Only the wooden ones can do so.


#11

Yeah, I figured that out, like, 20 minutes after I posted the question. XD Thanks anyway, though!