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

while (true) {
    var 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.

Udało się przejść to ćwiczenie - codecombat wyświetla SUIKCES

ale jednocześnie raportuje BŁĄD ale w części która nie była przez nas edytowana - możliwe że wynika to z kodu który powinien być inny

// Our wizards teleport ogres from their camp here.
// They appear for a short period and they are stunned.
// Attack only weak and near ogres.

while (true) {
    var enemy = hero.findNearestEnemy();
    var distance = hero.distanceTo(enemy);
    // If enemy.type is "munchkin"

// Defeat munchkins, collect coins. Everything as usual.
// Use AND to check existence and type in one statement.

while (true) {
    var enemy = hero.findNearestEnemy();
    // With AND, the type is only checked if enemy exists.
    if (enemy && enemy.type == "munchkin") {
        hero.attack(enemy);
    }

// Nie martw sie o małe i średnie ogry.
// Twoimi celami są typy "brawler".
// Kiedy awanturnik (brawler) jest bliżej niż 50metrów , odpal artylerię.

while (true) {
    // Znajdź najbliższego wroga i zmież dystans do niego.
    var enemy = hero.findNearestEnemy();
    var distance = hero.distanceTo(enemy);

// Nie obrażaj  plemienia przyjaznych ogrów.

while(true) {
    var item = hero.findNearestItem();
    if(item) {
        // jeśli przedmiot nie jest Równy "klejnot"
        if(item.type != "gem") {
            // Wtedy podfążaj za swoim  oswojonym  wilkiem.
            hero.moveXY(pet.pos.x, pet.pos.y);
        }

// Uzyskaj dwie sekretne wartości true/false od czarodzieja.
// Sprawdź poradnik dla uwag dotyczących pisania logicznych wyrażeń.
hero.moveXY(14, 24);
var secretA = hero.findNearestFriend().getSecretA();
var secretB = hero.findNearestFriend().getSecretB();

// Jeśli OBA secretA i secretB są true, wybierz górną ścieżkę; w przeciwnym wypadku wybierz dolną ścieżkę.
var secretC = secretA && secretB;
if (secretC)
    hero.moveXY(20, 33);

// The coin field has been seeded with vials of deadly poison.
// Ogres are attacking, while their peons are trying to steal your coins!
while(true) {
    var enemy = hero.findNearestEnemy();
    if(enemy) {
        // Attack the enemy only if the type is NOT equal to "peon".
        if(enemy.type != "peon") {
            hero.attack(enemy);
        }
    }