Board Thread:General Discussion/@comment-15419758-20150504054301


 * 1) Copy the code below into notepad
 * 2) Save as a .html
 * 3) Open in your web browser
 * 4) Enjoy the random map!

 var abc = document.getElementById("abc").getContext("2d"); function render(color,xpos,ypos,xsize,ysize){ abc.fillStyle = color; abc.fillRect(xpos,ypos,xsize,ysize); } var tilesize = 10;   //tilesize can be any factor of 500 var TILES = 500/tilesize; var colors = ['#00FF00','#0000FF']; var rand = Math.floor(Math.random*colors.length); var randcolor = colors[rand]; function randomcolor{ rand = Math.floor(Math.random*colors.length); randcolor = colors[rand]; return randcolor; } var xtilepos = 0; var ytilepos = 0; for(i1=0;i1<=TILES;i1++){ xtilepos = 0; for(i2=0;i2<=TILES;i2++){ render(randomcolor,xtilepos,ytilepos,tilesize,tilesize); xtilepos = xtilepos + tilesize; }    ytilepos = ytilepos + tilesize; }  