// Użyj ognistych pułapek by pokonać ogry atakujące Fabrykę.

while(true) {
    var enemy = hero.findNearestEnemy();
    if(enemy) {
        // If the enemy is to the left of the hero:
        if(enemy.pos.x < hero.pos.x) {
            // Jeśli przeciwnik znajduje się po lewej, zbuduj  ognistą pułapkę po lewej.
            hero.buildXY("fire-trap", 25, 34);
        // If the enemy is to the right of the hero:
        } else if (enemy.pos.x > hero.pos.x) {

Ważne żeby bohater mógł wybudować FENCE - bo my zrobiliśmy dobry kod ale nasz bohater miał zły MŁOTEK i nie mógł wybudować FENCE (użyjcie tego z lochu Kidhgarda)

// Get the hero and the peasant to the south.

// The function move your hero down along the center line.
function moveDownCenter() {
    var x = 40;
    var y = hero.pos.y - 12;
    hero.moveXY(x, y);
}

// The function build a fence on the right of something.
function buildRightOf(something) {
    // buildXY a "fence" 20 meters to something's right.
    hero.buildXY("fence", something.pos.x + 20, something.pos.y);
}

// Move right, to the oasis.
// Build a "fence" above or below when you see a yak.

while(true) {
    var yak = hero.findNearestEnemy();
    if (yak) {
        // If yak.pos.y is greater than hero.pos.y
        if(yak.pos.y > hero.pos.y) {
        
            // buildXY a "fence" 10m below the yak
            hero.buildXY("fence", yak.pos.x, yak.pos.y-10);
            

// Stań pomiędzy chłopem i wieżą wroga.

while(true) {
    var enemy = hero.findNearestEnemy();
    var friend = hero.findNearestFriend();
    // Wylicz współrzędną X, dodając do siebie friend.pos.x oraz enemy.pos.x
    // Teraz podziel przez 2.
    // Sprawdź PODPOWIEDZI, jeśli potrzebujesz pomocy!