Stuck on Shine Getter


I don’t get it. Tharin goes but he doesn’t collect coins fast enough. Here is my code.

To grab the most gold quickly, just go after gold coins.

coins = self.findItems()
coinIndex = 0

# Wrap this into a loop that iterates over all coins.

coin = coins[coinIndex]
# Gold coins are worth 3.
if coin.value == 3:
    # Only pick up gold coins.
    coins = self.findItems()
    coinIndex = 0
    coinIndex = coinIndex + 1


do: self.moveXY(coin.pos.x, coin.pos.y) instead of self.move(coin.pos)


I fixed it. I needed a while len(coins) > coinIndex: before the coin = coins[coinIndex].


Oh yeah, i forgot about the while loop.