AlexeySapsay / Python_solution_CodeCombat_2018

In that repository I will post my sollution for codecombat.com games for study Python
1 stars 0 forks source link

Shine Getter(grab only gold coin) #158

Open AlexeySapsay opened 6 years ago

AlexeySapsay commented 6 years ago
# Follow me on youtube  channel Phy Tu
# Help with programming on Python, school math, physics
# https://www.youtube.com/channel/UCP5ycahCEZ24qmRRgNnko5Q

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

while True:
    coins = hero.findItems()
    coinIndex = 0

    # Wrap this into a loop that iterates over all coins.
    while coinIndex<len(coins):
        coin = coins[coinIndex]
    # Gold coins are worth 3.
        if coin.value == 3:
        # Only pick up gold coins.
            hero.moveXY(coin.pos.x,coin.pos.y)
            pass
        coinIndex+=1