(function(window, document, undefined) { 
    window.onload = init;
    function init() {
        //get the canvas
        var canvas = document.getElementById("mapcanvas");
        var c = canvas.getContext("2d");
        var width = 1280;
        var height = 720;
        var blockSize = 16;
        
        document.getElementById("paintbtn").onclick = paint;
        
        //paint the map
        function paint() {
            c.rect(width/2,height/2,90,90);
            for(var i = 0; i< 3; i++){
                for(var j = 0; j< 3; j++){
                    c.rect((width/2) + i*30, (height/2) + j*30, 30, 30);
                    c.stroke();
                }
            }
            
        }
    }
})(window, document, undefined);

@@ -359,32 +359,1271 @@
 paint;%0A        %0A
+        function createNext(updown, leftright, prevX, prevY)%7B%0A            switch(updown)%7B%0A                case up:%0A                    switch(leftright)%7B%0A                        case left:%0A                            //10, 11, 0, 1%0A                            break;%0A                        case right:%0A                            //1, 2, 3, 4%0A                            break;%0A                        default:%0A                        //0, 1, 2%0A                    %7D%0A                    break;%0A                case down:%0A                    switch(leftright)%7B%0A                        case left:%0A                            //7, 8, 9, 10%0A                            break;%0A                        case right:%0A                            //4, 5, 6, 7%0A                            break;%0A                        default:%0A                        //6, 7, 8%0A                    %7D%0A                    break;%0A                default:%0A                    switch(leftright)%7B%0A                        case left:%0A                            //9, 10, 11%0A                            break;%0A                        case right:%0A                            //3, 4, 5%0A                            break;%0A                    %7D%0A            %7D%0A        %7D%0A        %0A
         //paint 
@@ -1630,16 +1630,16 @@
 the map%0A
-
         
@@ -1898,32 +1898,32 @@
               %7D%0A
+
             %7D%0A  
@@ -1924,21 +1924,8 @@
   %7D%0A
-            %0A
     

Update script.js