I know what they are trying to get me to do here, but i just can’t figure out the code…
Or at least, not without help
Honestly why make a level when you don’t bother giving us any hints to help solve it?
Maybe it’s because it’s in the end of the game, idk.
Here’s my code
// Welcome to Gridmancer!
// A relic of days long past, the puzzle returns!
// Your task is to collect all the coins.
// You are given special methods to help with hero task.
// hero.addRect(x, y, w, h) places a rectangle to collect coins.
// hero.removeRect(x, y) removes a previously added rectangle at the point.
// hero.navGrid is (basically) a 2-dimensional array containing "Coin" or "Wall"
// You must collect all coins under rectangles
// Rectangles cannot collide with themselves or walls
// You need to make at most 55 rectangles to beat hero level!
var grid = hero.navGrid;
function addRect(i){
var yes = "Coin";
var no = "Wall";
var row = i;
var y = i;
var w = 0;
for (var col = 0; col <= grid[row].length; col++){
var pos = grid[row][col];
if (pos == yes) {
var x = col;
w++;
continue;
} else if (pos == no){
hero.addRect(x,y,w,1);
w = 0;
continue;
}
}
}
for (var i = 0; i < grid.length; i++){
addRect(i);
hero.wait(1);
}
Much needed help required here. High iq probably required (Which i probably don’t have)
Thanks in advance
Riley