(function(window, document, undefined) { 
    window.onload = init;
    function init() {
        //get the canvas
        var canvas = document.getElementById("mapcanvas");
        var c = canvas.getContext("2d");
        var cwidth = 960;
        var cheight = 540;
        document.getElementById("paintbtn").onclick = paint;
        
        function reset(){
            c.clearRect ( 0 , 0 , canvas.width, canvas.height );
            c.beginPath();
        }
    
        function paint(){
            reset();
            
            var widthSelect = document.getElementById("width");
            var pathWidth = widthSelect.options[widthSelect.selectedIndex].value;
            
            var heightSelect = document.getElementById("height");
            var pathHeight = heightSelect.options[heightSelect.selectedIndex].value;
            
           //alert(pathWidth + ", " + pathHeight);
            
            for(var i = 0; i< pathWidth; i++){
                for(var j = 0; j< pathHeight; j++){
                    c.lineWidth = 1;
                    c.rect(i*30, j*30, 30, 30);
                    c.stroke();
                }
            }
        }
    }
})(window, document, undefined);

@@ -455,24 +455,264 @@
 ;%0A        %7D%0A
+        %0A        function createRoom(x, y, pw, ph)%7B%0A            var randw = Math.floor((Math.random() * pw/2 + 2) );%0A            var randh = Math.floor((Math.random() * ph/2 + 2) );%0A            %0A            return %5Brandw, randh%5D;%0A        %7D%0A
     %0A       
@@ -1246,24 +1246,396 @@
 ight; j++)%7B%0A
+                    var randRoom = Math.floor((Math.random() * 4));%0A                    if(randRoom %3C 1)%7B%0A                        roomDim = createRoom(i,j,pathWidth,pathHeight);%0A                        c.lineWidth = 3;%0A                        c.rect(i*30, j*30, roomDim%5B0%5D*30, roomDim%5B1%5D*30);%0A                        c.stroke();%0A                    %7D%0A                    %0A
             

Update script.js