(function(window, document, undefined) { 
    window.onload = init;
    function init() {
        //get the canvas
        var canvas = document.getElementById("mapcanvas");
        var c = canvas.getContext("2d");
        var width = 512;
        var height = 288;
        var blockSize = 16;
    
        document.getElementById("startbtn").onclick = paintscreen;
        
        //paint a block
        function paintblock(x, y) {
            for(var i = 0; i < blockSize; i++) {
                for(var j = 0; j< blockSize; j++) {
                    if(i == 0 || i == blockSize -1){
                        c.fillStyle = "#000000";
                        c.fillRect(x+i, y+j, 1, 1);
                    }
                    if(j == 0 || j == blockSize -1){
                        c.fillStyle = "#000000";
                        c.fillRect(x+i, y+j, 1, 1);
                        
                    }
                    
                }
            }
        }
        
        //paint the screen
        function paintscreen() {
            for(var i = 0; i< 32; i++) {
                for(var j = 0; j < 18; j++) {
                    paintblock(i*blockSize, j*blockSize);
                }
            }
        }
        
        
    }
})(window, document, undefined);

@@ -583,157 +583,12 @@
 e -1
-)%7B%0A                        c.fillStyle = %22#000000%22;%0A                        c.fillRect(x+i, y+j, 1, 1);%0A                    %7D%0A                    if(
+ %7C%7C 
 j ==
@@ -718,33 +718,8 @@
 1);%0A
-                        %0A
     
@@ -740,29 +740,8 @@
   %7D%0A
-                    %0A
     
@@ -926,32 +926,144 @@
  j %3C 18; j++) %7B%0A
+                    if(i ==0 %7C%7C i==1 %7C%7C i == 32-1 %7C%7C i = 32 -2 %7C%7C j ==0 %7C%7C j==1 %7C%7C j == 18-1 %7C%7C j = 18 -2)%7B%0A    
                 

Update script.js