# pętle while powtarzają kod tak długo, aż warunek nie stanie się fałszywy

ordersGiven = 0
while ordersGiven < 5:
    # Przesuń się w dół o 10 m i wydaj każdemu ze sprzymierzeńców rozkaz dołączenia do bitwy ("Attack!"). Oni usłyszą Cię tylko jeśli stoisz bezpośrenio przed nimi.
    hero.moveXY(hero.pos.x, hero.pos.y-10)
    # Order your ally to "Attack!" with hero.say
    # They can only hear you if you are on the X.
    hero.say("Attack!")

# Rescue the peasant from the bandits and return her to the village.
# Choose the path that suits you, avoiding patrols or facing them head on.
# Potions will grant random effects–some good, some bad.
# Feeling brave? Bonus if you can loot the ogre treasure chest.
item = self.findItems()
enemies = self.findEnemies()
flag = hero.findFlag("green")
while True:
    enemy = self.findNearest(self.findEnemies())
    item = self.findNearest(self.findItems())

# Certain coins and gems attract lightning.
# The hero should only grab silver coins and blue gems.

while True:
    item = hero.findNearestItem()
    # A silver coin has a value of 2.
    # Collect if item.type is equal to "coin"
    # AND item.value is equal to 2.

# Duże ogry nie zobaczą cie w lesie.
# Atakuj tylko male ogry w lesie.
# Zbierz tylko monety i klejnoty.
# Nie opuszczaj lasu i nie jedz,pij niczego.

while True:
    # Znajdź najbliższego wroga.
    enemy = hero.findNearestEnemy()
    # Atakuj tylo wtedy gdy typ to "thrower" albo "munchkin" .
    if enemy.type== "thrower" or enemy.type == "munchkin":
        hero.attack(enemy)