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

Ogre Gorge Gouger #191

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

# You only have 20 seconds until the ogre horde arrives!
# Grab as much gold as you can, then retreat to your base and wall it off!
while (hero.time < 20) or (hero.gold<60):
    # Collect coins
    hero.say("I should pick up a coin")
    items = hero.findItems()
    for item in items:
        if item.value==3 or item.value==2:
            hero.moveXY(item.pos.x,item.pos.y)

# Build a fence to keep the ogres out.
while hero.time>22:
    hero.moveXY(15,37)
    hero.buildXY("fence",21,38)