-
Notifications
You must be signed in to change notification settings - Fork 5
/
min.html
1 lines (1 loc) · 43.8 KB
/
min.html
1
<!DOCTYPE html><html lang=en><head><meta charset=UTF-8><title>Laser 0.3</title><meta name=description content=""><meta name=viewport content="width=device-width, initial-scale=1.0, user-scalable=no"><style>@font-face{font-family:'icons';src:url("css/fonts/icons.eot");src:url("css/fonts/icons.eot?#iefix") format("embedded-opentype"),url("css/fonts/icons.woff") format("woff"),url("css/fonts/icons.ttf") format("truetype"),url("css/fonts/icons.svg#icons") format("svg");font-weight:normal;font-style:normal}[data-icon]:before{font-family:'icons';content:attr(data-icon);speak:none;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased}.icon-cog,.icon-question-sign,.icon-info-sign,.icon-tasks,.icon-remove,.icon-volume-off,.icon-volume-down,.icon-volume-up,.icon-caret-left,.icon-caret-right{font-family:'icons';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased}.icon-cog:before{content:"\e000"}.icon-question-sign:before{content:"\e001"}.icon-info-sign:before{content:"\e002"}.icon-tasks:before{content:"\e003"}.icon-remove:before{content:"\e004"}.icon-volume-off:before{content:"\e005"}.icon-volume-down:before{content:"\e006"}.icon-volume-up:before{content:"\e007"}.icon-caret-left:before{content:"\e008"}.icon-caret-right:before{content:"\e009"}*,*:after,*:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html,body{height:100%}body{background:#999;color:#FFF;font-family:Arial,sans-serif;line-height:1.4;margin:0}.game-wrapper{font-size:0;text-align:center}.game{display:inline-block;margin:0;position:relative;-webkit-user-select:none;-moz-user-select:none}canvas{display:block}.game-clone{left:0;position:absolute;top:0;z-index:-1}.layer-bg{background:#AAA}.header{background:#000;border-bottom:1px solid #CCC;font-size:0}.header ul{padding:0;text-align:center}.header li{display:inline-block;vertical-align:middle}.header a{color:#FFF;display:block;font-size:0;line-height:1.4;padding:16px 15px;text-decoration:none}.header a:hover,.header a:focus,.header a:active,.header a.selected{background:#444}.header i{font-size:1rem;line-height:inherit}.header .level-nav-button{border-radius:5px;display:inline-block;font-size:0;padding:0}.header .level-nav-button i{display:inline-block;font-size:1.5rem;padding:0 15px}.header .level-nav-button.disabled{color:rgba(255,255,255,0.2)}.header .level-nav-button.disabled:hover,.header .level-nav-button.disabled:focus,.header .level-nav-button.disabled:active{background:transparent}.level-title{cursor:pointer;font-size:.8rem;font-weight:bold}.level-title:hover,.level-title:focus,.level-title:active{background:#444}.menu-content{background:rgba(0,0,0,0.7);bottom:0;display:none;font-size:1rem;left:0;overflow:auto;padding:.5em;position:absolute;right:0;top:3.45rem;z-index:2}.overlay-show{display:block}.l1,.l2{display:table;list-style:none;margin:0;padding:0;width:100%}.l1>li{display:table-row;padding:1px 0}.l1>li>*{padding:1px 0}.l1-title{display:table-cell;padding-right:1em !important;vertical-align:middle;width:1px;white-space:nowrap}.l2 li{display:table-cell;padding:0 0 0 1px;width:10%}.l2 a{background:#FFF;color:#000;display:block;font-size:.8rem;line-height:3;padding:0;text-align:center;text-decoration:none}.l2 a:hover,.l2 a:focus,.l2 a:active{background:#CCC}.main{position:relative}.victory{background:rgba(0,0,0,0.7);bottom:0;left:0;opacity:0;position:absolute;right:0;text-align:center;top:0;z-index:-1;display:flex;align-items:center;justify-content:center}.victory.show{-webkit-animation:victory 4s 1;-o-animation:victory 4s 1;animation:victory 4s 1}@-webkit-keyframes victory{0{opacity:0;z-index:-1}60%{opacity:1;z-index:2}100%{opacity:0;z-index:-1}}@-o-keyframes victory{0{opacity:0;z-index:-1}60%{opacity:1;z-index:2}100%{opacity:0;z-index:-1}}@keyframes victory{0{opacity:0;z-index:-1}60%{opacity:1;z-index:2}100%{opacity:0;z-index:-1}}#solution{bottom:auto}#solution.show{display:block}#level-solution{font-size:inherit}.level-done{background:green !important}@media(min-width:320px){.header .level-nav-button{padding:1em .5em}.header .level-nav-button i{font-size:2.5rem}.level-title{font-size:1rem;padding:1em .5em}}@media(min-width:380px){.header a{font-size:1rem;padding:1em .5em}.header i{padding-right:.5em}.l2 a{padding:0}}</style><script>var $=document.querySelectorAll.bind(document);var $$=document.querySelector.bind(document);Element.prototype.on=Element.prototype.addEventListener;function hasClass(b,a){if(b){return b.className.match(new RegExp("(\\s|^)"+a+"(\\s|$)"))}}function addClass(b,a){if(b){if(!hasClass(b,a)){b.className+=" "+a}}}function removeClass(c,a){if(c){if(hasClass(c,a)){var b=new RegExp("(\\s|^)"+a+"(\\s|$)");c.className=c.className.replace(b,"")}}}function hexToRgb(e){var d,c,a;if(e.length===7){d=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;a=d.exec(e)}else{if(e.length===4){d=/^#?([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})$/i;c=d.exec(e);a=[];for(var b=1;b<=c.length;b++){a[b]=c[b]+c[b]}}else{return false}}return a?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:false}function rgb(c){var b=hexToRgb(c),a="";if(b){a="rgb("+b.r+", "+b.g+", "+b.b+")"}return a}function rgba(e,b){var d=hexToRgb(e),c="";if(d){c="rgba("+d.r+", "+d.g+", "+d.b+", "+b+")"}return c}function isEven(a){if(a%2===0){return true}return false}function prev(a){if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}};function mouseTarget(b){var a;if(!b){var b=window.event}if(b.target){a=b.target}else{if(b.srcElement){a=b.srcElement}}if(a.nodeType==3){a=a.parentNode}return a}function mousePositionDocument(c){var a=0;var d=0;if(!c){var c=window.event}if(c.changedTouches){var b=c.changedTouches;a=b[0].pageX;d=b[0].pageY}else{if(c.pageX||c.pageY){a=c.pageX;d=c.pageY}else{if(c.clientX||c.clientY){a=c.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;d=c.clientY+document.body.scrollTop+document.documentElement.scrollTop}}}return{x:a,y:d}}function findPos(b){var c=0,a=0;if(b.offsetParent){do{c+=b.offsetLeft;a+=b.offsetTop}while(b=b.offsetParent)}return{left:c,top:a}}function mousePositionElement(f){var b=mousePositionDocument(f);var d=mouseTarget(f);var c=findPos(d);var a=b.x-c.left;var g=b.y-c.top;return{x:a,y:g}};DEBUG=false;var GAME_OPTS={canvasId:"game-main",canvasClass:"game-clone layer-"};var ALPHA=1;if(DEBUG===true){ALPHA=0.5}var COLORS={laser:"#F00",grid:"#FF0",text:"#000",stroke:"#333",empty_stroke:"#DDD",none:"transparent",empty:rgba("#BBB",ALPHA),mirror:rgba("#FFF",ALPHA),blackhole:rgba("#444",ALPHA),glass:rgba("#FFF",ALPHA),prism:rgba("#CCC",ALPHA),mirror_stuck:rgba("#FFF",ALPHA),blackhole_stuck:rgba("#444",ALPHA),glass_stuck:rgba("#FFF",ALPHA)};var LAYOUT={padding:1,line:2,empty_line:1,maxWidth:document.documentElement.clientWidth,maxHeight:document.documentElement.clientHeight};var levels=[[{l1:1,l2:1,rows:3,columns:3,none:[1,2,3,4,6,7,8],lasers:[{cell:1,side:"n",dir:"se"}],targets:[{cell:3,side:"n"}],cells:[{type:"mirror",arr:[9]}],solution:[{type:"mirror",arr:[5]}]},{l1:1,l2:2,rows:3,columns:3,none:[3,5,7],lasers:[{cell:7,side:"s",dir:"ne"}],targets:[{cell:4,side:"e"}],cells:[{type:"mirror",arr:[1,9]}],solution:[{type:"mirror",arr:[2,6]}]},{l1:1,l2:3,rows:3,columns:3,none:[3],lasers:[{cell:3,side:"n",dir:"sw"}],targets:[{cell:8,side:"s"}],cells:[{type:"mirror",arr:[1,6]}],solution:[{type:"mirror",arr:[4,9]}]},{l1:1,l2:4,rows:3,columns:3,none:[4,6],lasers:[{cell:4,side:"w",dir:"se"}],targets:[{cell:6,side:"e"}],cells:[{type:"mirror",arr:[1,5,9]}],solution:[{type:"mirror",arr:[2,7,9]}]},{l1:1,l2:5,rows:3,columns:3,none:[5,7,9],lasers:[{cell:7,side:"s",dir:"ne"}],targets:[{cell:9,side:"s"}],cells:[{type:"mirror",arr:[1,3,8]}],solution:[{type:"mirror",arr:[1,4,6]}]},{l1:1,l2:6,rows:6,columns:4,none:[3,4,5,6,7,8,10,11,12,14,16,17,18,19,22,24],lasers:[{cell:4,side:"s",dir:"sw"}],targets:[{cell:3,side:"s"}],cells:[{type:"mirror",arr:[2,9,15,21]}],solution:[{type:"mirror",arr:[9,13,20,23]}]},{l1:1,l2:7,rows:5,columns:3,none:[1,2,5,7,11,13,14],lasers:[{cell:14,side:"s",dir:"ne"}],targets:[{cell:2,side:"n"},{cell:5,side:"n"},{cell:8,side:"n"},{cell:11,side:"n"},{cell:14,side:"n"}],cells:[{type:"mirror",arr:[4,6,8,10,12]}],solution:[{type:"mirror",arr:[3,4,9,10,15]}]},{l1:1,l2:8,rows:3,columns:3,none:[1,2,6,9],lasers:[{cell:1,side:"w",dir:"se"}],targets:[{cell:9,side:"s"}],cells:[{type:"blackhole",arr:[5,8]}],solution:[{type:"blackhole",arr:[3,7]}]},{l1:1,l2:9,rows:5,columns:3,none:[1,2,3,5,9,10,13,14,15],lasers:[{cell:15,side:"e",dir:"nw"}],targets:[{cell:3,side:"e"},{cell:9,side:"e"}],cells:[{type:"mirror",arr:[4]},{type:"glass",arr:[6]}],solution:[{type:"mirror",arr:[7]},{type:"glass",arr:[11]}]},{l1:1,l2:10,rows:3,columns:3,none:[3,8],lasers:[{cell:8,side:"s",dir:"nw"}],targets:[{cell:4,side:"w"}],cells:[{type:"mirror",arr:[1,9]},{type:"mirror_stuck",arr:[7]}],solution:[{type:"mirror",arr:[2,6]},{type:"mirror_stuck",arr:[7]}]}],[{l1:2,l2:1,rows:4,columns:4,none:[4,6,10,12,13,16],lasers:[{cell:13,side:"s",dir:"ne"}],targets:[{cell:14,side:"e"}],cells:[{type:"mirror",arr:[2,5,15]}],solution:[{type:"mirror",arr:[3,8,9]}]},{l1:2,l2:2,rows:3,columns:3,none:[5],lasers:[{cell:2,side:"n",dir:"se"}],targets:[{cell:1,side:"e"}],cells:[{type:"mirror",arr:[1,6,7,8]}],solution:[{type:"mirror",arr:[3,4,6,8]}]},{l1:2,l2:3,rows:5,columns:4,none:[4,14,17],lasers:[{cell:10,side:"s",dir:"sw"}],targets:[{cell:5,side:"e"}],cells:[{type:"mirror",arr:[8,9,15,20]}],solution:[{type:"mirror",arr:[2,12,13,18]}]},{l1:2,l2:4,rows:5,columns:4,none:[4,9,20],lasers:[{cell:9,side:"w",dir:"se"}],targets:[{cell:5,side:"s"},{cell:6,side:"e"},{cell:11,side:"s"},{cell:13,side:"e"}],cells:[{type:"mirror",arr:[7,10,16]}],solution:[{type:"mirror",arr:[2,12,18]}]},{l1:2,l2:5,rows:6,columns:4,none:[1],lasers:[{cell:1,side:"w",dir:"se"}],targets:[{cell:20,side:"e"}],cells:[{type:"mirror",arr:[3,10,12,22]},{type:"blackhole_stuck",arr:[15]}],solution:[{type:"mirror",arr:[11,13,16,23]},{type:"blackhole_stuck",arr:[15]}]},{l1:2,l2:6,rows:6,columns:4,none:[7,9,11,24],lasers:[{cell:11,side:"s",dir:"nw"}],targets:[{cell:18,side:"s"}],cells:[{type:"mirror",arr:[2,4,19,20]}],solution:[{type:"mirror",arr:[2,5,12,17]}]},{l1:2,l2:7,rows:5,columns:4,none:[],lasers:[{cell:1,side:"w",dir:"se"}],targets:[{cell:14,side:"s"}],cells:[{type:"mirror",arr:[5,7,11,16,18]},{type:"mirror_stuck",arr:[10]}],solution:[{type:"mirror",arr:[3,8,13,16,19]},{type:"mirror_stuck",arr:[10]}]},{l1:2,l2:8,rows:6,columns:4,none:[4,5,15,23],lasers:[{cell:4,side:"n",dir:"sw"}],targets:[{cell:14,side:"s"},{cell:18,side:"s"}],cells:[{type:"mirror",arr:[12,21,24]}],solution:[{type:"mirror",arr:[6,12,17]}]},{l1:2,l2:9,rows:4,columns:4,none:[4,14],lasers:[{cell:14,side:"e",dir:"nw"}],targets:[{cell:5,side:"s"},{cell:7,side:"e"}],cells:[{type:"mirror",arr:[1,3,11,13,16]}],solution:[{type:"mirror",arr:[2,3,8,9,11]}]},{l1:2,l2:10,rows:5,columns:4,none:[4,17,18],lasers:[{cell:18,side:"e",dir:"nw"}],targets:[{cell:2,side:"e"},{cell:11,side:"e"}],cells:[{type:"mirror",arr:[1,6,8,15,20]}],solution:[{type:"mirror",arr:[5,7,12,13,15]}]}],[{l1:3,l2:1,rows:5,columns:4,none:[],lasers:[{cell:9,side:"w",dir:"se"}],targets:[{cell:6,side:"s"}],cells:[{type:"mirror",arr:[1,4,17,20]},{type:"blackhole_stuck",arr:[10]}],solution:[{type:"mirror",arr:[2,5,12,18]},{type:"blackhole_stuck",arr:[10]}]},{l1:3,l2:2,rows:4,columns:4,none:[],lasers:[{cell:3,side:"n",dir:"sw"}],targets:[{cell:6,side:"s"},{cell:7,side:"s"},{cell:10,side:"s"},{cell:11,side:"s"}],cells:[{type:"mirror",arr:[1,4,13,16]}],solution:[{type:"mirror",arr:[5,7,12,15]}]},{l1:3,l2:3,rows:3,columns:4,none:[],lasers:[{cell:2,side:"n",dir:"se"}],targets:[{cell:2,side:"e"},{cell:5,side:"e"},{cell:6,side:"e"},{cell:7,side:"e"},{cell:10,side:"e"}],cells:[{type:"mirror",arr:[1,4,9,12]}],solution:[{type:"mirror",arr:[3,5,8,10]}]},{l1:3,l2:4,rows:3,columns:4,none:[],lasers:[{cell:4,side:"n",dir:"sw"}],targets:[{cell:5,side:"e"},{cell:6,side:"e"},{cell:7,side:"e"}],cells:[{type:"mirror",arr:[1,4,9,12]}],solution:[{type:"mirror",arr:[2,5,10,11]}]},{l1:3,l2:5,rows:5,columns:3,none:[],lasers:[{cell:2,side:"e",dir:"sw"}],targets:[{cell:14,side:"s"}],cells:[{type:"mirror",arr:[1,3,13,15]}],solution:[{type:"mirror",arr:[4,9,10,15]}]},{l1:3,l2:6,rows:5,columns:4,none:[8,9,19],lasers:[{cell:9,side:"w",dir:"se"}],targets:[{cell:6,side:"e"},{cell:10,side:"e"},{cell:14,side:"e"}],cells:[{type:"mirror",arr:[1,4,17,20]}],solution:[{type:"mirror",arr:[2,5,12,18]}]},{l1:3,l2:7,rows:5,columns:4,none:[5,9,12,19],lasers:[{cell:9,side:"w",dir:"se"}],targets:[{cell:6,side:"e"},{cell:10,side:"e"},{cell:14,side:"e"}],cells:[{type:"mirror",arr:[1,4,17,20]}],solution:[{type:"mirror",arr:[3,8,13,18]}]},{l1:3,l2:8,rows:5,columns:4,none:[],lasers:[{cell:1,side:"s",dir:"se"}],targets:[{cell:5,side:"w"},{cell:11,side:"s"}],cells:[{type:"mirror",arr:[1,4,17,20]},{type:"mirror_stuck",arr:[9]},{type:"blackhole_stuck",arr:[12]}],solution:[{type:"mirror",arr:[2,7,16,19]},{type:"mirror_stuck",arr:[9]},{type:"blackhole_stuck",arr:[12]}]},{l1:3,l2:9,rows:5,columns:4,none:[],lasers:[{cell:5,side:"w",dir:"se"}],targets:[{cell:5,side:"e"},{cell:11,side:"e"},{cell:13,side:"e"}],cells:[{type:"mirror",arr:[1,4,17,20]}],solution:[{type:"mirror",arr:[2,9,12,18]}]},{l1:3,l2:10,rows:4,columns:4,none:[],lasers:[{cell:4,side:"s",dir:"sw"},{cell:5,side:"w",dir:"se"}],targets:[{cell:6,side:"s"},{cell:7,side:"s"},{cell:9,side:"s"},{cell:12,side:"e"}],cells:[{type:"mirror",arr:[1,4,13,16]}],solution:[{type:"mirror",arr:[3,6,11,14]}]}],[{l1:4,l2:1,rows:6,columns:4,none:[3,10,11,21],lasers:[{cell:16,side:"e",dir:"sw"}],targets:[{cell:1,side:"s"},{cell:7,side:"e"}],cells:[{type:"mirror",arr:[8,18]},{type:"glass",arr:[9]}],solution:[{type:"mirror",arr:[13,25]},{type:"glass",arr:[20]}]},{l1:4,l2:2,rows:6,columns:4,none:[1,4,7,11,14,21,24],lasers:[{cell:24,side:"e",dir:"nw"}],targets:[{cell:5,side:"e"}],cells:[{type:"mirror",arr:[8,16,17,22,23]}],solution:[{type:"mirror",arr:[2,10,12,13,18]}]},{l1:4,l2:3,rows:6,columns:4,none:[2,5,8,11,13,14,19,21,24],lasers:[{cell:3,side:"n",dir:"se"}],targets:[{cell:23,side:"s"}],cells:[{type:"mirror",arr:[6,7,9,10,12,15,16,17,18,22]}],solution:[{type:"mirror",arr:[1,4,6,9,12,15,16,17,20,22]}]},{l1:4,l2:4,rows:6,columns:4,none:[1,2,4],lasers:[{cell:1,side:"e",dir:"se"}],targets:[{cell:17,side:"s"},{cell:18,side:"s"},{cell:19,side:"s"},{cell:20,side:"s"}],cells:[{type:"mirror",arr:[22]},{type:"glass",arr:[3,9,15]}],solution:[{type:"mirror",arr:[12]},{type:"glass",arr:[14,17,20]}]},{l1:4,l2:5,rows:5,columns:5,none:[3,23],lasers:[{cell:11,side:"w",dir:"se"}],targets:[{cell:6,side:"e"},{cell:14,side:"e"}],cells:[{type:"mirror",arr:[1,5,13,21,25]}],solution:[{type:"mirror",arr:[2,9,15,19,22]}]},{l1:4,l2:6,rows:6,columns:4,none:[1,2,8,14,21],lasers:[{cell:6,side:"e",dir:"se"}],targets:[{cell:14,side:"e"},{cell:19,side:"e"}],cells:[{type:"mirror",arr:[5,22]}],solution:[{type:"mirror",arr:[7,9]}]},{l1:4,l2:7,rows:6,columns:4,none:[4,11,13,24],lasers:[{cell:1,side:"e",dir:"se"}],targets:[{cell:7,side:"e"},{cell:18,side:"s"}],cells:[{type:"mirror",arr:[9,14,23]},{type:"glass",arr:[3]}],solution:[{type:"mirror",arr:[10,12,17]},{type:"glass",arr:[15]}]},{l1:4,l2:8,rows:5,columns:3,none:[],lasers:[{cell:8,side:"s",dir:"ne"}],targets:[{cell:1,side:"w"},{cell:13,side:"s"},{cell:15,side:"e"}],cells:[{type:"glass",arr:[3,10,14]}],solution:[{type:"glass",arr:[8,9,12]}]},{l1:4,l2:9,rows:5,columns:5,none:[1,5,14,21,25],lasers:[{cell:9,side:"s",dir:"sw"}],targets:[{cell:7,side:"e"},{cell:7,side:"s"},{cell:8,side:"e"},{cell:12,side:"s"},{cell:14,side:"s"},{cell:17,side:"e"},{cell:18,side:"e"}],cells:[{type:"mirror",arr:[13,16,20,22,24]}],solution:[{type:"mirror",arr:[3,11,15,17,23]}]},{l1:4,l2:10,rows:5,columns:4,none:[4,7],lasers:[{cell:11,side:"e",dir:"nw"}],targets:[{cell:7,side:"s"},{cell:10,side:"s"},{cell:14,side:"e"}],cells:[{type:"mirror",arr:[2,5,14,17]},{type:"blackhole_stuck",arr:[16,20]},{type:"glass_stuck",arr:[8]}],solution:[{type:"mirror",arr:[3,6,13,18]},{type:"blackhole_stuck",arr:[16,20]},{type:"glass_stuck",arr:[8]}]}],[{l1:5,l2:1,rows:4,columns:3,none:[],lasers:[{cell:4,side:"s",dir:"se"},{cell:7,side:"s",dir:"ne"}],targets:[{cell:7,side:"w"},{cell:9,side:"e"}],cells:[{type:"mirror",arr:[2,5,11]}],solution:[{type:"mirror",arr:[2,6,11]}]},{l1:5,l2:2,rows:5,columns:4,none:[8,17],lasers:[{cell:6,side:"s",dir:"se"},{cell:10,side:"s",dir:"ne"}],targets:[{cell:6,side:"e"},{cell:14,side:"e"}],cells:[{type:"mirror",arr:[7,15,18]}],solution:[{type:"mirror",arr:[9,16,19]}]},{l1:5,l2:3,rows:4,columns:3,none:[],lasers:[{cell:1,side:"e",dir:"se"},{cell:2,side:"e",dir:"sw"}],targets:[{cell:10,side:"e"},{cell:11,side:"e"}],cells:[{type:"mirror",arr:[3,4,9,11]}],solution:[{type:"mirror",arr:[4,6,7,9]}]},{l1:5,l2:4,rows:5,columns:4,none:[3,19],lasers:[{cell:5,side:"s",dir:"se"},{cell:9,side:"s",dir:"ne"}],targets:[{cell:2,side:"n"},{cell:10,side:"e"},{cell:18,side:"s"}],cells:[{type:"mirror",arr:[5,6,12,17]}],solution:[{type:"mirror",arr:[6,8,14,16]}]},{l1:5,l2:5,rows:5,columns:4,none:[10,11,17,18],lasers:[{cell:6,side:"s",dir:"se"},{cell:10,side:"s",dir:"ne"}],targets:[{cell:3,side:"n"},{cell:19,side:"s"}],cells:[{type:"mirror",arr:[2,4,5,9,16]}],solution:[{type:"mirror",arr:[5,7,12,13,15]}]},{l1:5,l2:6,rows:5,columns:4,none:[6,9,17],lasers:[{cell:5,side:"s",dir:"se"},{cell:9,side:"s",dir:"ne"}],targets:[{cell:2,side:"n"},{cell:18,side:"s"}],cells:[{type:"mirror",arr:[3,4,7,12,14,20]}],solution:[{type:"mirror",arr:[3,5,8,13,16,19]}]},{l1:5,l2:7,rows:5,columns:4,none:[4,10,17,20],lasers:[{cell:5,side:"s",dir:"se"},{cell:9,side:"s",dir:"ne"}],targets:[{cell:5,side:"w"},{cell:11,side:"e"},{cell:13,side:"w"}],cells:[{type:"mirror",arr:[6,7,14,15]}],solution:[{type:"mirror",arr:[2,9,12,18]}]},{l1:5,l2:8,rows:6,columns:4,none:[2],lasers:[{cell:1,side:"e",dir:"se"},{cell:2,side:"e",dir:"sw"}],targets:[{cell:3,side:"s"},{cell:7,side:"s"},{cell:11,side:"s"},{cell:15,side:"s"},{cell:19,side:"s"}],cells:[{type:"mirror",arr:[3,8,10,16,18]}],solution:[{type:"mirror",arr:[5,10,12,14,20]}]},{l1:5,l2:9,rows:3,columns:4,none:[7],lasers:[{cell:1,side:"s",dir:"se"},{cell:5,side:"s",dir:"ne"}],targets:[{cell:3,side:"n"},{cell:10,side:"s"}],cells:[{type:"mirror",arr:[1,9,12]},{type:"blackhole",arr:[2,4,8,11]}],solution:[{type:"mirror",arr:[2,8,11]},{type:"blackhole",arr:[1,4,9,12]}]},{l1:5,l2:10,rows:5,columns:4,none:[1,10,12,20],lasers:[{cell:1,side:"s",dir:"se"},{cell:5,side:"s",dir:"ne"}],targets:[{cell:7,side:"e"},{cell:9,side:"s"},{cell:16,side:"s"}],cells:[{type:"mirror",arr:[3,4,14,15,17,19]}],solution:[{type:"mirror",arr:[2,3,8,11,13,18]}]}],[{l1:6,l2:1,rows:4,columns:4,none:[],lasers:[{cell:13,side:"e",dir:"ne"}],targets:[{cell:2,side:"n"},{cell:6,side:"e"},{cell:9,side:"e"},{cell:14,side:"e"}],cells:[{type:"mirror",arr:[4,15]},{type:"glass",arr:[12]}],solution:[{type:"mirror",arr:[8,9]},{type:"glass",arr:[3]}]},{l1:6,l2:2,rows:4,columns:4,none:[9,12],lasers:[{cell:13,side:"e",dir:"ne"}],targets:[{cell:2,side:"n"},{cell:6,side:"e"},{cell:9,side:"e"},{cell:14,side:"e"}],cells:[{type:"mirror",arr:[1,4,15]},{type:"glass",arr:[11]}],solution:[{type:"mirror",arr:[3,5,8]},{type:"glass",arr:[10]}]},{l1:6,l2:3,rows:6,columns:4,none:[4,16,21],lasers:[{cell:9,side:"w",dir:"se"}],targets:[{cell:7,side:"s"},{cell:10,side:"e"},{cell:11,side:"e"},{cell:11,side:"s"},{cell:19,side:"s"}],cells:[{type:"mirror",arr:[7,10,11,12,15]}],solution:[{type:"mirror",arr:[6,7,12,13,15]}]},{l1:6,l2:4,rows:5,columns:4,none:[],lasers:[{cell:4,side:"s",dir:"sw"}],targets:[{cell:6,side:"s"},{cell:8,side:"s"},{cell:15,side:"s"}],cells:[{type:"mirror",arr:[1,3,5,18,20]}],solution:[{type:"mirror",arr:[6,9,14,16,19]}]},{l1:6,l2:5,rows:6,columns:4,none:[],lasers:[{cell:12,side:"s",dir:"nw"},{cell:24,side:"e",dir:"nw"}],targets:[{cell:3,side:"e"},{cell:6,side:"s"},{cell:8,side:"e"},{cell:13,side:"s"},{cell:15,side:"e"}],cells:[{type:"mirror",arr:[2,18]},{type:"glass",arr:[23]}],solution:[{type:"mirror",arr:[6,9]},{type:"glass",arr:[11]}]},{l1:6,l2:6,rows:5,columns:5,none:[1,5,13,21,25],lasers:[{cell:1,side:"e",dir:"se"},{cell:10,side:"s",dir:"sw"}],targets:[{cell:8,side:"e"},{cell:13,side:"e"},{cell:15,side:"s"},{cell:18,side:"e"},{cell:21,side:"e"}],cells:[{type:"mirror",arr:[3,6,12,16,24]}],solution:[{type:"mirror",arr:[4,12,14,15,24]}]},{l1:6,l2:7,rows:5,columns:5,none:[15],lasers:[{cell:1,side:"e",dir:"se"},{cell:10,side:"s",dir:"sw"}],targets:[{cell:8,side:"e"},{cell:13,side:"e"},{cell:15,side:"s"},{cell:18,side:"e"},{cell:21,side:"e"}],cells:[{type:"mirror",arr:[3,5,6,12,16,24]}],solution:[{type:"mirror",arr:[3,9,11,13,19,23]}]},{l1:6,l2:8,rows:5,columns:5,none:[1,5,21,25],lasers:[{cell:5,side:"e",dir:"sw"}],targets:[{cell:7,side:"e"},{cell:7,side:"s"},{cell:8,side:"e"},{cell:12,side:"s"},{cell:14,side:"s"},{cell:17,side:"e"},{cell:18,side:"e"}],cells:[{type:"mirror",arr:[16,20,22,24]},{type:"glass_stuck",arr:[13]}],solution:[{type:"mirror",arr:[3,11,14,23]},{type:"glass_stuck",arr:[13]}]},{l1:6,l2:9,rows:6,columns:4,none:[],lasers:[{cell:4,side:"n",dir:"sw"}],targets:[{cell:1,side:"s"},{cell:9,side:"e"},{cell:11,side:"s"},{cell:18,side:"s"}],cells:[{type:"mirror",arr:[2,6,8,13,19,21,24]}],solution:[{type:"mirror",arr:[9,11,13,16,17,19,22]}]},{l1:6,l2:10,rows:6,columns:6,none:[3,6,11,13,15,23,27,28],lasers:[{cell:7,side:"e",dir:"se"}],targets:[{cell:8,side:"e"},{cell:9,side:"e"},{cell:10,side:"e"}],cells:[{type:"mirror",arr:[2,5,12,19,22,30,32,35]}],solution:[{type:"mirror",arr:[4,16,18,19,26,30,33,35]}]}],[{l1:7,l2:1,rows:6,columns:4,none:[1,6,7,11,13,16,19,23],lasers:[{cell:10,side:"e",dir:"ne"}],targets:[{cell:11,side:"e"}],cells:[{type:"mirror",arr:[2,9,18,20,21]}],solution:[{type:"mirror",arr:[2,3,5,8,10]}]},{l1:7,l2:2,rows:5,columns:5,none:[1,5,7,9,17],lasers:[{cell:1,side:"w",dir:"se"}],targets:[{cell:3,side:"s"},{cell:16,side:"e"},{cell:24,side:"e"}],cells:[{type:"mirror",arr:[2,4,6,10,13,20]},{type:"mirror_stuck",arr:[11]}],solution:[{type:"mirror",arr:[3,13,15,16,18,22]},{type:"mirror_stuck",arr:[11]}]},{l1:7,l2:3,rows:5,columns:5,none:[2,12,16,19,20,22,23,24],lasers:[{cell:13,side:"s",dir:"se"},{cell:24,side:"e",dir:"ne"}],targets:[{cell:5,side:"s"},{cell:8,side:"e"},{cell:12,side:"e"},{cell:12,side:"s"}],cells:[{type:"mirror",arr:[4,7,11,14,21]},{type:"mirror_stuck",arr:[15]}],solution:[{type:"mirror",arr:[3,11,17,18,25]},{type:"mirror_stuck",arr:[15]}]},{l1:7,l2:4,rows:6,columns:5,none:[1,11,12,24,27],lasers:[{cell:9,side:"e",dir:"se"}],targets:[{cell:4,side:"n"},{cell:4,side:"s"},{cell:18,side:"s"}],cells:[{type:"mirror",arr:[3,7,15,16,19,29]}],solution:[{type:"mirror",arr:[5,8,10,15,17,23]}]},{l1:7,l2:5,rows:6,columns:5,none:[3,12,17,20,23,24,28],lasers:[{cell:2,side:"e",dir:"se"}],targets:[{cell:5,side:"s"},{cell:23,side:"e"}],cells:[{type:"mirror",arr:[1,10,11,13,19,22,25,29]},{type:"blackhole_stuck",arr:[2,26]}],solution:[{type:"mirror",arr:[7,11,15,18,21,25,27,29]},{type:"blackhole_stuck",arr:[2,26]}]},{l1:7,l2:6,rows:5,columns:4,none:[4,5,7,10,11,17,18,20],lasers:[{cell:9,side:"s",dir:"ne"}],targets:[{cell:9,side:"w"},{cell:10,side:"e"}],cells:[{type:"mirror",arr:[1,12,14]},{type:"glass",arr:[15]}],solution:[{type:"mirror",arr:[2,12,15]},{type:"glass",arr:[6]}]},{l1:7,l2:7,rows:5,columns:4,none:[9,12,20],lasers:[{cell:12,side:"e",dir:"sw"},{cell:14,side:"e",dir:"se"}],targets:[{cell:1,side:"s"},{cell:6,side:"e"},{cell:7,side:"e"},{cell:15,side:"e"}],cells:[{type:"mirror",arr:[2,4,5,11,17]}],solution:[{type:"mirror",arr:[3,8,10,16,19]}]},{l1:7,l2:8,rows:6,columns:5,none:[18,25],lasers:[{cell:18,side:"s",dir:"se"}],targets:[{cell:9,side:"s"},{cell:12,side:"s"},{cell:21,side:"w"}],cells:[{type:"mirror",arr:[2,5,8,16,20,27]}],solution:[{type:"mirror",arr:[4,10,16,24,26,28]}]},{l1:7,l2:9,rows:7,columns:5,none:[6,12,13,16,23,30],lasers:[{cell:6,side:"e",dir:"se"}],targets:[{cell:5,side:"s"},{cell:7,side:"s"},{cell:14,side:"e"}],cells:[{type:"mirror",arr:[1,4,17,26,28,34]},{type:"mirror_stuck",arr:[15]}],solution:[{type:"mirror",arr:[3,11,21,25,27,29]},{type:"mirror_stuck",arr:[15]}]},{l1:7,l2:10,rows:6,columns:4,none:[10,15,20,21,23],lasers:[{cell:8,side:"s",dir:"nw"}],targets:[{cell:8,side:"e"},{cell:11,side:"e"},{cell:14,side:"e"},{cell:15,side:"s"}],cells:[{type:"mirror",arr:[5,6,11,14,16,17,19,22]},{type:"mirror_stuck",arr:[2]}],solution:[{type:"mirror",arr:[3,4,6,9,12,14,16,19]},{type:"mirror_stuck",arr:[2]}]}],[{l1:8,l2:1,rows:3,columns:3,none:[],lasers:[{cell:6,side:"s",dir:"sw"}],targets:[{cell:6,side:"e"}],cells:[{type:"mirror",arr:[1,3,5]}],solution:[{type:"mirror",arr:[3,5,9]}]},{l1:8,l2:2,rows:3,columns:3,none:[],lasers:[{cell:6,side:"e",dir:"sw"},{cell:8,side:"s",dir:"ne"}],targets:[{cell:2,side:"n"},{cell:4,side:"w"}],cells:[{type:"mirror",arr:[3,7]}],solution:[{type:"mirror",arr:[1,9]}]},{l1:8,l2:3,rows:3,columns:3,none:[],lasers:[{cell:4,side:"e",dir:"ne"}],targets:[{cell:5,side:"e"},{cell:7,side:"e"},{cell:9,side:"e"}],cells:[{type:"mirror",arr:[4]},{type:"glass",arr:[3]}],solution:[{type:"mirror",arr:[2]},{type:"glass",arr:[6]}]},{l1:8,l2:4,rows:3,columns:3,none:[],lasers:[{cell:7,side:"w",dir:"ne"},{cell:8,side:"e",dir:"nw"}],targets:[{cell:2,side:"e"},{cell:7,side:"e"}],cells:[{type:"mirror",arr:[2,4,5,7]},{type:"blackhole_stuck",arr:[9]}],solution:[{type:"mirror",arr:[1,3,4,6]},{type:"blackhole_stuck",arr:[9]}]},{l1:8,l2:5,rows:3,columns:3,none:[],lasers:[{cell:8,side:"e",dir:"nw"}],targets:[{cell:1,side:"s"},{cell:6,side:"e"}],cells:[{type:"mirror",arr:[3,5,9]},{type:"glass",arr:[4]},{type:"blackhole_stuck",arr:[2]}],solution:[{type:"mirror",arr:[1,3,7]},{type:"glass",arr:[8]},{type:"blackhole_stuck",arr:[2]}]},{l1:8,l2:6,rows:3,columns:3,none:[],lasers:[{cell:1,side:"e",dir:"sw"},{cell:6,side:"e",dir:"sw"}],targets:[{cell:1,side:"w"},{cell:2,side:"s"},{cell:4,side:"e"}],cells:[{type:"glass",arr:[3,5,7]},{type:"blackhole_stuck",arr:[8]}],solution:[{type:"mirror",arr:[2,4,9]},{type:"glass",arr:[8]},{type:"blackhole_stuck",arr:[8]}]},{l1:8,l2:7,rows:3,columns:3,none:[],lasers:[{cell:3,side:"s",dir:"sw"},{cell:6,side:"s",dir:"nw"}],targets:[{cell:1,side:"n"},{cell:2,side:"n"}],cells:[{type:"mirror",arr:[1,7,9]}],solution:[{type:"mirror",arr:[3,4,8]}]},{l1:8,l2:8,rows:3,columns:3,none:[],lasers:[{cell:6,side:"e",dir:"nw"},{cell:9,side:"s",dir:"nw"}],targets:[{cell:4,side:"w"},{cell:4,side:"e"},{cell:5,side:"e"},{cell:7,side:"e"}],cells:[{type:"mirror",arr:[2,7]}],solution:[{type:"mirror",arr:[1,3]}]},{l1:8,l2:9,rows:3,columns:3,none:[],lasers:[{cell:3,side:"n",dir:"sw"},{cell:9,side:"s",dir:"nw"}],targets:[{cell:2,side:"e"},{cell:4,side:"w"}],cells:[{type:"mirror",arr:[5,8,9]},{type:"blackhole_stuck",arr:[7]}],solution:[{type:"mirror",arr:[1,2,6]},{type:"blackhole_stuck",arr:[7]}]},{l1:8,l2:10,rows:3,columns:3,none:[],lasers:[{cell:4,side:"w",dir:"ne"}],targets:[{cell:6,side:"e"}],cells:[{type:"mirror",arr:[1,3,4,5,6,7]}],solution:[{type:"mirror",arr:[1,2,3,7,8,9]}]}],[{l1:9,l2:1,rows:3,columns:3,none:[],lasers:[{cell:1,side:"n",dir:"se"}],targets:[{cell:3,side:"n"}],cells:[{type:"mirror",arr:[4]},{type:"blackhole",arr:[2,5,6]},{type:"blackhole_stuck",arr:[7,9]}],solution:[{type:"mirror",arr:[5]},{type:"blackhole",arr:[4,6]},{type:"blackhole_stuck",arr:[7,9]}]}]];var LaserGame=function(){var ax=document.getElementById(GAME_OPTS.canvasId);if(!ax.getContext){return false}var o;var V=LAYOUT.maxWidth,G=LAYOUT.maxHeight,aw,c,f,B,M,ag,af;var ap=ax.getContext("2d"),K,aq,E,r,aj,Z,L,Q,S,O,h,l,z,A;var N=["bg","debug","cells","laser","moving"],t,av,g=ax.parentNode;if(DEBUG===false){N.splice(1,1)}this.init=function(aA){o=aA;H();s();F();ab();ad();an();U();p();ax.on("mousedown",q);ax.on("touchstart",q)};this.solution=function(){var aD=o.solution,aA=aD.length;for(var aC=1;aC<=aj;aC++){if(r[aC].type!=="none"){r[aC].type="empty"}}for(var aC=0;aC<aA;aC++){for(var aB=0;aB<aD[aC].arr.length;aB++){r[aD[aC].arr[aB]].type=aD[aC].type}}av.cells.clearRect(0,0,aw,c);ar(aD);U()};var H=function(){aw=G*(o.columns+LAYOUT.padding)/(o.rows+LAYOUT.padding);if(aw>V){aw=V}B=Math.floor(aw/(o.columns+LAYOUT.padding));if(isEven(B)){B=B-1}M=B;B--;aw=V;c=G;ag=(aw-(B*o.columns))/2;af=(c-(M*o.rows))/2;f=Math.sqrt(Math.pow(aw,2)+Math.pow(c,2));ax.setAttribute("height",c);ax.setAttribute("width",aw);K=B/2;aq=M/2;E=B/4;r=[{}];aj=o.rows*o.columns;Z=null;L=[];Q=0;S=B/8;O=B/16;h=B/12;l=B/5;z=[];A=[];t=[];av=[];if(document.getElementsByTagName("canvas").length>1){for(var aC=0;aC<N.length;aC++){var aB=document.getElementsByClassName(GAME_OPTS.canvasClass+N[aC]);if(aB.length>0){aB[0].parentNode.removeChild(aB[0])}}}for(var aC=0;aC<N.length;aC++){var aA=N[aC];t[aA]=document.createElement("canvas");g.appendChild(t[aA]);t[aA].className=GAME_OPTS.canvasClass+aA;t[aA].setAttribute("height",c);t[aA].setAttribute("width",aw);av[aA]=t[aA].getContext("2d")}};var s=function(){var aA,aF,aD=af,aB=0;for(var aC=0;aC<o.rows;aC++){aA=ag;aF=aD;aD+=M;for(var aE=0;aE<o.columns;aE++){r.push({x:aA,y:aF,type:"empty"});aA+=B;aB++}}};var F=function(){var aD=o.cells,aA=aD.length;for(var aC=0;aC<aA;aC++){for(var aB=0;aB<aD[aC].arr.length;aB++){r[aD[aC].arr[aB]].type=aD[aC].type}}for(var aB=0;aB<o.none.length;aB++){r[o.none[aB]].type="none"}};var ab=function(){var aC=o.targets,aB;for(var aA=0;aA<aC.length;aA++){aB=W(aC[aA].cell,aC[aA].side);z.push(aB.x+"_"+aB.y)}};var ad=function(){A=[];for(var aA=0;aA<z.length;aA++){A.push(z[aA])}};var p=function(){if(A.length===0){drawVictory();saveVictory(o.l1,o.l2);return true}return false};var an=function(){if(DEBUG===true){D()}y();az();ar(o.cells);if(DEBUG===true){Y()}};var U=function(){av.laser.clearRect(0,0,aw,c);n();var aC=o.lasers;for(var aB=0;aB<aC.length;aB++){Q++;var aA=W(aC[aB].cell,aC[aB].side);k(aA.x,aA.y);am(aA.x,aA.y,aC[aB].dir,aB);x(aA.x,aA.y);al(aC[aB].cell,aC[aB].side,aC[aB].dir,Q)}};var e=function(aB,aA){var aC=r[aA];P(aB,aC.x,aC.y,aC.type)};var b=function(aB,aA,aC){var aD=r[aA];P(aB,aD.x,aD.y,aC)};var P=function(aJ,aH,aG,aE){aJ.lineWidth=LAYOUT.line;aJ.fillStyle=COLORS[aE];aJ.strokeStyle=COLORS.stroke;aa(aJ,aH,aG,B,M,E);aJ.fill();aJ.stroke();if(aE==="glass"||aE==="glass_stuck"){var aD=B/10;aJ.fillStyle=COLORS.blackhole;aa(aJ,aH+1,aG+1,B-aD,M-aD,E-2);aJ.fill();aJ.fillStyle=COLORS.empty;aa(aJ,aH+aD-2,aG+aD-2,B-aD*2+3,M-aD*2+3,E-aD);aJ.fill();ai(aJ,aH+l,aG+l,h,COLORS[aE])}if(aE.indexOf("stuck")!=-1){R(aJ,aH,aG)}if(aE==="prism"){var aB=aH+3,aI=aG+3,aA=B-6,aC=M-6,aF=aA/4;v(aJ,aB+aA/2,aI,aB+aA,aI+aC/2,aB+aA/2,aI+aC,aB,aI+aC/2,"#AAA",COLORS.prism);v(aJ,aB+aA/2-aF,aI,aB+aA,aI+aC/2+aF,aB+aA/2+aF,aI+aC,aB,aI+aC/2-aF,"#888",COLORS.prism);v(aJ,aB+aA/2+aF,aI,aB+aA,aI+aC/2-aF,aB+aA/2-aF,aI+aC,aB,aI+aC/2+aF,"#888",COLORS.prism);v(aJ,aB+aA/2,aI+aF,aB+aA/2+aF,aI+aC/2,aB+aA/2,aI+aC-aF,aB+aF,aI+aC/2,"#666",COLORS.prism);v(aJ,aB+aA-aF,aI,aB+aA,aI+aC/2-aF,aB+aA-aF/2,aI+aC/2-aF/2,aB+aA/2+aF/2,aI+aF/2,COLORS.empty,COLORS.prism);v(aJ,aB+aA-aF/2,aI+aC/2+aF/2,aB+aA,aI+aC/2+aF,aB+aA/2+aF,aI+aC,aB+aA/2+aF/2,aI+aC-aF/2,COLORS.empty,COLORS.prism);v(aJ,aB+aF/2,aI+aC/2+aF/2,aB+aA/2-aF/2,aI+aC-aF/2,aB+aA/2-aF,aI+aC,aB,aI+aC/2+aF,COLORS.empty,COLORS.prism);v(aJ,aB+aA/2-aF,aI,aB+aA/2-aF/2,aI+aF/2,aB+aF/2,aI+aC/2-aF/2,aB,aI+aC/2-aF,COLORS.glass,COLORS.prism)}};var ak=function(aH){var aI=av.bg,aD=r[aH],aC=B/10,aF=aD.x+aC,aE=aD.y+aC,aG=B-aC*2,aB=M-aC*2,aA=E-aC/2;aI.lineWidth=LAYOUT.empty_line;aI.fillStyle=COLORS.empty;aI.strokeStyle=COLORS.empty_stroke;aa(aI,aF,aE,aG,aB,aA);aI.fill();aI.stroke()};var v=function(aJ,aC,aG,aB,aF,aA,aE,aK,aD,aI,aH){aJ.beginPath();aJ.moveTo(aC,aG);aJ.lineTo(aB,aF);aJ.lineTo(aA,aE);aJ.lineTo(aK,aD);aJ.closePath();if(aI){aJ.fillStyle=aI;aJ.fill()}if(aH){aJ.strokeStyle=aH;aJ.stroke()}};var aa=function(aL,aG,aE,aH,aM,aK){aG=aG+1;aE=aE+1;aH=aH-2;aM=aM-2;aK=aK-1;var aO=r4_x=aG+aK,aN=r2_y=aE+aK,aC=r3_x=aG+aH-aK,aP=r4_y=aE+aM-aK;var aF=aG+aH-aK,aD=aE,aR=aG+aH,aQ=aE+aM-aK,aJ=aG+aK,aI=aE+aM,aB=aG,aA=aE+aK;aL.beginPath();aL.arc(aO,aN,aK,Math.PI,1.5*Math.PI);aL.lineTo(aF,aD);aL.arc(aC,r2_y,aK,1.5*Math.PI,0);aL.lineTo(aR,aQ);aL.arc(r3_x,aP,aK,0,0.5*Math.PI);aL.lineTo(aJ,aI);aL.arc(r4_x,r4_y,aK,0.5*Math.PI,Math.PI);aL.lineTo(aB,aA)};var ai=function(aC,aB,aE,aA,aD){aC.beginPath();aC.arc(aB,aE,aA,0,2*Math.PI,false);aC.fillStyle=aD;aC.fill()};var w=function(aA,aC,aE,aB,aD){aA.beginPath();aA.moveTo(aC,aE);aA.lineTo(aB,aD);aA.stroke();aA.closePath()};var T=function(aB,aA,aE,aD){var aC=aD/2;aB.strokeStyle=COLORS.empty_stroke;ai(aB,aA,aE,aD,COLORS.empty);aB.stroke();w(aB,aA-aC,aE-aC,aA+aC,aE+aC);w(aB,aA+aC,aE-aC,aA-aC,aE+aC)};var R=function(aB,aA,aE){var aC=h,aD=l;T(aB,aA+aD,aE+aD,aC);T(aB,aA+B-aD,aE+aD,aC);T(aB,aA+aD,aE+M-aD,aC);T(aB,aA+B-aD,aE+M-aD,aC)};var Y=function(){var aB=av.debug,aD,aG,aC,aF;aB.strokeStyle=COLORS.grid;aD=ag;aG=0;aF=c;for(var aE=0;aE<=o.columns;aE++){w(aB,aD,aG,aD,aF);aD+=B}aD=0;aC=aw;aG=af;for(var aA=0;aA<=o.rows;aA++){w(aB,aD,aG,aC,aG);aG+=M}};var D=function(){var aA=av.debug;aA.fillStyle=COLORS.text;aA.font="bold 12px sans-serif";aA.textAlign="center";aA.textBaseline="middle";for(var aB=1;aB<=aj;aB++){var aC=r[aB];aA.fillText(aB,aC.x+K,aC.y+aq)}};var y=function(){for(var aA=1;aA<=aj;aA++){if(r[aA].type!="none"){ak(aA)}}};var ar=function(aB){var aA=aB;for(var aC=0;aC<aA.length;aC++){for(var aD=0;aD<aA[aC].arr.length;aD++){e(av.cells,aA[aC].arr[aD])}}};var az=function(){var aB=o.targets;for(var aA=0;aA<aB.length;aA++){ay(av.bg,aB[aA].cell,aB[aA].side,COLORS.stroke)}};var u=function(aA,aB){ai(av.laser,aA,aB,S,COLORS.laser)};var ay=function(aB,aA,aD,aC){var aE=W(aA,aD);ai(aB,aE.x,aE.y,S,aC)};var k=function(aA,aB){ai(av.laser,aA,aB,O,COLORS.laser)};var W=function(aA,aC){var aD=r[aA],aB={x:0,y:0};switch(aC){case"n":aB.x=aD.x+K;aB.y=aD.y;break;case"e":aB.x=aD.x+B;aB.y=aD.y+aq;break;case"s":aB.x=aD.x+K;aB.y=aD.y+M;break;case"w":aB.x=aD.x;aB.y=aD.y+aq;break}return aB};var ah=function(aA,aE){var aB=0;if(aE>=af&&aE<=(c-af)&&aA>=ag&&aA<=(aw-ag)){for(var aC=0;aC<o.rows;aC++){if(aE<=(aC+1)*M+af){for(var aD=1;aD<=o.columns;aD++){if(aA<=aD*B+ag){aB=aC*o.columns+aD;return aB}}}}}return aB};var q=function(aB){var aC=mousePositionElement(aB),aA=ah(aC.x,aC.y);if(aA===0){return}if(r[aA].type==="empty"||r[aA].type==="none"||r[aA].type==="mirror_stuck"||r[aA].type==="blackhole_stuck"||r[aA].type==="glass_stuck"){return false}else{at();P(av.moving,aC.x-K,aC.y-aq,r[aA].type);Z=aA;ax.on("mousemove",C);ax.on("touchmove",C);ax.on("mouseup",J);ax.on("touchend",J)}};var at=function(){av.moving.clearRect(0,0,aw,c)};var ao=function(aA){av.cells.clearRect(r[aA].x,r[aA].y,B,M)};var C=function(aA){var aB=mousePositionElement(aA);at();P(av.moving,aB.x-K,aB.y-aq,r[Z].type)};var J=function(aB){ax.removeEventListener("mousemove",C);ax.removeEventListener("touchmove",C);ax.removeEventListener("mouseup",J);ax.removeEventListener("touchend",J);at();var aC=mousePositionElement(aB),aA=ah(aC.x,aC.y);if(aA===0){return}if(r[aA].type==="empty"){r[aA].type=r[Z].type;r[Z].type="empty";ao(Z);e(av.cells,aA);ad();U();p()}else{}Z=null};var d=function(aB,aA){if(aA.indexOf(aB)===-1){return true}return false};var ae=function(aB){var aC=0,aA=0;switch(aB){case"n":aC=-1;break;case"e":aA=1;break;case"s":aC=1;break;case"w":aA=-1;break}return{r:aC,c:aA}};var I=function(aA){var aC=o.rows*o.columns;if(aA<=0||aA>aC){return false}var aD=0,aB=0;aD=Math.ceil(aA/o.columns);aB=aA%o.columns;if(aB===0){aB=o.columns}return{r:aD,c:aB}};var au=function(aB,aA){return(aB-1)*o.columns+aA};var m=function(aA,aE){var aH=0,aC=0,aG=ae(aE),aF=I(aA),aB,aD=o.rows*o.columns;aH=aF.r+aG.r;aC=aF.c+aG.c;if(aH<=0||aH>o.rows||aC<=0||aC>o.columns){return false}aB=au(aH,aC);if(aB<=0||aB>aD){return false}return aB};var j=function(aA){var aB;switch(aA){case"n":aB="s";break;case"e":aB="w";break;case"s":aB="n";break;case"w":aB="e";break}return aB};var am=function(aA,aD,aB,aC){L.push({x:aA,y:aD,dir:aB,laser:aC})};var n=function(){L=[]};var i=function(aA,aF,aC,aE){var aB=L.length;for(var aD=0;aD<aB;aD++){if(L[aD].x===aA&&L[aD].y===aF&&L[aD].dir===aC&&L[aD].laser===aE){return true}}return false};var X=function(aA,aE,aC){var aB=L.length;for(var aD=0;aD<aB;aD++){if(L[aD].x===aA&&L[aD].y===aE&&L[aD].dir===aC){return true}}return false};var a=function(aA,aB){if(z.indexOf(aA+"_"+aB)===-1){return false}return true};var x=function(aA,aC){if(a(aA,aC)){u(aA,aC);var aB=A.indexOf(aA+"_"+aC);if(aB!=-1){A.splice(aB,1)}}};var ac=function(aC,aA,aF){var aE=0;switch(aC){case"se":aE=45;break;case"sw":aE=135;break;case"nw":aE=225;break;case"ne":aE=315;break}var aD=aE*(Math.PI/180);var aB={x:aA+f*Math.cos(aD),y:aF+f*Math.sin(aD)};av.laser.strokeStyle=COLORS.laser;w(av.laser,aA,aF,aB.x,aB.y)};var al=function(aK,aG,aD,aL){var aM,aF,aI;var aB=W(aK,aG);if(d(aG,aD)===false){aM=aG;aF=aD;aI=aB}else{switch(r[aK]["type"]){case"empty":case"none":aF=aD;aM=aD.replace(aG,"").replace(j(aG),"");aI=W(aK,aM);break;case"mirror":case"mirror_stuck":aM=aG;aF=aD.replace(j(aM),aM);aI=aB;break;case"blackhole":case"blackhole_stuck":return false;break;case"glass":case"glass_stuck":aF=aD;aM=aD.replace(aG,"").replace(j(aG),"");aI=W(aK,aM);var aN=aG,aC=aD.replace(j(aN),aN);var aJ=W(aK,aN);if(!X(aJ.x,aJ.y,aC)){al(aK,aN,aC,Q++)}break;case"prism":aF=aD;aM=j(aG);aI=W(aK,aM);break}}if(i(aI.x,aI.y,aF,aL)){return false}am(aI.x,aI.y,aF,aL);x(aI.x,aI.y);if(aB.x!=aI.x||aB.y!=aI.y){av.laser.strokeStyle=COLORS.laser;w(av.laser,aB.x,aB.y,aI.x,aI.y)}var aE=m(aK,aM);var aA=j(aM);var aH=aF;if(aE===false){ac(aH,aI.x,aI.y);return false}al(aE,aA,aH)}};var l1=0,l2=0;var init=function(){document.body.on("touchmove",function(i){if(!hasClass(i.target,"menu-content")){prev(i)}},false);var a=document.getElementById("header").offsetHeight;LAYOUT.maxHeight-=a;var x=$$("#title");var J=new LaserGame();b();var v=$(".js-overlay"),w={},r=$$(".main"),u="selected",z="overlay-show";for(var C=0;C<v.length;C++){var y=v[C].getAttribute("href");w[y]=$$(y);v[C].on("click",function(o){prev(o);var L=this.getAttribute("href"),s=$$(L);if(hasClass(this,u)){removeClass(this,u);removeClass(s,z)}else{for(var i=0;i<v.length;i++){removeClass(v[i],u);removeClass(w[v[i].getAttribute("href")],z)}addClass(this,u);addClass(s,z)}q()})}var h=$$("#levels"),E=levels.length;var l=document.createElement("ul");l.className="l1";h.appendChild(l);for(var A=0;A<E;A++){var k=document.createElement("li"),K=document.createElement("span"),F=document.createElement("ul"),f=levels[A].length;F.className="l2";K.innerHTML="Level "+(A+1);K.className="l1-title";k.appendChild(K);k.appendChild(F);l.appendChild(k);for(n=0;n<f;n++){var D=document.createElement("li"),I=document.createElement("a"),H="l"+A+"-"+n;I.innerHTML=(n+1);I.id=H;I.href="#"+H;F.appendChild(D);D.appendChild(I);(function(i,o){I.on("click",function(m){prev(m);l1=i;l2=o;b();v[1].click()})})(A,n)}}var t=$(".js-nav-button");for(var A=0;A<t.length;A++){t[A].on("click",function(i){prev(i);if(this.id==="next"){l2++;if(l2>=levels[l1].length){l2=0;l1++;if(l1>=levels.length){l1=0}}}else{if(this.id==="prev"){l2--;if(l2<0){l1--;if(l1<0){l1=levels.length-1}l2=levels[l1].length-1}}}q();b()})}function j(){x.innerHTML="L1: "+(l1+1)+" - L2: "+(l2+1)}var B=[];if(window.localStorage&&typeof localStorage.victory!=="undefined"){B=JSON.parse(localStorage.victory)}for(var C=0;C<B.length;C++){addClass($$("#l"+B[C].l1+"-"+B[C].l2),"level-done")}var c=$(".victory")[0],e=$$("#"+GAME_OPTS.canvasId);window.drawVictory=function(){addClass(c,"show");e.on("mousedown",q);e.on("touchstart",q)};function q(){removeClass(c,"show");e.removeEventListener("mousedown",q);e.removeEventListener("touchstart",q)}window.saveVictory=function(m,i){var s=m-1,o=i-1;B.push({l1:s,l2:o});addClass($$("#l"+s+"-"+o),"level-done");if(window.localStorage){localStorage.victory=JSON.stringify(B)}};function d(){removeClass(G,"show");document.body.removeEventListener("mousedown",g);document.body.removeEventListener("touchstart",g)}function g(i){if(i.target.id!=="level-solution"&&i.target.id!=="title"){d()}}var p=$$("#level-solution"),G=$$("#solution");p.on("click",function(i){prev(i);d();J.solution()});x.on("click",function(i){if(hasClass(G,"show")){d()}else{removeClass($$("."+u),u);removeClass($$("."+z),z);addClass(G,"show");document.body.on("mousedown",g);document.body.on("touchstart",g)}});function b(){J.init(levels[l1][l2]);j()}};window.onload=init;</script><body><header class=header id=header><nav><ul><li><a href=#settings class=js-overlay><i class=icon-cog></i>Settings</a><div id=settings class=menu-content>Game developed by Giulia Alfonsi<br>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fuga reiciendis debitis quia rem tenetur veniam dolores autem repudiandae quod sint! Temporibus dolorum saepe consequuntur atque officiis animi at reprehenderit nisi repellendus ab eum rerum accusantium voluptatibus quas fugit inventore laudantium ducimus porro id possimus. Recusandae velit numquam eos quae doloribus similique harum eveniet voluptate molestias doloremque consectetur magni est minus eum itaque perspiciatis ut quibusdam unde nam vero qui amet voluptas sed illum corrupti! Modi quaerat facere minus in rerum provident repellat quia illo sapiente dolor dolorem totam amet vero porro cupiditate molestias error tempore nostrum blanditiis sequi pariatur impedit consequuntur. Excepturi blanditiis ratione quae tempore laudantium placeat odio quos consequatur et voluptatem rerum iusto velit debitis voluptate vero aspernatur eaque nostrum! Ut iure atque sint doloremque incidunt laudantium ipsum vero omnis veniam corrupti iusto rem similique quia in sit quo maxime excepturi. Ullam exercitationem expedita laboriosam praesentium repudiandae dolore voluptatibus possimus labore natus et. Tenetur at nemo dolores minima rerum quibusdam minus qui corrupti consectetur ratione impedit optio totam debitis ipsum voluptatibus in nesciunt aspernatur odit suscipit beatae inventore porro id mollitia quae voluptas! Asperiores error nihil illum porro id atque vero corrupti aliquam repellendus molestias dolor eius minus omnis excepturi aperiam magni iusto iste eaque voluptates quia fugiat aliquid odit blanditiis similique quae ducimus voluptatibus rerum quo ab cumque? Consequuntur dolore repellat error veniam quam eligendi a. Perferendis facilis obcaecati natus adipisci ducimus nihil provident architecto enim quas velit maiores eos temporibus ipsum explicabo ratione corporis maxime autem magnam porro omnis consequuntur ullam deleniti nesciunt iure quis sapiente aut totam nostrum tenetur aspernatur. Velit inventore accusantium praesentium deleniti nihil maxime repellendus enim alias placeat minima laborum accusamus eos fugiat in similique magnam natus! Animi deserunt velit harum ipsam quisquam perspiciatis suscipit. Nobis quaerat ea quae aspernatur atque doloremque eius alias culpa expedita at quam necessitatibus magnam a officiis voluptas ratione harum neque repudiandae optio unde porro corporis suscipit. At rerum tempore vitae eum hic quidem odit saepe similique modi accusantium repellat numquam minima sint debitis nemo consectetur perspiciatis obcaecati ratione dolorem consequatur voluptatum aspernatur nostrum temporibus provident fuga ducimus neque. Itaque asperiores culpa similique ex consequuntur esse dolore fuga quis tempore numquam impedit assumenda distinctio fugit aut recusandae enim temporibus omnis alias. Fuga minima maxime deleniti hic reiciendis facere nemo blanditiis ex ut veniam architecto nobis dolore quam voluptatum animi commodi recusandae voluptate quo aspernatur voluptates accusantium explicabo tempora necessitatibus eos possimus dolor vero debitis. Culpa adipisci voluptas aliquam quae quos voluptate quod dicta quis ipsum nostrum et provident suscipit illo quia sapiente! Earum ex aut odit nulla velit in ipsam laborum beatae sint officiis veniam unde sunt placeat. Quia iste mollitia et a pariatur voluptate ducimus sint amet repellat porro excepturi illo dolorem voluptatibus eaque saepe officiis similique dolore culpa consequatur nesciunt nihil ratione unde cum magnam dicta impedit id dolores nulla at sunt quidem aliquam rem commodi? Sunt vitae necessitatibus ab recusandae deleniti placeat obcaecati laboriosam laborum quae quia fugit qui blanditiis ipsa nesciunt magnam eum.</div></li><li><a href=#levels class=js-overlay><i class=icon-tasks></i>Levels</a><div id=levels class=menu-content></div></li><li><div class=level-title id=title></div><div id=solution class=menu-content><a href=# id=level-solution>Show solution</a></div></li><li><div class=level-nav><a href=# class="level-nav-button js-nav-button" id=prev title="Previous Level"><i class=icon-caret-left></i>Previous</a> <a href=# class="level-nav-button js-nav-button" id=next><i class=icon-caret-right title="Next Level"></i>Next</a></div></li></ul></nav></header><div class=main><div class=game-wrapper><div class=game onselectstart="return false"><canvas id=game-main height=600 width=600></canvas></div></div><div class=victory><div><h1>Congratulations!</h1>Level completed.</div></div></div>