[SOLVED] Grid Minefield Help CodeCombat

Hello, I didn’t find the solution. Do you have the solution ?

Thank you
:wink:

Sorry, but I’m afraid we don’t give solutions on this forum as it defeats the point of the game entirely,
We can help you get your code right though, post your code into the discourse as the forum FAQ - Check Before Posting says and say what’s happening and what you can’t do / understand. Thanks! :grin:

Yes, I have a problem with my code.
I feel that everything is good.
But it doesn’t work.
Can you help me ?

for (var x = 12; x < 12 + 8 * 6; x += 8) {
  
    for (var y = 12; y < 12 + 8 * 7; y += 8) {
        
        hero.buildXY("fire-trap", x, y);     
    }
    
    hero.moveXY(hero.pos.x +8, hero.pos.y);
}


while (true) {
    var enemy = hero.findNearestEnemy();
    if (enemy && hero.distanceTo(enemy) <= 20) {
        hero.moveXY(x, y);
    } 
}

Yeah, I’ll try, I normally do python but I think I can help you.
I’ll just work out what the problem is.

All you need to change is:

to : hero.moveXY(52, 51) so you blow up the ogres.

1 Like

Thank you very much for your help.

You are the best :wink:

1 Like

That’s fine, sorry for the delay. :grin: