-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmin.js
45 lines (45 loc) · 23.1 KB
/
min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(function(){function r(a,b){return'<svg class="'+(b?b+" ":"")+a+'"><use xlink:href="#'+a+'"/></svg>'}function B(a){return"_"===a?"":/[0-3]/.test(a)?r("map-r"+a):/[a-e]/.test(a)?r("map-item-"+a):r("map-tile-"+a.toLowerCase())}function k(a,b,c,d,e,J){function H(){clearInterval(I);g.stop()}var f=0;if(t){var g=t.createOscillator();var h=t.createGain();g.connect(h);h.connect(t.destination);g.frequency.value=a;g.type=["square","sawtooth","triangle","sine"][J||0];h.gain.value=0;g.start();var I=setInterval(function(){g.frequency.value=
a+b*f;h.gain.value=(1-f/d)*e;f++;f>d&&setTimeout(H,c)},c)}}function e(){this.insertLeft=document.getElementById("insert-left");this.insertRight=document.getElementById("insert-right");this.insertGo=document.getElementById("insert-go");this.insertUp=document.getElementById("insert-up");this.insertDown=document.getElementById("insert-down");this.insertRepeat=document.getElementById("insert-repeat");this.leftButton=document.getElementById("button-left");this.rightButton=document.getElementById("button-right");
this.delButton=document.getElementById("button-del");this.plusButton=document.getElementById("button-plus");this.minusButton=document.getElementById("button-minus");this.insertLeft.innerHTML=d.symbol("code-left");this.insertRight.innerHTML=d.symbol("code-right");this.insertGo.innerHTML=d.symbol("code-go");this.insertUp.innerHTML=d.symbol("code-up");this.insertDown.innerHTML=d.symbol("code-down");this.insertRepeat.innerHTML=d.symbol("code-repeat");this.insertLeft.addEventListener("click",this.onClick.bind(this));
this.insertRight.addEventListener("click",this.onClick.bind(this));this.insertGo.addEventListener("click",this.onClick.bind(this));this.insertUp.addEventListener("click",this.onClick.bind(this));this.insertDown.addEventListener("click",this.onClick.bind(this));this.insertRepeat.addEventListener("click",this.onClick.bind(this));this.leftButton.addEventListener("click",this.onClick.bind(this));this.rightButton.addEventListener("click",this.onClick.bind(this));this.delButton.addEventListener("click",
this.onClick.bind(this));this.plusButton.addEventListener("click",this.onClick.bind(this));this.minusButton.addEventListener("click",this.onClick.bind(this));document.body.addEventListener("keydown",this.onKey.bind(this));this.clear()}function p(a){this.grid=a.split("-").map(function(a,c){var b=/(.*)([0-3])(.*)/.exec(a);b&&(this.start=[b[1].length,c,Number(b[2])],a=b[1]+"_"+b[3]);return a.split("")}.bind(this))}function l(a){var b=a.getStart();this.x=b[0];this.y=b[1];this.dir=b[2];this.map=a}function n(a,
b,c){this.map=new p(a);this.robot=new l(this.map);this.robot.setCode(b);this.codeStr=b;this.pos=0;this.onend=c;this.running=!0;this.done=!1;this.pause=1E3}function g(a,b,c){this.title=a;this.mapStr=b;this.onend=c;this.abortButton=document.getElementById("abort-button");this.runButton=document.getElementById("run-button");this.cancelButton=document.getElementById("cancel-button");this.resetButton=document.getElementById("reset-button");this.pauseInput=document.getElementById("pause-input");this.wrapper=
document.getElementById("level-wrapper");this.boundOnAbort=this.onAbort.bind(this);this.boundOnStart=this.onStart.bind(this);this.boundOnCancel=this.onCancel.bind(this);this.boundOnReset=this.onReset.bind(this);this.boundOnUpdatePause=this.onUpdatePause.bind(this)}function h(a){this.levelGroups=a;this.menuArea=document.getElementById("level-menu");this.menuArea.addEventListener("click",this.onclick.bind(this));this.scores=q.get("scores",{});this.infoEntry=-1}function f(a){this.grid=a.split("-").map(function(a){return a.split("")});
document.getElementById("radio-input").innerHTML="_FaAbBcCdDeE0123".split("").map(function(a){return'<label><input type="radio" name="radios" value="'+a+'"'+("_"===a?" checked":"")+">"+(d.mapSymbol(a)||"<svg></svg>")+"</label>"}).join("");this.radioInput=document.getElementById("radio-input").getElementsByTagName("input");this.editorArea=document.getElementById("editor-area");this.runArea=document.getElementById("run-area");this.mapTable=document.getElementById("map");this.playButton=document.getElementById("play-button");
this.widthInput=document.getElementById("width-input");this.heightInput=document.getElementById("height-input");this.widthInput.value=this.grid[0].length;this.heightInput.value=this.grid.length;this.boundOnSizeChange=this.onSizeChange.bind(this);this.boundOnMapClick=this.onMapClick.bind(this);this.boundOnPlayClick=this.onPlayClick.bind(this)}function C(){var a=x.checked;m.setMuted(!a);q.set("sound",a)}var q={get:function(a,b){try{return JSON.parse(localStorage.getItem("schnark-js13k2018-"+a)||"x")}catch(c){return b}},
set:function(a,b){try{localStorage.setItem("schnark-js13k2018-"+a,JSON.stringify(b))}catch(c){}}};var D=document.getElementById("overlay"),y=document.getElementById("info-close"),z,K={"<":"code-left",">":"code-right",_:"code-go",",":"code-up",".":"code-down",")":"code-repeat"};y.disabled=!1;y.addEventListener("click",function(){D.className="";z&&z()});var d={title:function(a){document.getElementById("title").textContent=a},info:function(a,b){document.getElementById("info-box").innerHTML=a;D.className=
"visible";z=b;y.focus()},error:function(a){document.getElementById("error").textContent=a},symbol:r,code:function(a,b){document.getElementById("code").innerHTML=a.split("").map(function(a,d){return" "===a?'<svg class="highlight"></svg>':r(K[a]||"code-"+a,d===b&&"highlight")}).join("")},mapSymbol:B,map:function(a){document.getElementById("map").innerHTML="<table><tr>"+a.split("").map(function(a){return"-"===a?"</tr><tr>":"<td>"+B(a)+"</td>"}).join("")+"</tr></table>"}};var t,E=!1;var m={init:function(){var a=
window.AudioContext;a&&(t=new a)},setMuted:function(a){E=a},play:function(a){if(!E)switch(a){case "move":k(100,-10,15,15,.7,2);break;case "turn":k(260,-60,15,15,.4,2);break;case "take":k(220,15,15,15,.3,2);break;case "drop":k(440,-15,15,15,.3,2);break;case "drop-final":k(510,0,15,20,.05);break;case "error":k(440,-15,15,15,.5);setTimeout(function(){k(100,-10,10,25,.5)},300);break;case "win":k(510,0,15,20,.1),setTimeout(function(){k(2600,1,10,50,.2)},80)}}};var F=q.get("info",-1),L=["<p>Welcome! Your task is to program a robot to run <b>offline</b>. You enter the code, and once you start the robot, you can no longer change it. So you have to plan ahead how your robot should run. The tutorial levels will teach you how to do so.</p>",
"<p>Use the virtual keyboard to enter the code for the robot. You have to <kbd>"+d.symbol("code-up")+"</kbd> take the <kbd>"+d.symbol("map-item-a")+"</kbd> item, <kbd>"+d.symbol("code-go")+"</kbd> advance one step, and <kbd>"+d.symbol("code-down")+"</kbd> drop it on the <kbd>"+d.symbol("map-tile-a")+"</kbd> target.</p><p>Then <kbd>"+d.symbol("go")+"</kbd> run the code. If the robot crashes, you have to <kbd>"+d.symbol("reset")+"</kbd> reset it. Use the slider to regulate its speed.</p><p>If you prefer your real keyboard, then type cursor up, underscore, cursor down, enter instead.</p>",
"<p>You can also turn the robot and repeat parts of the code. For example <kbd>"+d.symbol("code-4")+d.symbol("code-right")+d.symbol("code-repeat")+"</kbd> will turn the robot four times clockwise, after which everything will be the same. To enter this code, use the <kbd>"+d.symbol("code-repeat")+"</kbd> key, increment using the <kbd>"+d.symbol("plus")+"</kbd> key, and insert the code to repeat in the middle (use <kbd>"+d.symbol("left")+"</kbd><kbd>"+d.symbol("right")+"</kbd> to move the cursor).</p><p>Or again, if you prefer your real keyboard, type 4> for the above code.</p>",
"This time, you have three items and three targets. You must take the red item to the red target, and the blue items to the blue targets, but it doesn’t matter which blue item you take to which blue target, as long as you take one to each of them.</p><p>Note that the robot can only carry one item at a time, but that you can also drop an item on an empty place and pick it up again later.</p>","<p>Congratulations! You just unlocked the editor. Now you can create your own levels, play them, and share them (just share the URL once you tested your level).</p>",
"<p>First, decide on the size of the map (up to 10x10), and then fill it by selecting the tile and clicking on the map to place it there. Note that you need exactly one starting position, at least one target, and the items and targets must match.</p>"];var A={show:function(a){F<a&&d.info(L[a],function(){F=a;q.set("info",a)})}};e.prototype.update=function(){var a=this.pre.slice(-1);d.code(this.pre+" "+this.post);this.leftButton.disabled=!this.pre;this.rightButton.disabled=!this.post;this.delButton.disabled=!this.pre;
this.plusButton.disabled="2">a||"8"<a;this.minusButton.disabled="3">a||"9"<a};e.prototype.get=function(){return this.pre+this.post};e.prototype.clear=function(){this.post=this.pre="";this.update()};e.prototype.enable=function(){this.insertLeft.disabled=!1;this.insertRight.disabled=!1;this.insertGo.disabled=!1;this.insertUp.disabled=!1;this.insertDown.disabled=!1;this.insertRepeat.disabled=!1;this.update()};e.prototype.disable=function(){this.insertLeft.disabled=!0;this.insertRight.disabled=!0;this.insertGo.disabled=
!0;this.insertUp.disabled=!0;this.insertDown.disabled=!0;this.insertRepeat.disabled=!0;this.leftButton.disabled=!0;this.rightButton.disabled=!0;this.delButton.disabled=!0;this.plusButton.disabled=!0;this.minusButton.disabled=!0};e.prototype.pos1=function(){this.post=this.pre+this.post;this.pre="";this.update()};e.prototype.end=function(){this.pre+=this.post;this.post="";this.update()};e.prototype.left=function(){this.post=this.pre.slice(-1)+this.post;this.pre=this.pre.slice(0,-1);this.update()};e.prototype.right=
function(){this.pre+=this.post.slice(0,1);this.post=this.post.slice(1);this.update()};e.prototype.plus=function(){this.pre=this.pre.slice(0,-1)+String(Number(this.pre.slice(-1))+1);this.update()};e.prototype.minus=function(){this.pre=this.pre.slice(0,-1)+String(Number(this.pre.slice(-1))-1);this.update()};e.prototype.insert=function(a,b){this.pre+=a;b&&(this.post=b+this.post);this.update()};e.prototype.del=function(){var a=this.pre.slice(-1),b=0,c;if(")"===a)for(c=this.pre.length-2;;){a=this.pre.charAt(c);
if(")"===a)b++;else if("2"<=a&&"9">=a)if(0===b){this.pre=this.pre.slice(0,c)+this.pre.slice(c+1);break}else b--;c--}else if("2"<=a&&"9">=a)for(c=0;;){a=this.post.charAt(c);if(")"===a)if(0===b){this.post=this.post.slice(0,c)+this.post.slice(c+1);break}else b--;else"2"<=a&&"9">=a&&b++;c++}this.pre=this.pre.slice(0,-1);this.update()};e.prototype.handleKey=function(a){switch(a){case "pos1":this.pos1();break;case "end":this.end();break;case "left":this.left();break;case "right":this.right();break;case "del":this.del();
break;case "plus":this.plus();break;case "minus":this.minus();break;default:this.insert(a.slice(0,1),a.slice(1))}};e.prototype.onClick=function(a){(a=a.currentTarget.dataset.key)&&this.handleKey(a)};e.prototype.onKey=function(a){if(!this.insertLeft.disabled){var b=a.key;switch(b){case "Enter":var c="start";break;case "ArrowLeft":c="left";break;case "ArrowDown":c=".";break;case "ArrowUp":c=",";break;case "ArrowRight":c="right";break;case "End":c="end";break;case "Home":c="pos1";break;case "Backspace":c=
"del";break;case "+":c="plus";break;case "-":c="minus";break;default:/^[2-9]$/.test(b)?c=b+")":/^[_<>]$/.test(b)&&(c=b)}c&&(a.preventDefault(),"start"===c?document.getElementById("run-button").click():(a=document.querySelector('[data-key="'+c+'"]'))&&a.disabled||this.handleKey(c))}};p.prototype.getStart=function(){return this.start};p.prototype.getType=function(a,b){return(this.grid[b]||[])[a]||""};p.prototype.setType=function(a,b,c){this.grid[b][a]=c};p.prototype.allDone=function(){return!/[A-E]/.test(this.grid.map(function(a){return a.join("")}).join(""))};
p.prototype.draw=function(a){var b=a.getPos();d.map(this.grid.map(function(a,d){var c=a.join("");d===b[1]&&(c=c.slice(0,b[0])+b[2]+c.slice(b[0]+1));return c}).join("-"))};l.prototype.getPos=function(){return[this.x,this.y,this.dir]};l.prototype.setCode=function(a){this.code=this.origCode=a;this.codePos=0;this.stack=[]};l.prototype.getNextPos=function(){switch(this.dir){case 0:return[this.x,this.y-1];case 1:return[this.x+1,this.y];case 2:return[this.x,this.y+1];case 3:return[this.x-1,this.y]}};l.prototype.move=
function(){var a=this.getNextPos();var b=this.map.getType(a[0],a[1]);if("_"!==b)throw b=/[A-EG]/.test(b)?"target":/[a-e]/.test(b)?"item":"wall","Crashed into "+b+"!";this.x=a[0];this.y=a[1];m.play("move")};l.prototype.turn=function(a){this.dir=(this.dir+a+4)%4;m.play("turn")};l.prototype.take=function(){if(this.item)throw"Can’t take two items!";var a=this.getNextPos();var b=this.map.getType(a[0],a[1]);if(!/[a-e]/.test(b))throw"No item to take!";this.item=b;this.map.setType(a[0],a[1],"_");m.play("take")};
l.prototype.drop=function(){if(!this.item)throw"No item to drop!";var a=this.getNextPos();var b=this.map.getType(a[0],a[1]);if("_"!==b&&b!==this.item.toUpperCase())throw"Can’t drop item here!";this.map.setType(a[0],a[1],"_"===b?this.item:"G");this.item="";m.play("_"===b?"drop":"drop-final")};l.prototype.step=function(){var a=this.code[this.codePos];switch(a){case "<":this.turn(-1);break;case ">":this.turn(1);break;case "_":this.move();break;case ",":this.take();break;case ".":this.drop();break;
case ")":a=this.stack.pop();-1!==a&&(this.codePos=a-1);break;case "1":this.code=this.code.slice(0,this.codePos)+this.origCode.charAt(this.codePos)+this.code.slice(this.codePos+1);this.stack.push(-1);break;default:this.code=this.code.slice(0,this.codePos)+String(Number(a)-1)+this.code.slice(this.codePos+1),this.stack.push(this.codePos)}this.codePos++;return this.codePos};n.prototype.showError=function(a){d.error(a);a&&m.play("error")};n.prototype.showCode=function(){d.code(this.codeStr,this.pos)};
n.prototype.step=function(){if(this.pos>=this.codeStr.length)this.running=!1,this.map.allDone()?(this.done=!0,m.play("win")):this.showError("Not all targets reached!");else if(this.stepTypeShow)this.showCode();else{try{this.pos=this.robot.step()}catch(a){this.showError(a),this.running=!1}this.map.draw(this.robot)}if(this.running)this.stepTypeShow=!this.stepTypeShow,this.timeoutId=setTimeout(this.step.bind(this),this.pause/2);else this.onend(this.done)};n.prototype.cancel=function(){this.running&&
(clearTimeout(this.timeoutId),this.onend(!1))};n.prototype.setPause=function(a){this.pause=a};n.prototype.run=function(){this.showError("");this.map.draw(this.robot);this.stepTypeShow=!0;this.step()};g.prototype.bind=function(){this.abortButton.addEventListener("click",this.boundOnAbort);this.runButton.addEventListener("click",this.boundOnStart);this.cancelButton.addEventListener("click",this.boundOnCancel);this.resetButton.addEventListener("click",this.boundOnReset);this.pauseInput.addEventListener("change",
this.boundOnUpdatePause)};g.prototype.unbind=function(){this.abortButton.removeEventListener("click",this.boundOnAbort);this.runButton.removeEventListener("click",this.boundOnStart);this.cancelButton.removeEventListener("click",this.boundOnCancel);this.resetButton.removeEventListener("click",this.boundOnReset);this.pauseInput.removeEventListener("change",this.boundOnUpdatePause)};g.prototype.show=function(){document.documentElement.scrollTop=0;d.title(this.title);this.onReset();this.bind();this.wrapper.hidden=
!1;this.abortButton.hidden=!1;u.clear()};g.prototype.showEditor=function(){document.documentElement.scrollTop=0;d.title("Editor");this.bind();this.wrapper.hidden=!1;this.abortButton.hidden=!1;G.show(this);u.disable()};g.prototype.end=function(a){this.unbind();this.onend(a,function(){this.title||G.hide();this.wrapper.hidden=!0;this.abortButton.hidden=!0}.bind(this))};g.prototype.onAbort=function(){this.end(-1)};g.prototype.onStart=function(){var a=u.get();this.run=new n(this.mapStr,a,function(b){this.cancelButton.disabled=
!0;this.abortButton.disabled=!1;b?this.end(a.length):(this.resetButton.disabled=!1,this.resetButton.focus())}.bind(this));this.onUpdatePause();u.disable();this.abortButton.disabled=!0;this.runButton.disabled=!0;this.cancelButton.disabled=!1;this.run.run()};g.prototype.onCancel=function(){this.run.cancel();this.cancelButton.disabled=!0;this.abortButton.disabled=!1};g.prototype.onReset=function(){d.map(this.mapStr);d.error("");d.code("");this.abortButton.disabled=!1;this.runButton.disabled=!1;this.cancelButton.disabled=
!0;this.resetButton.disabled=!0;this.resetButton.blur();u.enable()};g.prototype.onUpdatePause=function(){this.run&&this.run.setPause(250*Math.pow(2,4-this.pauseInput.value/2))};h.prototype.init=function(){this.buildMenu();this.show()};h.prototype.initSound=function(){this.initSoundDone||(m.init(),this.initSoundDone=!0)};h.prototype.getScore=function(a){return this.scores[a]||-1};h.prototype.setScore=function(a,b){this.scores[a]=b;q.set("scores",this.scores)};h.prototype.buildMenu=function(){var a=
0;this.menuArea.innerHTML=this.levelGroups.map(function(b,c){if(a<b.req)return b.editor?"":"<h2>"+b.title+" "+d.symbol("lock")+"</h2>";"info"in b&&(this.infoEntry=b.info);return"<h2>"+b.title+"</h2>"+b.levels.map(function(b,f){if(b.map)if(a<b.req)var e="lock";else e=this.getScore(b.map),e=-1===e?"":e<(b.top||Infinity)?"star-2":e===b.top?"star":"ok";else e="";""!==e&&"lock"!==e&&a++;return"<button "+("lock"===e?"disabled":b.map?'data-id="'+c+"|"+f+'"':'data-id="editor"')+">"+b.title+(e?" "+d.symbol(e):
"")+"</button>"}.bind(this)).join("")}.bind(this)).join("")};h.prototype.onclick=function(a){if(a=a.target.dataset.id)this.initSound(),"editor"===a?this.showEditor():(a=a.split("|"),this.startLevel(a[0],a[1]))};h.prototype.show=function(){document.documentElement.scrollTop=0;d.title("Robot Coder");this.menuArea.hidden=!1;-1<this.infoEntry&&A.show(this.infoEntry)};h.prototype.startLevel=function(a,b){var c=this.levelGroups[a].levels[b];var d=new g(c.title,c.map,function(c,d){this.endLevel(a,b,c,d)}.bind(this));
this.menuArea.hidden=!0;d.show();"info"in c&&A.show(c.info)};h.prototype.showEditor=function(){var a=new g(!1,!1,function(a,c){c();-1!==a?(location="#"+a,this.levelGroups[this.levelGroups.length-1].levels[1]={title:"Play level",map:a},this.buildMenu(),this.startLevel(this.levelGroups.length-1,1)):this.show()}.bind(this));this.menuArea.hidden=!0;a.showEditor();a=this.levelGroups[this.levelGroups.length-1].levels[0];"info"in a&&A.show(a.info)};h.prototype.endLevel=function(a,b,c,e){function f(){e();
this.show()}var g=!1;if(-1<c){var h=this.levelGroups[a].levels[b].map;var k=this.getScore(h);a=this.levelGroups[a].levels[b].top||Infinity;-1===k?(b="Level solved!",c>a&&(b+=" But there is a shorter solution, try to find it!"),g=!0):(b="Level solved again!",c>k?b+=" But your previous solution was shorter!":c<k&&(b="Level solved again with a shorter solution than before!",g=!0),c<=k&&c>a&&(b+=" But there is a shorter solution, try to find it!"));d.info(b,f.bind(this));g&&(this.setScore(h,c),this.buildMenu())}else e(),
this.show()};f.isValid=function(a){a=a.split("-");if(10<a.length||0===a[0].length||10<a[0].length||!a.every(function(b){return b.length===a[0].length}))return!1;a=a.join("");return/[^a-eA-F0-3_]/.test(a)||1!==a.replace(/[^0-3]/g,"").length||!/[a-e]/.test(a)||a.replace(/[^a-e]/g,"").split("").sort().join("")!==a.replace(/[^A-E]/g,"").split("").sort().join("").toLowerCase()?!1:!0};f.prototype.bind=function(){this.widthInput.addEventListener("change",this.boundOnSizeChange);this.heightInput.addEventListener("change",
this.boundOnSizeChange);this.mapTable.addEventListener("click",this.boundOnMapClick);this.playButton.addEventListener("click",this.boundOnPlayClick)};f.prototype.unbind=function(){this.widthInput.removeEventListener("change",this.boundOnSizeChange);this.heightInput.removeEventListener("change",this.boundOnSizeChange);this.mapTable.removeEventListener("click",this.boundOnMapClick);this.playButton.removeEventListener("click",this.boundOnPlayClick)};f.prototype.show=function(a){this.level=a;this.bind();
this.editorArea.hidden=!1;this.runArea.hidden=!0;this.update()};f.prototype.hide=function(){this.unbind();this.editorArea.hidden=!0;this.runArea.hidden=!1};f.prototype.getStr=function(){return this.grid.map(function(a){return a.join("")}).join("-")};f.prototype.update=function(){var a=this.getStr();d.map(a);this.playButton.disabled=!f.isValid(a)};f.prototype.changeSize=function(a,b){var c;if(this.grid.length<b)for(c=this.grid.length;c<b;c++)this.grid[c]=Array(Number(a)+1).join("_").split("");else this.grid.length=
b;this.grid.forEach(function(b){if(b.length<a)for(c=b.length;c<a;c++)b[c]="_";else b.length=a});this.update()};f.prototype.changeMap=function(a,b,c){this.grid[b][a]=c;this.update()};f.prototype.onSizeChange=function(){var a=this.widthInput.value,b=this.heightInput.value;1<=a&&1<=b&&10>=a&&10>=b&&this.changeSize(a,b)};f.prototype.onMapClick=function(a){a=a.target;for(var b;a&&"TD"!==a.nodeName&&"TABLE"!==a.nodeName;)a=a.parentNode;if(a&&"TD"===a.nodeName){for(b=0;b<this.radioInput.length;b++)if(this.radioInput[b].checked){b=
this.radioInput[b].value;break}this.changeMap(a.cellIndex,a.parentNode.rowIndex,b)}};f.prototype.onPlayClick=function(){this.level.end(this.getStr())};var u=new e;var x=document.getElementById("sound-checkbox");x.checked=q.get("sound",!0);x.addEventListener("change",C);C();var w=[{title:"Tutorial",info:0,levels:[{title:"Tutorial 1",map:"Aa3",top:3,info:1},{title:"Tutorial 2",map:"A______1a",top:7,req:1,info:2},{title:"Tutorial 3",map:"FFFFbF-b___1B-A____a-FFFFBF",top:18,req:2,info:3}]},{title:"Let’s Start!",
req:3,levels:[{title:"Welcome!",map:"A___a-_____-__0__",top:10},{title:"One",map:"__A-_F2-a__",top:10,req:4},{title:"Two",map:"a_A-_1_-A_a",top:10,req:5},{title:"Three",map:"B__b-C__c-A_1a",top:16,req:6},{title:"Four",map:"B__C-_bc_-1ad_-A__D",top:12,req:7},{title:"Five",map:"ABCDE-abcde-1____",top:11,req:8}]},{title:"Circling the Square",req:4,levels:[{title:"Easy Square",map:"FFFAFFF-F__2__F-F__a__F-D_dFb_B-F__c__F-F_____F-FFFCFFF",top:12},{title:"Still Easy",map:"FFFAFFF-F__2__F-F__b__F-D_aFc_B-F__d__F-F_____F-FFFCFFF",
top:13,req:5},{title:"Full Square",map:"_FAFBF_-F1acb_F-DdFCFdD-FbBFAaF-CcFDFcC-F_adb_F-_FAFBF_",top:19,req:7},{title:"Easy again",map:"b___d-_FDF_-1BFC_-_FAF_-a___c",top:16,req:9},{title:"Not So Easy",map:"a___b-_FDF_-1BFC_-_FAF_-c___d",top:43,req:10}]},{title:"JS13K",req:5,levels:[{title:"J",map:"A____-___F_-___F_-_FaF_-__F1_-_____",top:17},{title:"S",map:"______-__FFF_-_Fa___-__FF__-__3AF_-_FFF__-______",top:34,req:6},{title:"1",map:"B____-__FF_-_F2F_-___F_-___F_-___F_-C__bc",top:27,req:9},{title:"3",
map:"____B-_FF__-__bF_-1FF__-__cF_-_FF__-____C",top:36,req:10},{title:"K",map:"A_____-_F__F_-_FaF__-_FFe_E-_FcF__-_F__F_-_F__F_-C___3_",top:50,req:13}]},{title:"Even More Levels",req:7,levels:[{title:"Stairs",map:"__FF_A-_FF__F-FF__FF-F__FF_-1aFF__",top:8},{title:"Upside down",map:"A_e-B_d-C3c-D_b-E_a",top:43,req:11},{title:"Clock",map:"__FFAFFF__-_FF_a_FFF_-FFDd_bBCFF-FFC____c_F-F_c_0___dD-Bb_____a_F-F_a____AFF-FFADd_bBFF-_FFF_c_FF_-__FFFCFF__",top:18,req:15},{title:"Race Course",map:"______A-aBFFFFF-_______-FFFFFCb-_______-cDFFFFF-_____1d",
top:43,req:19},{title:"Crazy",map:"____E_____-D_B_dAcB_C-_1__e_____-E_A__a_D_a-__db_dC_Ab-_B_C__eb__-a__ac__C_c-__e_bA___D-E_D___d_B_-__e__E___c",req:23}]},{title:"Editor",req:5,editor:!0,info:4,levels:[{title:"Start editor",info:5}]}];if(location.hash){var v=location.hash.slice(1);f.isValid(v)||(v=!1)}v&&w.splice(-1,0,{title:"Bonus",levels:[{title:"Bonus",map:v}]});var G=new f(v||"_");w=new h(w);w.init()})();