Playing around with a simple step 1 solution to Gridmancer and the spell would not complete - it was stopping after drawing 51 rectangles.
I played with it a bit and noticed when I commented out the say it would successfully complete drawing 54 rectangles.
var grid = this.getNavGrid().grid;
for(var y = 0; y < grid.length - tileSize; y += tileSize)
{
for(var x = 0; x < grid[y].length - tileSize; x += tileSize)
{
if(grid[y][x].length === 0)
{
var newX = x + tileSize/2;
var newY = y + tileSize/2;
var newW = tileSize;
for (var x2 = x + tileSize; x2 < grid[y].length - tileSize; x2 += tileSize )
{
if(grid[y][x2].length > 0)
{
x = x2;
break;
}
newX += tileSize/2;
newW += tileSize;
}
this.addRect( newX, newY, newW );
//this.say ("("+ newX + "," + newY + "):" +newW);
this.wait();
}
}
}