-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHatchOut.html
17 lines (17 loc) · 224 KB
/
HatchOut.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="description" content="Dinosaur Egg: Growing Pet"><title>Dinosaur Egg: Growing Pet</title><style>body{background-color:black;font-family:"Courier New",Courier,monospace;touch-action:none}#gameCanvas{position:absolute;top:0;left:0;width:100%;height:100%;bottom:0;right:0;border:0;background-color:black;-webkit-tap-highlight-color:transparent;image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.homepagelink{overflow:hidden;text-overflow:ellipsis;max-width:50%}h1{color:lightblue;font-weight:400;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;height:2em;margin-top:.5em;margin-bottom:.5em}a{color:lightblue}.title{background-color:none;text-align:center;font-size:100%;float:center;color:gray;position:absolute;left:10%;right:10%;top:0;height:3em}.footer{background-color:none;text-align:center;float:center;color:#fff;position:absolute;left:0;right:0;height:3em;bottom:0}.gameContainer{background-color:none;position:absolute;left:0;right:0;top:3.5em;bottom:3em;touch-action:none}.mobile-menu{position:relative;top:5em;left:.7em;margin-left:auto;margin-right:auto;font-weight:700;border-radius:.25em}.mobile-menu.item-count-3{width:30em}.mobile-menu.item-count-3 .button{width:28.3333%;padding:7.5% 0}.mobile-menu.item-count-2{width:20em}.mobile-menu.item-count-2 .button{width:46%;padding:12.1765% 0}.mobile-menu.item-count-1{width:10em}.mobile-menu.item-count-1 .button{width:98%;padding:26.5% 0}.mobile-menu,.mobile-menu .close,.tab-icon{background:rgba(0,0,0,.4);border:2px solid rgba(255,255,255,.4);color:#fff}.mobile-menu .button{margin:2%;border-radius:.25em;text-align:center;float:left}.mobile-menu .clear{clear:both}.close-affordance,.tab-affordance{width:6em;height:6em;position:absolute;z-index:1000}.tab-affordance{left:-2em;top:5em}.close-affordance{left:-4em;top:-1em}.mobile-menu .close,.tab-icon{height:48px;position:absolute;border-radius:6px}.tab-icon{left:0;top:70px;width:18px;border-radius:0 6px 6px 0;border-left:0}.mobile-menu .close{left:-18px;width:18px;top:0;border-radius:6px 0 0 6px;border-right:0}.mobile-menu .close .slice,.tab-icon .slice{margin:4.5px 1px;width:2px;height:80%;background:rgba(255,255,255,.4)}.tab-icon .slice{float:right}.tab-icon .slice:first-child{margin-right:4.5px}.mobile-menu .close .slice{float:left}.mobile-menu .close .slice:first-child{margin-left:4.5px}@media screen and (max-width:32em){.mobile-menu{font-size:.8em;width:90%}}@media screen and (max-width:24em){.mobile-menu{font-size:.65em;width:90%}}.disable-select{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}a{display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:80%}</style><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"></head><body><div class="title"><h1 id="gametitle">Dinosaur Egg: Growing Pet</h1></div><div class="gameContainer"><canvas id="gameCanvas"></canvas></div><div class="footer"><span id="errormessage" style="color:red"></span> <a id="homepagelink" href="https://www.puzzlescript.net" target="_blank">www.puzzlescript.net</a></div><script>function storage_has(e){return null!==localStorage.getItem(e)}function storage_get(e){return localStorage.getItem(e)}function storage_set(e,n){return localStorage.setItem(e,n)}function storage_remove(e){localStorage.removeItem(e)}function BitVec(e){this.data=new Int32Array(e)}function Level(e,n,t,r,o){this.lineNumber=e,this.width=n,this.height=t,this.n_tiles=n*t,this.objects=o,this.layerCount=r,this.commandQueue=[],this.commandQueueSourceRules=[]}var _movementVecs;BitVec.prototype.cloneInto=function(e){for(var n=0;n<this.data.length;++n)e.data[n]=this.data[n];return e},BitVec.prototype.clone=function(){return new BitVec(this.data)},BitVec.prototype.iand=function(e){for(var n=0;n<this.data.length;++n)this.data[n]&=e.data[n]},BitVec.prototype.inot=function(){for(var e=0;e<this.data.length;++e)this.data[e]=~this.data[e]},BitVec.prototype.ior=function(e){for(var n=0;n<this.data.length;++n)this.data[n]|=e.data[n]},BitVec.prototype.iclear=function(e){for(var n=0;n<this.data.length;++n)this.data[n]&=~e.data[n]},BitVec.prototype.ibitset=function(e){this.data[e>>5]|=1<<(31&e)},BitVec.prototype.ibitclear=function(e){this.data[e>>5]&=~(1<<(31&e))},BitVec.prototype.get=function(e){return 0!=(this.data[e>>5]&1<<(31&e))},BitVec.prototype.getshiftor=function(e,n){var t=31&n,r=this.data[n>>5]>>>t;return t&&(r|=this.data[1+(n>>5)]<<32-t),r&e},BitVec.prototype.ishiftor=function(e,n){var t=31&n,r=e<<t;if(this.data[n>>5]|=r,t){var o=e>>32-t;this.data[1+(n>>5)]|=o}},BitVec.prototype.ishiftclear=function(e,n){var t=31&n,r=e<<t;if(this.data[n>>5]&=~r,t){var o=e>>32-(31&n);this.data[1+(n>>5)]&=~o}},BitVec.prototype.equals=function(e){if(this.data.length!==e.data.length)return!1;for(var n=0;n<this.data.length;++n)if(this.data[n]!==e.data[n])return!1;return!0},BitVec.prototype.setZero=function(){for(var e=0;e<this.data.length;++e)this.data[e]=0},BitVec.prototype.iszero=function(){for(var e=0;e<this.data.length;++e)if(this.data[e])return!1;return!0},BitVec.prototype.bitsSetInArray=function(e){for(var n=0;n<this.data.length;++n)if((this.data[n]&e[n])!==this.data[n])return!1;return!0},BitVec.prototype.bitsClearInArray=function(e){for(var n=0;n<this.data.length;++n)if(this.data[n]&e[n])return!1;return!0},BitVec.prototype.anyBitsInCommon=function(e){return!this.bitsClearInArray(e.data)},Level.prototype.delta_index=function(e){const[n,t]=dirMasksDelta[e];return n*this.height+t},Level.prototype.clone=function(){var e=new Level(this.lineNumber,this.width,this.height,this.layerCount,null);return e.objects=new Int32Array(this.objects),e},Level.prototype.getCell=function(e){return new BitVec(this.objects.subarray(e*STRIDE_OBJ,e*STRIDE_OBJ+STRIDE_OBJ))},Level.prototype.getCellInto=function(e,n){for(var t=0;t<STRIDE_OBJ;t++)n.data[t]=this.objects[e*STRIDE_OBJ+t];return n},Level.prototype.setCell=function(e,n){for(var t=0;t<n.data.length;++t)this.objects[e*STRIDE_OBJ+t]=n.data[t]};var _movementVecIndex=0;Level.prototype.getMovements=function(e){var n=_movementVecs[_movementVecIndex];_movementVecIndex=(_movementVecIndex+1)%_movementVecs.length;for(var t=0;t<STRIDE_MOV;t++)n.data[t]=this.movements[e*STRIDE_MOV+t];return n},Level.prototype.getRigids=function(e){return this.rigidMovementAppliedMask[e].clone()},Level.prototype.getMovementsInto=function(e,n){for(var t=n,r=0;r<STRIDE_MOV;r++)t.data[r]=this.movements[e*STRIDE_MOV+r];return t},Level.prototype.setMovements=function(e,n){for(var t=0;t<n.data.length;++t)this.movements[e*STRIDE_MOV+t]=n.data[t];var r=e/this.height|0,o=e%this.height;level.colCellContents_Movements[r].ior(n),level.rowCellContents_Movements[o].ior(n),level.mapCellContents_Movements.ior(n)},Level.prototype.calcBackgroundMask=function(e){void 0===e.backgroundlayer&&logError("you have to have a background layer");for(var n=e.layerMasks[e.backgroundlayer],t=0;t<this.n_tiles;t++){var r=this.getCell(t);if(r.iand(n),!r.iszero())return r}return(r=new BitVec(STRIDE_OBJ)).ibitset(e.backgroundid),r};var unitTesting=!1,curlevel=0,curlevelTarget=null,hasUsedCheckpoint=!1,levelEditorOpened=!1,muted=0,runrulesonlevelstart_phase=!1,ignoreNotJustPressedAction=!0;function doSetupTitleScreenLevelContinue(){try{if(storage_has(document.URL)){if(storage_has(document.URL+"_checkpoint")){var e=storage_get(document.URL+"_checkpoint");curlevelTarget=JSON.parse(e);var n=[];for(var t in Object.keys(curlevelTarget.dat))n[t]=curlevelTarget.dat[t];curlevelTarget.dat=new Int32Array(n)}curlevel=storage_get(document.URL)}}catch(e){}}doSetupTitleScreenLevelContinue();var verbose_logging=!1,throttle_movement=!1,cache_console_messages=!1,quittingTitleScreen=!1,quittingMessageScreen=!1,deltatime=17,timer=0,repeatinterval=150,autotick=0,autotickinterval=0,winning=!1,againing=!1,againinterval=150,norepeat_action=!1,oldflickscreendat=[],keybuffer=[],restarting=!1,messageselected=!1,textImages={},level=new Level,canSetHTMLColors=!0,canDump=!1,canOpenEditor=!1,IDE=!1;const diffToVisualize=null;function stripTags(e){var n=document.createElement("div");return n.innerHTML=e,n.textContent||n.innerText||""}function consolePrint(e,n){}function consolePrintFromRule(e,n,t){}function consoleCacheDump(e){}function consoleError(e,n){var t=document.getElementById("errormessage");e=stripTags(e),t.innerHTML+=e+"<br>"}function logErrorNoLine(e){var n=document.getElementById("errormessage");e=stripTags(e),n.innerHTML+=e+"<br>"}function clearInputHistory(){}function pushInput(e){}function pushSoundToHistory(e){}var font={0:"\n00000\n00000\n00000\n01110\n10001\n10011\n10101\n11001\n10001\n01110\n00000\n00000",1:"\n00000\n00000\n00000\n11100\n00100\n00100\n00100\n00100\n00100\n11111\n00000\n00000",2:"\n00000\n00000\n00000\n11110\n00001\n00001\n01110\n10000\n10000\n11111\n00000\n00000",3:"\n00000\n00000\n00000\n11110\n00001\n00110\n00001\n00001\n00001\n11110\n00000\n00000",4:"\n00000\n00000\n00000\n10000\n10000\n10000\n10010\n11111\n00010\n00010\n00000\n00000",5:"\n00000\n00000\n00000\n11111\n10000\n11110\n00001\n00001\n00001\n11110\n00000\n00000",6:"\n00000\n00000\n00000\n01110\n10000\n11110\n10001\n10001\n10001\n01110\n00000\n00000",7:"\n00000\n00000\n00000\n11111\n00001\n00010\n00100\n00100\n00100\n00100\n00000\n00000",8:"\n00000\n00000\n00000\n01110\n10001\n01110\n10001\n10001\n10001\n01110\n00000\n00000",9:"\n00000\n00000\n00000\n01110\n10001\n10001\n10001\n01111\n00001\n01110\n00000\n00000",a:"\n00000\n00000\n00000\n00000\n00000\n01111\n10001\n10001\n10001\n01111\n00000\n00000",b:"\n00000\n00000\n00000\n10000\n10000\n11110\n10001\n10001\n10001\n01110\n00000\n00000",c:"\n00000\n00000\n00000\n00000\n00000\n01111\n10000\n10000\n10000\n01111\n00000\n00000",d:"\n00000\n00000\n00000\n00001\n00001\n01111\n10001\n10001\n10001\n01111\n00000\n00000",e:"\n00000\n00000\n00000\n00000\n00000\n01110\n10001\n11111\n10000\n01110\n00000\n00000",f:"\n00000\n00000\n00000\n00011\n00100\n11111\n00100\n00100\n00100\n00100\n00000\n00000",g:"\n00000\n00000\n00000\n00000\n00000\n01111\n10001\n10001\n10001\n01111\n00001\n01110",h:"\n00000\n00000\n00000\n10000\n10000\n11110\n10001\n10001\n10001\n10001\n00000\n00000",i:"\n00000\n00000\n00000\n00100\n00000\n01100\n00100\n00100\n00100\n01110\n00000\n00000",j:"\n00000\n00000\n00000\n00100\n00000\n01100\n00100\n00100\n00100\n00100\n10100\n01000",k:"\n00000\n00000\n00000\n10000\n10000\n10001\n10010\n11100\n10010\n10001\n00000\n00000",l:"\n00000\n00000\n00000\n01100\n00100\n00100\n00100\n00100\n00100\n01110\n00000\n00000",m:"\n00000\n00000\n00000\n00000\n00000\n01010\n10101\n10101\n10101\n10101\n00000\n00000",n:"\n00000\n00000\n00000\n00000\n00000\n01110\n10001\n10001\n10001\n10001\n00000\n00000",o:"\n00000\n00000\n00000\n00000\n00000\n01110\n10001\n10001\n10001\n01110\n00000\n00000",p:"\n00000\n00000\n00000\n00000\n00000\n11110\n10001\n10001\n10001\n11110\n10000\n10000",q:"\n00000\n00000\n00000\n00000\n00000\n01111\n10001\n10001\n10001\n01111\n00001\n00001",r:"\n00000\n00000\n00000\n00000\n00000\n01111\n10000\n10000\n10000\n10000\n00000\n00000",s:"\n00000\n00000\n00000\n00000\n00000\n01111\n10000\n01110\n00001\n11110\n00000\n00000",t:"\n00000\n00000\n00000\n00100\n00100\n11111\n00100\n00100\n00100\n00011\n00000\n00000",u:"\n00000\n00000\n00000\n00000\n00000\n10001\n10001\n10001\n10001\n01111\n00000\n00000",v:"\n00000\n00000\n00000\n00000\n00000\n10001\n10010\n10100\n11000\n10000\n00000\n00000",w:"\n00000\n00000\n00000\n00000\n00000\n10101\n10101\n10101\n10101\n01010\n00000\n00000",x:"\n00000\n00000\n00000\n00000\n00000\n10001\n01010\n00100\n01010\n10001\n00000\n00000","×":"\n00000\n00000\n00000\n00000\n00000\n10001\n01010\n00100\n01010\n10001\n00000\n00000",y:"\n00000\n00000\n00000\n00000\n00000\n10001\n10001\n10001\n10001\n01111\n00001\n11110",z:"\n00000\n00000\n00000\n00000\n00000\n11111\n00010\n00100\n01000\n11111\n00000\n00000",A:"\n00000\n00000\n00000\n01110\n10001\n10001\n10001\n11111\n10001\n10001\n00000\n00000",B:"\n00000\n00000\n00000\n11110\n10001\n11110\n10001\n10001\n10001\n11110\n00000\n00000",C:"\n00000\n00000\n00000\n01111\n10000\n10000\n10000\n10000\n10000\n01111\n00000\n00000",D:"\n00000\n00000\n00000\n11110\n10001\n10001\n10001\n10001\n10001\n11110\n00000\n00000",E:"\n00000\n00000\n00000\n11111\n10000\n11111\n10000\n10000\n10000\n11111\n00000\n00000",F:"\n00000\n00000\n00000\n11111\n10000\n11111\n10000\n10000\n10000\n10000\n00000\n00000",G:"\n00000\n00000\n00000\n01111\n10000\n10000\n10000\n10011\n10001\n01111\n00000\n00000",H:"\n00000\n00000\n00000\n10001\n10001\n11111\n10001\n10001\n10001\n10001\n00000\n00000",I:"\n00000\n00000\n00000\n11111\n00100\n00100\n00100\n00100\n00100\n11111\n00000\n00000",J:"\n00000\n00000\n00000\n01111\n00001\n00001\n00001\n00001\n00001\n01110\n00000\n00000",K:"\n00000\n00000\n00000\n10001\n10010\n10100\n11000\n10100\n10010\n10001\n00000\n00000",L:"\n00000\n00000\n00000\n10000\n10000\n10000\n10000\n10000\n10000\n11111\n00000\n00000",M:"\n00000\n00000\n00000\n11111\n10101\n10101\n10101\n10101\n10101\n10101\n00000\n00000",N:"\n00000\n00000\n00000\n10001\n11001\n10101\n10011\n10001\n10001\n10001\n00000\n00000",O:"\n00000\n00000\n00000\n01110\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000",P:"\n00000\n00000\n00000\n11110\n10001\n10001\n10001\n11110\n10000\n10000\n00000\n00000",Q:"\n00000\n00000\n00000\n01110\n10001\n10001\n10001\n10001\n10101\n01110\n00100\n00000",R:"\n00000\n00000\n00000\n11110\n10001\n10001\n11110\n10001\n10001\n10001\n00000\n00000",S:"\n00000\n00000\n00000\n01111\n10000\n01110\n00001\n00001\n00001\n11110\n00000\n00000",T:"\n00000\n00000\n00000\n11111\n00100\n00100\n00100\n00100\n00100\n00100\n00000\n00000",U:"\n00000\n00000\n00000\n10001\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000",V:"\n00000\n00000\n00000\n10001\n10001\n10001\n10001\n10001\n01010\n00100\n00000\n00000",W:"\n00000\n00000\n00000\n10101\n10101\n10101\n10101\n10101\n10101\n01010\n00000\n00000",X:"\n00000\n00000\n00000\n10001\n10001\n01010\n00100\n01010\n10001\n10001\n00000\n00000",Y:"\n00000\n00000\n00000\n10001\n10001\n01010\n00100\n00100\n00100\n00100\n00000\n00000",Z:"\n00000\n00000\n00000\n11111\n00001\n00010\n00100\n01000\n10000\n11111\n00000\n00000",".":"\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00100\n00000\n00000","·":"\n00000\n00000\n00000\n00000\n00000\n00000\n00100\n00000\n00000\n00000\n00000\n00000","•":"\n00000\n00000\n00000\n00000\n00000\n01110\n01110\n01110\n00000\n00000\n00000\n00000","…":"\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n10101\n00000\n00000","†":"\n00000\n00100\n00100\n01110\n00100\n00100\n00100\n00100\n00100\n00100\n00000\n00000","‡":"\n00000\n00100\n00100\n01110\n00100\n00100\n00100\n00100\n01110\n00100\n00000\n00000","ƒ":"\n00000\n00000\n00000\n00011\n00100\n11111\n00100\n00100\n00100\n00100\n01000\n00000","‚":"\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00100\n01100\n00000\n00000","„":"\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n01001\n11011\n00000\n00000",",":"\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00100\n01100\n00000\n00000",";":"\n00000\n00000\n00000\n00000\n00000\n00100\n00000\n00000\n00100\n01100\n00000\n00000",":":"\n00000\n00000\n00000\n00000\n00000\n00100\n00000\n00000\n00000\n00100\n00000\n00000","?":"\n00000\n00000\n00000\n01110\n10001\n00001\n00001\n00110\n00000\n00100\n00000\n00000","¿":"\n00000\n00000\n00000\n00100\n00000\n01100\n10000\n10000\n10001\n01110\n00000\n00000","!":"\n00000\n00000\n00000\n00100\n00100\n00100\n00100\n00100\n00000\n00100\n00000\n00000","¡":"\n00000\n00000\n00000\n00100\n00000\n00100\n00100\n00100\n00100\n00100\n00000\n00000","@":"\n00000\n00000\n00000\n00000\n00000\n01110\n10001\n10111\n10000\n01110\n00000\n00000","£":"\n00000\n00000\n00000\n00000\n00000\n01110\n01001\n11100\n01000\n11111\n00000\n00000",$:"\n00000\n00000\n00000\n00000\n00100\n01111\n10100\n01110\n00101\n11110\n00100\n00000","%":"\n00000\n00000\n00000\n00000\n00000\n11001\n11010\n00100\n01011\n10011\n00000\n00000","‰":"\n00000\n00000\n00000\n00000\n11001\n11010\n00100\n01011\n10011\n00000\n00011\n00011","^":"\n00000\n00000\n00000\n00100\n01010\n00000\n00000\n00000\n00000\n00000\n00000\n00000","&":"\n00000\n00000\n00000\n00000\n00000\n01100\n10000\n01011\n10010\n01100\n00000\n00000","*":"\n00000\n00000\n00000\n00000\n00000\n01010\n00100\n01010\n00000\n00000\n00000\n00000","(":"\n00000\n00000\n00000\n00010\n00100\n00100\n00100\n00100\n00100\n00010\n00000\n00000",")":"\n00000\n00000\n00000\n01000\n00100\n00100\n00100\n00100\n00100\n01000\n00000\n00000","+":"\n00000\n00000\n00000\n00000\n00000\n00100\n00100\n11111\n00100\n00100\n00000\n00000","÷":"\n00000\n00000\n00000\n00000\n00000\n00100\n00000\n11111\n00000\n00100\n00000\n00000","±":"\n00000\n00000\n00000\n00000\n00000\n00100\n00100\n11111\n00100\n11111\n00000\n00000","-":"\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n01110\n00000\n00000\n00000\n00000","–":"\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n11110\n00000\n00000\n00000\n00000","—":"\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n11111\n00000\n00000\n00000\n00000",_:"\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n11111\n00000\n00000","=":"\n00000\n00000\n00000\n00000\n00000\n00000\n11111\n00000\n11111\n00000\n00000\n00000"," ":"\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000","{":"\n00000\n00000\n00000\n00110\n00100\n00100\n01100\n00100\n00100\n00110\n00000\n00000","}":"\n00000\n00000\n00000\n01100\n00100\n00100\n00110\n00100\n00100\n01100\n00000\n00000","[":"\n00000\n00000\n00000\n00110\n00100\n00100\n00100\n00100\n00100\n00110\n00000\n00000","]":"\n00000\n00000\n00000\n01100\n00100\n00100\n00100\n00100\n00100\n01100\n00000\n00000","'":"\n00000\n00000\n00000\n00100\n00100\n00100\n00000\n00000\n00000\n00000\n00000\n00000","‘":"\n00000\n00000\n00000\n00110\n00100\n00000\n00000\n00000\n00000\n00000\n00000\n00000","’":"\n00000\n00000\n00000\n00100\n01100\n00000\n00000\n00000\n00000\n00000\n00000\n00000","“":"\n00000\n00000\n00000\n11011\n10010\n00000\n00000\n00000\n00000\n00000\n00000\n00000","”":"\n00000\n00000\n00000\n01001\n11011\n00000\n00000\n00000\n00000\n00000\n00000\n00000",'"':"\n00000\n00000\n00000\n01010\n01010\n01010\n00000\n00000\n00000\n00000\n00000\n00000","/":"\n00000\n00000\n00000\n00000\n00000\n00001\n00010\n00100\n01000\n10000\n00000\n00000","\\":"\n00000\n00000\n00000\n00000\n00000\n10000\n01000\n00100\n00010\n00001\n00000\n00000","|":"\n00000\n00000\n00000\n00000\n00000\n00100\n00100\n00100\n00100\n00100\n00000\n00000","¦":"\n00000\n00000\n00000\n00000\n00100\n00100\n00000\n00100\n00100\n00100\n00000\n00000","<":"\n00000\n00000\n00000\n00000\n00000\n00010\n00100\n01000\n00100\n00010\n00000\n00000","‹":"\n00000\n00000\n00000\n00000\n00000\n00000\n00100\n01000\n00100\n00000\n00000\n00000","«":"\n00000\n00000\n00000\n00000\n00000\n00000\n01001\n10010\n01001\n00000\n00000\n00000",">":"\n00000\n00000\n00000\n00000\n00000\n01000\n00100\n00010\n00100\n01000\n00000\n00000","›":"\n00000\n00000\n00000\n00000\n00000\n00000\n00100\n00010\n00100\n00000\n00000\n00000","»":"\n00000\n00000\n00000\n00000\n00000\n00000\n10010\n01001\n10010\n00000\n00000\n00000","~":"\n00000\n00000\n00000\n00000\n00000\n00000\n01000\n10101\n00010\n00000\n00000\n00000","˜":"\n00000\n00000\n00000\n00000\n00000\n01010\n10100\n00000\n00000\n00000\n00000\n00000","`":"\n00000\n00000\n00000\n00000\n00000\n01000\n00100\n00000\n00000\n00000\n00000\n00000","#":"\n00000\n00000\n00000\n00000\n00000\n01010\n11111\n01010\n11111\n01010\n00000\n00000","À":"\n01000\n00100\n00000\n01110\n10001\n10001\n10001\n11111\n10001\n10001\n00000\n00000","Á":"\n00010\n00100\n00000\n01110\n10001\n10001\n10001\n11111\n10001\n10001\n00000\n00000","Â":"\n00100\n01010\n00000\n01110\n10001\n10001\n10001\n11111\n10001\n10001\n00000\n00000","Ã":"\n01000\n10101\n00010\n01110\n10001\n10001\n10001\n11111\n10001\n10001\n00000\n00000","Ä":"\n00000\n01010\n00000\n01110\n10001\n10001\n10001\n11111\n10001\n10001\n00000\n00000","Å":"\n00100\n01010\n00100\n01110\n10001\n10001\n10001\n11111\n10001\n10001\n00000\n00000","Æ":"\n00000\n00000\n00000\n01111\n10100\n10100\n10100\n11111\n10100\n10111\n00000\n00000","Ç":"\n00000\n00000\n00000\n01111\n10000\n10000\n10000\n10000\n10000\n01111\n00100\n01000","È":"\n01000\n00100\n00000\n11111\n10000\n11111\n10000\n10000\n10000\n11111\n00000\n00000","É":"\n00010\n00100\n00000\n11111\n10000\n11111\n10000\n10000\n10000\n11111\n00000\n00000","Ê":"\n00100\n01010\n00000\n11111\n10000\n11111\n10000\n10000\n10000\n11111\n00000\n00000","Ë":"\n00000\n01010\n00000\n11111\n10000\n11111\n10000\n10000\n10000\n11111\n00000\n00000","Ì":"\n01000\n00100\n00000\n11111\n00100\n00100\n00100\n00100\n00100\n11111\n00000\n00000","Í":"\n00010\n00100\n00000\n11111\n00100\n00100\n00100\n00100\n00100\n11111\n00000\n00000","Î":"\n00100\n01010\n00000\n11111\n00100\n00100\n00100\n00100\n00100\n11111\n00000\n00000","Ï":"\n00000\n01010\n00000\n11111\n00100\n00100\n00100\n00100\n00100\n11111\n00000\n00000","Ð":"\n00000\n00000\n00000\n01110\n01001\n01001\n11101\n01001\n01001\n01110\n00000\n00000","Ñ":"\n01001\n10110\n00000\n10001\n11001\n10101\n10011\n10001\n10001\n10001\n00000\n00000","Ò":"\n01000\n00100\n00000\n01110\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","Ó":"\n00010\n00100\n00000\n01110\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","Ô":"\n00100\n01010\n00000\n01110\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","Õ":"\n01001\n10110\n00000\n01110\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","Ö":"\n00000\n01010\n00000\n01110\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","Ø":"\n00000\n00010\n00100\n01110\n10101\n10101\n10101\n10101\n10101\n01110\n00100\n01000","Ù":"\n00000\n01000\n00100\n10001\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","Ú":"\n00000\n00010\n00100\n10001\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","Û":"\n00100\n01010\n00000\n10001\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","Ü":"\n00000\n01010\n00000\n10001\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","Ý":"\n00000\n00000\n00100\n10001\n10001\n01010\n00100\n00100\n00100\n00100\n00000\n00000","Þ":"\n00000\n00000\n10000\n11110\n10001\n10001\n10001\n10001\n10001\n11110\n10000\n00000","ß":"\n00000\n00000\n00000\n01110\n10001\n10110\n10001\n10001\n10001\n10110\n10000\n00000","ẞ":"\n00000\n00000\n00000\n01110\n10001\n10110\n10001\n10001\n10001\n10110\n00000\n00000","à":"\n00000\n00000\n01000\n00100\n00000\n01111\n10001\n10001\n10001\n01111\n00000\n00000","á":"\n00000\n00000\n00010\n00100\n00000\n01111\n10001\n10001\n10001\n01111\n00000\n00000","â":"\n00000\n00000\n00100\n01010\n00000\n01111\n10001\n10001\n10001\n01111\n00000\n00000","ã":"\n00000\n00000\n01001\n10110\n00000\n01111\n10001\n10001\n10001\n01111\n00000\n00000","ä":"\n00000\n00000\n00000\n01010\n00000\n01111\n10001\n10001\n10001\n01111\n00000\n00000","å":"\n00000\n00100\n01010\n00100\n00000\n01111\n10001\n10001\n10001\n01111\n00000\n00000","æ":"\n00000\n00000\n00000\n00000\n00000\n01110\n10101\n10110\n10100\n01111\n00000\n00000","ç":"\n00000\n00000\n00000\n00000\n00000\n01111\n10000\n10000\n10000\n01111\n00100\n01000","è":"\n00000\n00000\n01000\n00100\n00000\n01110\n10001\n11111\n10000\n01110\n00000\n00000","é":"\n00000\n00000\n00010\n00100\n00000\n01110\n10001\n11111\n10000\n01110\n00000\n00000","ê":"\n00000\n00000\n00100\n01010\n00000\n01110\n10001\n11111\n10000\n01110\n00000\n00000","ë":"\n00000\n00000\n00000\n01010\n00000\n01110\n10001\n11111\n10000\n01110\n00000\n00000","ì":"\n00000\n00000\n01000\n00100\n00000\n01100\n00100\n00100\n00100\n01110\n00000\n00000","í":"\n00000\n00000\n00010\n00100\n00000\n01100\n00100\n00100\n00100\n01110\n00000\n00000","î":"\n00000\n00000\n00100\n01010\n00000\n01100\n00100\n00100\n00100\n01110\n00000\n00000","ï":"\n00000\n00000\n00000\n01010\n00000\n01100\n00100\n00100\n00100\n01110\n00000\n00000","ð":"\n00000\n00000\n00010\n00111\n00010\n01110\n10010\n10010\n10010\n01110\n00000\n00000","ñ":"\n00000\n00000\n01001\n10110\n00000\n01110\n10001\n10001\n10001\n10001\n00000\n00000","ò":"\n00000\n00000\n01000\n00100\n00000\n01110\n10001\n10001\n10001\n01110\n00000\n00000","ó":"\n00000\n00000\n00010\n00100\n00000\n01110\n10001\n10001\n10001\n01110\n00000\n00000","ô":"\n00000\n00000\n00100\n01010\n00000\n01110\n10001\n10001\n10001\n01110\n00000\n00000","õ":"\n00000\n00000\n01001\n10110\n00000\n01110\n10001\n10001\n10001\n01110\n00000\n00000","ö":"\n00000\n00000\n00000\n01010\n00000\n01110\n10001\n10001\n10001\n01110\n00000\n00000","ø":"\n00000\n00000\n00000\n00010\n00100\n01110\n10101\n10101\n10101\n01110\n00100\n01000","ù":"\n00000\n00000\n00000\n01000\n00100\n10001\n10001\n10001\n10001\n01111\n00000\n00000","ú":"\n00000\n00000\n00000\n00010\n00100\n10001\n10001\n10001\n10001\n01111\n00000\n00000","û":"\n00000\n00000\n00100\n01010\n00000\n10001\n10001\n10001\n10001\n01111\n00000\n00000","ü":"\n00000\n00000\n00000\n01010\n00000\n10001\n10001\n10001\n10001\n01111\n00000\n00000","ý":"\n00000\n00000\n00000\n00010\n00100\n10001\n10001\n10001\n10001\n01111\n00001\n11110","þ":"\n00000\n00000\n00000\n10000\n10000\n11110\n10001\n10001\n10001\n11110\n10000\n10000","ÿ":"\n00000\n00000\n00000\n01010\n00000\n10001\n10001\n10001\n10001\n01111\n00001\n11110","Ā":"\n00000\n01110\n00000\n01110\n10001\n10001\n10001\n11111\n10001\n10001\n00000\n00000","ā":"\n00000\n00000\n00000\n01110\n00000\n01111\n10001\n10001\n10001\n01111\n00000\n00000","Ă":"\n01010\n00100\n00000\n01110\n10001\n10001\n10001\n11111\n10001\n10001\n00000\n00000","ă":"\n00000\n00000\n01010\n00100\n00000\n01111\n10001\n10001\n10001\n01111\n00000\n00000","Ą":"\n00000\n00000\n00000\n01110\n10001\n10001\n10001\n11111\n10001\n10001\n00010\n00001","ą":"\n00000\n00000\n00000\n00000\n00000\n01111\n10001\n10001\n10001\n01111\n00010\n00001","Ć":"\n00010\n00100\n00000\n01111\n10000\n10000\n10000\n10000\n10000\n01111\n00000\n00000","ć":"\n00000\n00000\n00010\n00100\n00000\n01111\n10000\n10000\n10000\n01111\n00000\n00000","Ĉ":"\n00100\n01010\n00000\n01111\n10000\n10000\n10000\n10000\n10000\n01111\n00000\n00000","ĉ":"\n00000\n00000\n00100\n01010\n00000\n01111\n10000\n10000\n10000\n01111\n00000\n00000","Ċ":"\n00000\n00100\n00000\n01111\n10000\n10000\n10000\n10000\n10000\n01111\n00000\n00000","ċ":"\n00000\n00000\n00000\n00100\n00000\n01111\n10000\n10000\n10000\n01111\n00000\n00000","Č":"\n01010\n00100\n00000\n01111\n10000\n10000\n10000\n10000\n10000\n01111\n00000\n00000","č":"\n00000\n00000\n01010\n00100\n00000\n01111\n10000\n10000\n10000\n01111\n00000\n00000","Ď":"\n01010\n00100\n00000\n11110\n10001\n10001\n10001\n10001\n10001\n11110\n00000\n00000","ď":"\n00000\n00000\n00000\n00101\n00101\n01100\n10100\n10100\n10100\n01100\n00000\n00000","Đ":"\n00000\n00000\n00000\n01110\n01001\n01001\n11101\n01001\n01001\n01110\n00000\n00000","đ":"\n00000\n00000\n00010\n00111\n00010\n01110\n10010\n10010\n10010\n01110\n00000\n00000","Ē":"\n00000\n01110\n00000\n11111\n10000\n11111\n10000\n10000\n10000\n11111\n00000\n00000","ē":"\n00000\n00000\n00000\n01110\n00000\n01110\n10001\n11111\n10000\n01110\n00000\n00000","Ĕ":"\n01010\n00100\n00000\n11111\n10000\n11111\n10000\n10000\n10000\n11111\n00000\n00000","ĕ":"\n00000\n00000\n01010\n00100\n00000\n01110\n10001\n11111\n10000\n01110\n00000\n00000","Ė":"\n00000\n00100\n00000\n11111\n10000\n11111\n10000\n10000\n10000\n11111\n00000\n00000","ė":"\n00000\n00000\n00000\n00100\n00000\n01110\n10001\n11111\n10000\n01110\n00000\n00000","Ę":"\n00000\n00000\n00000\n11111\n10000\n11111\n10000\n10000\n10000\n11111\n00010\n00001","ę":"\n00000\n00000\n00000\n00000\n00000\n01110\n10001\n11111\n10000\n01110\n00010\n00001","Ě":"\n01010\n00100\n00000\n11111\n10000\n11111\n10000\n10000\n10000\n11110\n00000\n00000","ě":"\n00000\n00000\n01010\n00100\n00000\n01110\n10001\n11111\n10000\n01110\n00000\n00000","Ĝ":"\n00100\n01010\n00000\n01111\n10000\n10000\n10000\n10011\n10001\n01111\n00000\n00000","ĝ":"\n00000\n00000\n00100\n01010\n00000\n01111\n10001\n10001\n10001\n01111\n00001\n01110","Ğ":"\n01010\n00100\n00000\n01111\n10000\n10000\n10000\n10011\n10001\n01111\n00000\n00000","ğ":"\n00000\n00000\n01010\n00100\n00000\n01111\n10001\n10001\n10001\n01111\n00001\n01110","Ġ":"\n00000\n00100\n00000\n01111\n10000\n10000\n10000\n10011\n10001\n01111\n00000\n00000","ġ":"\n00000\n00000\n00000\n00100\n00000\n01111\n10001\n10001\n10001\n01111\n00001\n01110","Ģ":"\n00000\n00000\n00000\n01111\n10000\n10000\n10000\n10011\n10001\n01111\n00000\n01100","ģ":"\n00010\n00100\n00000\n01111\n10000\n10000\n10000\n10011\n10001\n01111\n00000\n00000","Ĥ":"\n00100\n01010\n00000\n10001\n10001\n11111\n10001\n10001\n10001\n10001\n00000\n00000","ĥ":"\n00100\n01010\n00000\n10000\n10000\n11110\n10001\n10001\n10001\n10001\n00000\n00000","Ħ":"\n00000\n00000\n01010\n11111\n01010\n01110\n01010\n01010\n01010\n01010\n00000\n00000","ħ":"\n00000\n00000\n01000\n11100\n01000\n01110\n01001\n01001\n01001\n01001\n00000\n00000","Ĩ":"\n01001\n10110\n00000\n11111\n00100\n00100\n00100\n00100\n00100\n11111\n00000\n00000","ĩ":"\n01010\n10100\n00000\n00100\n00000\n01100\n00100\n00100\n00100\n01110\n00000\n00000","Ī":"\n00000\n01110\n00000\n11111\n00100\n00100\n00100\n00100\n00100\n11111\n00000\n00000","ī":"\n00000\n00000\n00000\n01110\n00000\n01100\n00100\n00100\n00100\n01110\n00000\n00000","Ĭ":"\n01010\n00100\n00000\n11111\n00100\n00100\n00100\n00100\n00100\n11111\n00000\n00000","ĭ":"\n00000\n00000\n01010\n00100\n00000\n01100\n00100\n00100\n00100\n01110\n00000\n00000","Į":"\n00000\n00000\n00000\n11111\n00100\n00100\n00100\n00100\n00100\n11111\n00010\n00001","į":"\n00000\n00000\n00000\n00100\n00000\n01100\n00100\n00100\n00100\n01110\n00010\n00001","İ":"\n00000\n00100\n00000\n11111\n00100\n00100\n00100\n00100\n00100\n11111\n00000\n00000","ı":"\n00000\n00000\n00000\n00000\n00000\n01100\n00100\n00100\n00100\n01110\n00000\n00000","IJ":"\n00000\n00000\n00000\n10010\n10010\n10010\n10010\n10010\n10010\n10110\n00000\n00000","ij":"\n00000\n00000\n00000\n01001\n00000\n11001\n01001\n01001\n01001\n11101\n00001\n00010","Ĵ":"\n00010\n00101\n00000\n01111\n00001\n00001\n00001\n00001\n00001\n01110\n00000\n00000","ĵ":"\n00000\n00000\n00100\n01010\n00000\n01100\n00100\n00100\n00100\n00100\n10100\n01000","Ķ":"\n00000\n00000\n00000\n10001\n10010\n10100\n11000\n10100\n10010\n10001\n00100\n01000","ķ":"\n00000\n00000\n00000\n10000\n10000\n10001\n10010\n11100\n10010\n10001\n00100\n01000","ĸ":"\n00000\n00000\n00000\n00000\n00000\n10001\n10010\n11100\n10010\n10001\n00000\n00000","Ĺ":"\n00000\n00010\n00100\n10000\n10000\n10000\n10000\n10000\n10000\n11111\n00000\n00000","ĺ":"\n00010\n00100\n00000\n01100\n00100\n00100\n00100\n00100\n00100\n01110\n00000\n00000","Ļ":"\n00000\n00000\n00000\n10000\n10000\n10000\n10000\n10000\n10000\n11111\n00000\n00100","ļ":"\n00000\n00000\n00000\n01100\n00100\n00100\n00100\n00100\n00100\n01110\n00000\n00100","Ľ":"\n00000\n00000\n00000\n10010\n10010\n10000\n10000\n10000\n10000\n11111\n00000\n00000","ľ":"\n00000\n00000\n00000\n01101\n00101\n00100\n00100\n00100\n00100\n01110\n00000\n00000","Ŀ":"\n00000\n00000\n00000\n10000\n10000\n10100\n10000\n10000\n10000\n11111\n00000\n00000","ŀ":"\n00000\n00000\n00000\n01100\n00100\n00100\n00101\n00100\n00100\n01110\n00000\n00000","Ł":"\n00000\n00000\n00000\n01000\n01010\n01100\n11000\n01000\n01000\n01111\n00000\n00000","ł":"\n00000\n00000\n00000\n01100\n00100\n00100\n00110\n01100\n00100\n01110\n00000\n00000","Ń":"\n00000\n00010\n00100\n10001\n11001\n10101\n10011\n10001\n10001\n10001\n00000\n00000","ń":"\n00000\n00000\n00010\n00100\n00000\n01110\n10001\n10001\n10001\n10001\n00000\n00000","Ņ":"\n00000\n00000\n00000\n10001\n11001\n10101\n10011\n10001\n10001\n10001\n00100\n01000","ņ":"\n00000\n00000\n00000\n00000\n00000\n01110\n10001\n10001\n10001\n10001\n00100\n01000","Ň":"\n00000\n01010\n00100\n10001\n11001\n10101\n10011\n10001\n10001\n10001\n00000\n00000","ň":"\n00000\n00000\n01010\n00100\n00000\n01110\n10001\n10001\n10001\n10001\n00000\n00000","ʼn":"\n00000\n00000\n00000\n10000\n10000\n00110\n01001\n01001\n01001\n01001\n00000\n00000","Ŋ":"\n00000\n00000\n00000\n10001\n11001\n10101\n10011\n10001\n10001\n10001\n00001\n00010","ŋ":"\n00000\n00000\n00000\n00000\n00000\n01110\n10001\n10001\n10001\n10001\n00001\n00010","Ō":"\n00000\n01110\n00000\n01110\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","ō":"\n00000\n00000\n00000\n01110\n00000\n01110\n10001\n10001\n10001\n01110\n00000\n00000","Ŏ":"\n01010\n00100\n00000\n01110\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","ŏ":"\n00000\n00000\n01010\n00100\n00000\n01110\n10001\n10001\n10001\n01110\n00000\n00000","Ő":"\n01001\n10010\n00000\n01110\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","ő":"\n00000\n00000\n01001\n10010\n00000\n01110\n10001\n10001\n10001\n01110\n00000\n00000","Œ":"\n00000\n00000\n00000\n01111\n10100\n10100\n10111\n10100\n10100\n01111\n00000\n00000","œ":"\n00000\n00000\n00000\n00000\n00000\n01110\n10101\n10110\n10100\n01111\n00000\n00000","Ŕ":"\n00010\n00100\n00000\n11110\n10001\n10001\n11110\n10001\n10001\n10001\n00000\n00000","ŕ":"\n00000\n00000\n00010\n00100\n00000\n01111\n10000\n10000\n10000\n10000\n00000\n00000","Ŗ":"\n00000\n00000\n00000\n11110\n10001\n10001\n11110\n10001\n10001\n10001\n00100\n01000","ŗ":"\n00000\n00000\n00000\n00000\n00000\n01111\n10000\n10000\n10000\n10000\n00100\n01000","Ř":"\n01010\n00100\n00000\n11110\n10001\n10001\n11110\n10001\n10001\n10001\n00000\n00000","ř":"\n00000\n00000\n01010\n00100\n00000\n01111\n10000\n10000\n10000\n10000\n00000\n00000","Ś":"\n00010\n00100\n00000\n01111\n10000\n01110\n00001\n00001\n00001\n11110\n00000\n00000","ś":"\n00000\n00000\n00010\n00100\n00000\n01111\n10000\n01110\n00001\n11110\n00000\n00000","Ŝ":"\n00100\n01010\n00000\n01111\n10000\n01110\n00001\n00001\n00001\n11110\n00000\n00000","ŝ":"\n00000\n00000\n00100\n01010\n00000\n01111\n10000\n01110\n00001\n11110\n00000\n00000","Ş":"\n00000\n00000\n00000\n01111\n10000\n01110\n00001\n00001\n00001\n11110\n00100\n00000","ş":"\n00000\n00000\n00000\n00000\n00000\n01111\n10000\n01110\n00001\n11110\n00100\n01000","Š":"\n01010\n00100\n00000\n01111\n10000\n01110\n00001\n00001\n00001\n11110\n00000\n00000","š":"\n00000\n00000\n01010\n00100\n00000\n01111\n10000\n01110\n00001\n11110\n00000\n00000","Ţ":"\n00000\n00000\n00000\n11111\n00100\n00100\n00100\n00100\n00100\n00100\n00010\n00100","ţ":"\n00000\n00000\n00000\n00100\n00100\n11111\n00100\n00100\n00100\n00011\n00000\n01100","Ť":"\n01010\n00100\n00000\n11111\n00100\n00100\n00100\n00100\n00100\n00100\n00000\n00000","ť":"\n00000\n00000\n00001\n00101\n00100\n11111\n00100\n00100\n00100\n00011\n00000\n00000","Ŧ":"\n00000\n00000\n00000\n11111\n00100\n00100\n01110\n00100\n00100\n00100\n00000\n00000","ŧ":"\n00000\n00000\n00000\n00100\n00100\n11111\n00100\n01110\n00100\n00011\n00000\n00000","Ũ":"\n01001\n10110\n00000\n10001\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","ũ":"\n00000\n00000\n01001\n10110\n00000\n10001\n10001\n10001\n10001\n01111\n00000\n00000","Ū":"\n00000\n01110\n00000\n10001\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","ū":"\n00000\n00000\n00000\n01110\n00000\n10001\n10001\n10001\n10001\n01111\n00000\n00000","Ŭ":"\n01010\n00100\n00000\n10001\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","ŭ":"\n00000\n00000\n01010\n00100\n00000\n10001\n10001\n10001\n10001\n01111\n00000\n00000","Ů":"\n00100\n01010\n00100\n10001\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","ů":"\n00000\n00000\n00100\n01010\n00100\n10001\n10001\n10001\n10001\n01111\n00000\n00000","Ű":"\n01001\n10010\n00000\n10001\n10001\n10001\n10001\n10001\n10001\n01110\n00000\n00000","ű":"\n00000\n00000\n01001\n10010\n00000\n10001\n10001\n10001\n10001\n01111\n00000\n00000","Ų":"\n00000\n00000\n00000\n10001\n10001\n10001\n10001\n10001\n10001\n01110\n00100\n00010","ų":"\n00000\n00000\n00000\n00000\n00000\n10001\n10001\n10001\n10001\n01111\n00010\n00001","Ŵ":"\n00100\n01010\n00000\n10101\n10101\n10101\n10101\n10101\n10101\n01010\n00000\n00000","ŵ":"\n00000\n00000\n00100\n01010\n00000\n10101\n10101\n10101\n10101\n01010\n00000\n00000","Ŷ":"\n00100\n01010\n00000\n10001\n10001\n01010\n00100\n00100\n00100\n00100\n00000\n00000","ŷ":"\n00000\n00000\n00100\n01010\n00000\n10001\n10001\n10001\n10001\n01111\n00001\n11110","Ÿ":"\n00000\n01010\n00000\n10001\n10001\n01010\n00100\n00100\n00100\n00100\n00000\n00000","Ź":"\n00010\n00100\n00000\n11111\n00001\n00010\n00100\n01000\n10000\n11111\n00000\n00000","ź":"\n00000\n00000\n00010\n00100\n00000\n11111\n00010\n00100\n01000\n11111\n00000\n00000","Ż":"\n00000\n00100\n00000\n11111\n00001\n00010\n00100\n01000\n10000\n11111\n00000\n00000","ż":"\n00000\n00000\n00000\n00100\n00000\n11111\n00010\n00100\n01000\n11111\n00000\n00000","Ž":"\n01010\n00100\n00000\n11111\n00001\n00010\n00100\n01000\n10000\n11111\n00000\n00000","ž":"\n00000\n00000\n01010\n00100\n00000\n11111\n00010\n00100\n01000\n11111\n00000\n00000","€":"\n00000\n00000\n00000\n00111\n01000\n11110\n01000\n11110\n01000\n00111\n00000\n00000","™":"\n00000\n11111\n00100\n00100\n00100\n00000\n01010\n10101\n10101\n10101\n00000\n00000","¢":"\n00000\n00000\n00000\n00010\n00100\n01111\n10100\n10100\n10100\n01111\n00100\n01000","¤":"\n00000\n00000\n00000\n00000\n10001\n01110\n10001\n10001\n01110\n10001\n00000\n00000","¥":"\n00000\n00000\n10001\n01010\n00100\n01110\n00100\n01110\n00100\n00000\n00000","§":"\n00000\n00000\n00000\n01110\n10000\n01110\n10001\n01110\n00001\n01110\n00000\n00000","¨":"\n00000\n00000\n00000\n01010\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000","©":"\n00000\n00000\n00000\n01110\n10001\n10111\n10101\n10111\n10001\n01110\n00000\n00000","®":"\n00000\n00000\n00000\n01110\n10001\n10111\n10101\n10101\n10001\n01110\n00000\n00000","ª":"\n00000\n01110\n00010\n01110\n01010\n01110\n00000\n00000\n00000\n00000\n00000\n00000","º":"\n00000\n00100\n01010\n01010\n01010\n00100\n00000\n00000\n00000\n00000\n00000\n00000","¬":"\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n01110\n00010\n00000\n00000\n00000","¯":"\n00000\n00000\n00000\n01110\n00000\n00000\n00000\n00000\n00000\n00000\n00000\n00000","°":"\n00000\n00000\n00100\n01010\n00100\n00000\n00000\n00000\n00000\n00000\n00000\n00000"};function RC4(e){this.s=new Array(256),this.i=0,this.j=0;for(var n=0;n<256;n++)this.s[n]=n;e&&this.mix(e)}function print_call_stack(){var e=(new Error).stack;console.log(e)}function RNG(e){this.seed=e,null==e?e=(Math.random()+Date.now()).toString():"function"==typeof e?(this.uniform=e,this.nextByte=function(){return~~(256*this.uniform())},e=null):"[object String]"!==Object.prototype.toString.call(e)&&(e=JSON.stringify(e)),this._normal=null,this._state=e?new RC4(e):null}
/**
* Seedable random number generator functions.
* @version 1.0.0
* @license Public Domain
*
* @example
* var rng = new RNG('Example');
* rng.random(40, 50); // => 42
* rng.uniform(); // => 0.7972798995050903
* rng.normal(); // => -0.6698504543216376
* rng.exponential(); // => 1.0547367609131555
* rng.poisson(4); // => 2
* rng.gamma(4); // => 2.781724687386858
*/
String.prototype.getBytes=function(){for(var e=[],n=0;n<this.length;n++){var t=this.charCodeAt(n),r=[];do{r.push(255&t),t>>=8}while(t>0);e=e.concat(r.reverse())}return e},RC4.prototype._swap=function(e,n){var t=this.s[e];this.s[e]=this.s[n],this.s[n]=t},RC4.prototype.mix=function(e){for(var n=e.getBytes(),t=0,r=0;r<this.s.length;r++)t+=this.s[r]+n[r%n.length],t%=256,this._swap(r,t)},RC4.prototype.next=function(){return this.i=(this.i+1)%256,this.j=(this.j+this.s[this.i])%256,this._swap(this.i,this.j),this.s[(this.s[this.i]+this.s[this.j])%256]},RNG.prototype.nextByte=function(){return this._state.next()},RNG.prototype.uniform=function(){for(var e=0,n=0;n<7;n++)e*=256,e+=this.nextByte();return e/(Math.pow(2,56)-1)},RNG.prototype.random=function(e,n){return null==e?this.uniform():(null==n&&(n=e,e=0),e+Math.floor(this.uniform()*(n-e)))},RNG.prototype.normal=function(){if(null!==this._normal){var e=this._normal;return this._normal=null,e}var n=this.uniform()||Math.pow(2,-53),t=this.uniform();return this._normal=Math.sqrt(-2*Math.log(n))*Math.sin(2*Math.PI*t),Math.sqrt(-2*Math.log(n))*Math.cos(2*Math.PI*t)},RNG.prototype.exponential=function(){return-Math.log(this.uniform()||Math.pow(2,-53))},RNG.prototype.poisson=function(e){var n=Math.exp(-(e||1)),t=0,r=1;do{t++,r*=this.uniform()}while(r>n);return t-1},RNG.prototype.gamma=function(e){var n=(e<1?1+e:e)-1/3,t=1/Math.sqrt(9*n);do{do{var r=this.normal(),o=Math.pow(t*r+1,3)}while(o<=0);var a=this.uniform(),i=Math.pow(r,2)}while(a>=1-.0331*i*i&&Math.log(a)>=.5*i+n*(1-o+Math.log(o)));return e<1?n*o*Math.exp(this.exponential()/-e):n*o},RNG.roller=function(e,n){var t=e.split(/(\d+)?d(\d+)([+-]\d+)?/).slice(1),r=parseFloat(t[0])||1,o=parseFloat(t[1]),a=parseFloat(t[2])||0;return n=n||new RNG,function(){for(var e=r+a,t=0;t<r;t++)e+=n.random(o);return e}};var FastBase64_chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",FastBase64_encLookup=[];function FastBase64_Init(){for(var e=0;e<4096;e++)FastBase64_encLookup[e]=FastBase64_chars[e>>6]+FastBase64_chars[63&e]}function FastBase64_Encode(e){for(var t=e.length,r="",o=0;t>2;)n=e[o]<<16|e[o+1]<<8|e[o+2],r+=FastBase64_encLookup[n>>12]+FastBase64_encLookup[4095&n],t-=3,o+=3;if(t>0){var a=(252&e[o])>>2,i=(3&e[o])<<4;if(t>1&&(i|=(240&e[++o])>>4),r+=FastBase64_chars[a],r+=FastBase64_chars[i],2==t){var l=(15&e[o++])<<2;l|=(192&e[o])>>6,r+=FastBase64_chars[l]}1==t&&(r+="="),r+="="}return r}function u32ToArray(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]}function u16ToArray(e){return[255&e,e>>8&255]}function MakeRiff(e,n,t){var r,o={chunkId:[82,73,70,70],chunkSize:0,format:[87,65,86,69],subChunk1Id:[102,109,116,32],subChunk1Size:16,audioFormat:1,numChannels:1,sampleRate:e,byteRate:0,blockAlign:0,bitsPerSample:n,subChunk2Id:[100,97,116,97],subChunk2Size:0};return o.byteRate=o.sampleRate*o.numChannels*o.bitsPerSample>>3,o.blockAlign=o.numChannels*o.bitsPerSample>>3,o.subChunk2Size=t.length,o.chunkSize=36+o.subChunk2Size,{dat:[],wav:r=o.chunkId.concat(u32ToArray(o.chunkSize),o.format,o.subChunk1Id,u32ToArray(o.subChunk1Size),u16ToArray(o.audioFormat),u16ToArray(o.numChannels),u32ToArray(o.sampleRate),u32ToArray(o.byteRate),u16ToArray(o.blockAlign),u16ToArray(o.bitsPerSample),o.subChunk2Id,u32ToArray(o.subChunk2Size),t),header:o,dataURI:"data:audio/wav;base64,"+FastBase64_Encode(r)}}FastBase64_Init(),"undefined"!=typeof exports&&(exports.RIFFWAVE=RIFFWAVE);var AUDIO_CONTEXT,SOUND_VOL=.25,SAMPLE_RATE=5512,BIT_DEPTH=8,SQUARE=0,SAWTOOTH=1,SINE=2,NOISE=3,TRIANGLE=4,BREAKER=5,SHAPES=["square","sawtooth","sine","noise","triangle","breaker"];function checkAudioContextExists(){try{null==AUDIO_CONTEXT&&("undefined"!=typeof AudioContext?AUDIO_CONTEXT=new AudioContext:"undefined"!=typeof webkitAudioContext&&(AUDIO_CONTEXT=new webkitAudioContext))}catch(e){window.console.log(e)}}checkAudioContextExists();var rng,masterVolume=1;function Params(){var e={};return e.wave_type=SQUARE,e.p_env_attack=0,e.p_env_sustain=.3,e.p_env_punch=0,e.p_env_decay=.4,e.p_base_freq=.3,e.p_freq_limit=0,e.p_freq_ramp=0,e.p_freq_dramp=0,e.p_vib_strength=0,e.p_vib_speed=0,e.p_arp_mod=0,e.p_arp_speed=0,e.p_duty=0,e.p_duty_ramp=0,e.p_repeat_speed=0,e.p_pha_offset=0,e.p_pha_ramp=0,e.p_lpf_freq=1,e.p_lpf_ramp=0,e.p_lpf_resonance=0,e.p_hpf_freq=0,e.p_hpf_ramp=0,e.sound_vol=.5,e.sample_rate=44100,e.bit_depth=8,e}var seeded=!1;function frnd(e){return seeded?rng.uniform()*e:Math.random()*e}function rnd(e){return seeded?Math.floor(rng.uniform()*(e+1)):Math.floor(Math.random()*(e+1))}pickupCoin=function(){var e=Params();if(e.wave_type=Math.floor(frnd(SHAPES.length)),3===e.wave_type&&(e.wave_type=0),e.p_base_freq=.4+frnd(.5),e.p_env_attack=0,e.p_env_sustain=frnd(.1),e.p_env_decay=.1+frnd(.4),e.p_env_punch=.3+frnd(.3),rnd(1)){e.p_arp_speed=.5+frnd(.2);var n=1+(1|frnd(7)),t=n+(1|frnd(7))+2;e.p_arp_mod=+n/+t}return e},laserShoot=function(){var e=Params();return e.wave_type=rnd(2),e.wave_type===SINE&&rnd(1)&&(e.wave_type=rnd(1)),e.wave_type=Math.floor(frnd(SHAPES.length)),3===e.wave_type&&(e.wave_type=SQUARE),e.p_base_freq=.5+frnd(.5),e.p_freq_limit=e.p_base_freq-.2-frnd(.6),e.p_freq_limit<.2&&(e.p_freq_limit=.2),e.p_freq_ramp=-.15-frnd(.2),0===rnd(2)&&(e.p_base_freq=.3+frnd(.6),e.p_freq_limit=frnd(.1),e.p_freq_ramp=-.35-frnd(.3)),rnd(1)?(e.p_duty=frnd(.5),e.p_duty_ramp=frnd(.2)):(e.p_duty=.4+frnd(.5),e.p_duty_ramp=-frnd(.7)),e.p_env_attack=0,e.p_env_sustain=.1+frnd(.2),e.p_env_decay=frnd(.4),rnd(1)&&(e.p_env_punch=frnd(.3)),0===rnd(2)&&(e.p_pha_offset=frnd(.2),e.p_pha_ramp=-frnd(.2)),rnd(1)&&(e.p_hpf_freq=frnd(.3)),e},explosion=function(){var e=Params();return rnd(1)?(e.p_base_freq=.1+frnd(.4),e.p_freq_ramp=-.1+frnd(.4)):(e.p_base_freq=.2+frnd(.7),e.p_freq_ramp=-.2-frnd(.2)),e.p_base_freq*=e.p_base_freq,0===rnd(4)&&(e.p_freq_ramp=0),0===rnd(2)&&(e.p_repeat_speed=.3+frnd(.5)),e.p_env_attack=0,e.p_env_sustain=.1+frnd(.3),e.p_env_decay=frnd(.5),0===rnd(1)&&(e.p_pha_offset=-.3+frnd(.9),e.p_pha_ramp=-frnd(.3)),e.p_env_punch=.2+frnd(.6),rnd(1)&&(e.p_vib_strength=frnd(.7),e.p_vib_speed=frnd(.6)),0===rnd(2)&&(e.p_arp_speed=.6+frnd(.3),e.p_arp_mod=.8-frnd(1.6)),e},birdSound=function(){var e=Params();return frnd(10)<1?(e.wave_type=Math.floor(frnd(SHAPES.length)),3===e.wave_type&&(e.wave_type=SQUARE),e.p_env_attack=.4304400932967592+frnd(.2)-.1,e.p_env_sustain=.15739346034252394+frnd(.2)-.1,e.p_env_punch=.004488201744871758+frnd(.2)-.1,e.p_env_decay=.07478075528212291+frnd(.2)-.1,e.p_base_freq=.9865265720147687+frnd(.2)-.1,e.p_freq_limit=0+frnd(.2)-.1,e.p_freq_ramp=-.2995018224359539+frnd(.2)-.1,frnd(1)<.5&&(e.p_freq_ramp=.1+frnd(.15)),e.p_freq_dramp=.004598608156964473+frnd(.1)-.05,e.p_vib_strength=-.2202799497929496+frnd(.2)-.1,e.p_vib_speed=.8084998703158364+frnd(.2)-.1,e.p_arp_mod=0,e.p_arp_speed=0,e.p_duty=-.9031808754347107+frnd(.2)-.1,e.p_duty_ramp=-.8128699999808343+frnd(.2)-.1,e.p_repeat_speed=.601486018931999+frnd(.2)-.1,e.p_pha_offset=-.9424902314367765+frnd(.2)-.1,e.p_pha_ramp=-.1055482222272056+frnd(.2)-.1,e.p_lpf_freq=.9989765717851521+frnd(.2)-.1,e.p_lpf_ramp=-.25051720626043017+frnd(.2)-.1,e.p_lpf_resonance=.32777871505494693+frnd(.2)-.1,e.p_hpf_freq=.0023548750981756753+frnd(.2)-.1,e.p_hpf_ramp=-.002375673204842568+frnd(.2)-.1,e):frnd(10)<1?(e.wave_type=Math.floor(frnd(SHAPES.length)),3===e.wave_type&&(e.wave_type=SQUARE),e.p_env_attack=.5277795946672003+frnd(.2)-.1,e.p_env_sustain=.18243733568468432+frnd(.2)-.1,e.p_env_punch=-.020159754546840117+frnd(.2)-.1,e.p_env_decay=.1561353422051903+frnd(.2)-.1,e.p_base_freq=.9028855606533718+frnd(.2)-.1,e.p_freq_limit=-.008842787837148716,e.p_freq_ramp=-.1,e.p_freq_dramp=-.012891241489551925,e.p_vib_strength=-.17923136138403065+frnd(.2)-.1,e.p_vib_speed=.908263385610142+frnd(.2)-.1,e.p_arp_mod=.41690153355414894+frnd(.2)-.1,e.p_arp_speed=.0010766233195860704+frnd(.2)-.1,e.p_duty=-.8735363011184684+frnd(.2)-.1,e.p_duty_ramp=-.7397985366747507+frnd(.2)-.1,e.p_repeat_speed=.0591789344172107+frnd(.2)-.1,e.p_pha_offset=-.9961184222777699+frnd(.2)-.1,e.p_pha_ramp=-.08234769395850523+frnd(.2)-.1,e.p_lpf_freq=.9412475115697335+frnd(.2)-.1,e.p_lpf_ramp=-.18261358925834958+frnd(.2)-.1,e.p_lpf_resonance=.24541438107389477+frnd(.2)-.1,e.p_hpf_freq=-.01831940280978611+frnd(.2)-.1,e.p_hpf_ramp=-.03857383633171346+frnd(.2)-.1,e):frnd(10)<1?(e.wave_type=Math.floor(frnd(SHAPES.length)),3===e.wave_type&&(e.wave_type=SQUARE),e.p_env_attack=.4304400932967592+frnd(.2)-.1,e.p_env_sustain=.15739346034252394+frnd(.2)-.1,e.p_env_punch=.004488201744871758+frnd(.2)-.1,e.p_env_decay=.07478075528212291+frnd(.2)-.1,e.p_base_freq=.9865265720147687+frnd(.2)-.1,e.p_freq_limit=0+frnd(.2)-.1,e.p_freq_ramp=-.2995018224359539+frnd(.2)-.1,e.p_freq_dramp=.004598608156964473+frnd(.2)-.1,e.p_vib_strength=-.2202799497929496+frnd(.2)-.1,e.p_vib_speed=.8084998703158364+frnd(.2)-.1,e.p_arp_mod=-.46410459213693644+frnd(.2)-.1,e.p_arp_speed=-.10955361249587248+frnd(.2)-.1,e.p_duty=-.9031808754347107+frnd(.2)-.1,e.p_duty_ramp=-.8128699999808343+frnd(.2)-.1,e.p_repeat_speed=.7014860189319991+frnd(.2)-.1,e.p_pha_offset=-.9424902314367765+frnd(.2)-.1,e.p_pha_ramp=-.1055482222272056+frnd(.2)-.1,e.p_lpf_freq=.9989765717851521+frnd(.2)-.1,e.p_lpf_ramp=-.25051720626043017+frnd(.2)-.1,e.p_lpf_resonance=.32777871505494693+frnd(.2)-.1,e.p_hpf_freq=.0023548750981756753+frnd(.2)-.1,e.p_hpf_ramp=-.002375673204842568+frnd(.2)-.1,e):frnd(5)>1?(e.wave_type=Math.floor(frnd(SHAPES.length)),3===e.wave_type&&(e.wave_type=SQUARE),rnd(1)?(e.p_arp_mod=.2697849293151393+frnd(.2)-.1,e.p_arp_speed=-.3131172257760948+frnd(.2)-.1,e.p_base_freq=.8090588299313949+frnd(.2)-.1,e.p_duty=-.6210022920964955+frnd(.2)-.1,e.p_duty_ramp=-.00043441813553182567+frnd(.2)-.1,e.p_env_attack=.004321877246874195+frnd(.2)-.1,e.p_env_decay=.1+frnd(.2)-.1,e.p_env_punch=.061737781504416146+frnd(.2)-.1,e.p_env_sustain=.4987252564798832+frnd(.2)-.1,e.p_freq_dramp=.31700340314222614+frnd(.2)-.1,e.p_freq_limit=0+frnd(.2)-.1,e.p_freq_ramp=-.163380391341416+frnd(.2)-.1,e.p_hpf_freq=.4709005021145149+frnd(.2)-.1,e.p_hpf_ramp=.6924667290539194+frnd(.2)-.1,e.p_lpf_freq=.8351398631384511+frnd(.2)-.1,e.p_lpf_ramp=.36616557192873134+frnd(.2)-.1,e.p_lpf_resonance=-.08685777111664439+frnd(.2)-.1,e.p_pha_offset=-.036084571580025544+frnd(.2)-.1,e.p_pha_ramp=-.014806445085568108+frnd(.2)-.1,e.p_repeat_speed=-.8094368475518489+frnd(.2)-.1,e.p_vib_speed=.4496665457171294+frnd(.2)-.1,e.p_vib_strength=.23413762515532424+frnd(.2)-.1):(e.p_arp_mod=-.35697118026766184+frnd(.2)-.1,e.p_arp_speed=.3581140690559588+frnd(.2)-.1,e.p_base_freq=1.3260897696157528+frnd(.2)-.1,e.p_duty=-.30984900436710694+frnd(.2)-.1,e.p_duty_ramp=-.0014374759133411626+frnd(.2)-.1,e.p_env_attack=.3160357835682254+frnd(.2)-.1,e.p_env_decay=.1+frnd(.2)-.1,e.p_env_punch=.24323114016870148+frnd(.2)-.1,e.p_env_sustain=.4+frnd(.2)-.1,e.p_freq_dramp=.2866475886237244+frnd(.2)-.1,e.p_freq_limit=0+frnd(.2)-.1,e.p_freq_ramp=-.10956352368742976+frnd(.2)-.1,e.p_hpf_freq=.20772718017889846+frnd(.2)-.1,e.p_hpf_ramp=.1564090637378835+frnd(.2)-.1,e.p_lpf_freq=.6021372770637031+frnd(.2)-.1,e.p_lpf_ramp=.24016227139979027+frnd(.2)-.1,e.p_lpf_resonance=-.08787383821160144+frnd(.2)-.1,e.p_pha_offset=-.381597686151701+frnd(.2)-.1,e.p_pha_ramp=-.0002481687661373495+frnd(.2)-.1,e.p_repeat_speed=.07812112809425686+frnd(.2)-.1,e.p_vib_speed=-.13648848579133943+frnd(.2)-.1,e.p_vib_strength=.0018874158972302657+frnd(.2)-.1),e):(e.wave_type=Math.floor(frnd(SHAPES.length)),1!==e.wave_type&&3!==e.wave_type||(e.wave_type=2),e.p_base_freq=.85+frnd(.15),e.p_freq_ramp=.3+frnd(.15),e.p_env_attack=0+frnd(.09),e.p_env_sustain=.2+frnd(.3),e.p_env_decay=0+frnd(.1),e.p_duty=frnd(2)-1,e.p_duty_ramp=Math.pow(frnd(2)-1,3),e.p_repeat_speed=.5+frnd(.1),e.p_pha_offset=-.3+frnd(.9),e.p_pha_ramp=-frnd(.3),e.p_arp_speed=.4+frnd(.6),e.p_arp_mod=.8+frnd(.1),e.p_lpf_resonance=frnd(2)-1,e.p_lpf_freq=1-Math.pow(frnd(1),3),e.p_lpf_ramp=Math.pow(frnd(2)-1,3),e.p_lpf_freq<.1&&e.p_lpf_ramp<-.05&&(e.p_lpf_ramp=-e.p_lpf_ramp),e.p_hpf_freq=Math.pow(frnd(1),5),e.p_hpf_ramp=Math.pow(frnd(2)-1,5),e)},pushSound=function(){var e=Params();return e.wave_type=Math.floor(frnd(SHAPES.length)),2===e.wave_type&&e.wave_type++,0===e.wave_type&&(e.wave_type=NOISE),e.p_base_freq=.1+frnd(.4),e.p_freq_ramp=.05+frnd(.2),e.p_env_attack=.01+frnd(.09),e.p_env_sustain=.01+frnd(.09),e.p_env_decay=.01+frnd(.09),e.p_repeat_speed=.3+frnd(.5),e.p_pha_offset=-.3+frnd(.9),e.p_pha_ramp=-frnd(.3),e.p_arp_speed=.6+frnd(.3),e.p_arp_mod=.8-frnd(1.6),e},powerUp=function(){var e=Params();return rnd(1)?e.wave_type=SAWTOOTH:e.p_duty=frnd(.6),e.wave_type=Math.floor(frnd(SHAPES.length)),3===e.wave_type&&(e.wave_type=SQUARE),rnd(1)?(e.p_base_freq=.2+frnd(.3),e.p_freq_ramp=.1+frnd(.4),e.p_repeat_speed=.4+frnd(.4)):(e.p_base_freq=.2+frnd(.3),e.p_freq_ramp=.05+frnd(.2),rnd(1)&&(e.p_vib_strength=frnd(.7),e.p_vib_speed=frnd(.6))),e.p_env_attack=0,e.p_env_sustain=frnd(.4),e.p_env_decay=.1+frnd(.4),e},hitHurt=function(){return result=Params(),result.wave_type=rnd(2),result.wave_type===SINE&&(result.wave_type=NOISE),result.wave_type===SQUARE&&(result.p_duty=frnd(.6)),result.wave_type=Math.floor(frnd(SHAPES.length)),result.p_base_freq=.2+frnd(.6),result.p_freq_ramp=-.3-frnd(.4),result.p_env_attack=0,result.p_env_sustain=frnd(.1),result.p_env_decay=.1+frnd(.2),rnd(1)&&(result.p_hpf_freq=frnd(.3)),result},jump=function(){return result=Params(),result.wave_type=SQUARE,result.wave_type=Math.floor(frnd(SHAPES.length)),3===result.wave_type&&(result.wave_type=SQUARE),result.p_duty=frnd(.6),result.p_base_freq=.3+frnd(.3),result.p_freq_ramp=.1+frnd(.2),result.p_env_attack=0,result.p_env_sustain=.1+frnd(.3),result.p_env_decay=.1+frnd(.2),rnd(1)&&(result.p_hpf_freq=frnd(.3)),rnd(1)&&(result.p_lpf_freq=1-frnd(.6)),result},blipSelect=function(){return result=Params(),result.wave_type=rnd(1),result.wave_type=Math.floor(frnd(SHAPES.length)),3===result.wave_type&&(result.wave_type=rnd(1)),result.wave_type===SQUARE&&(result.p_duty=frnd(.6)),result.p_base_freq=.2+frnd(.4),result.p_env_attack=0,result.p_env_sustain=.1+frnd(.1),result.p_env_decay=frnd(.2),result.p_hpf_freq=.1,result},random=function(){return result=Params(),result.wave_type=Math.floor(frnd(SHAPES.length)),result.p_base_freq=Math.pow(frnd(2)-1,2),rnd(1)&&(result.p_base_freq=Math.pow(frnd(2)-1,3)+.5),result.p_freq_limit=0,result.p_freq_ramp=Math.pow(frnd(2)-1,5),result.p_base_freq>.7&&result.p_freq_ramp>.2&&(result.p_freq_ramp=-result.p_freq_ramp),result.p_base_freq<.2&&result.p_freq_ramp<-.05&&(result.p_freq_ramp=-result.p_freq_ramp),result.p_freq_dramp=Math.pow(frnd(2)-1,3),result.p_duty=frnd(2)-1,result.p_duty_ramp=Math.pow(frnd(2)-1,3),result.p_vib_strength=Math.pow(frnd(2)-1,3),result.p_vib_speed=frnd(2)-1,result.p_env_attack=Math.pow(frnd(2)-1,3),result.p_env_sustain=Math.pow(frnd(2)-1,2),result.p_env_decay=frnd(2)-1,result.p_env_punch=Math.pow(frnd(.8),2),result.p_env_attack+result.p_env_sustain+result.p_env_decay<.2&&(result.p_env_sustain+=.2+frnd(.3),result.p_env_decay+=.2+frnd(.3)),result.p_lpf_resonance=frnd(2)-1,result.p_lpf_freq=1-Math.pow(frnd(1),3),result.p_lpf_ramp=Math.pow(frnd(2)-1,3),result.p_lpf_freq<.1&&result.p_lpf_ramp<-.05&&(result.p_lpf_ramp=-result.p_lpf_ramp),result.p_hpf_freq=Math.pow(frnd(1),5),result.p_hpf_ramp=Math.pow(frnd(2)-1,5),result.p_pha_offset=Math.pow(frnd(2)-1,3),result.p_pha_ramp=Math.pow(frnd(2)-1,3),result.p_repeat_speed=frnd(2)-1,result.p_arp_speed=frnd(2)-1,result.p_arp_mod=frnd(2)-1,result};var generators=[pickupCoin,laserShoot,explosion,powerUp,hitHurt,jump,blipSelect,pushSound,random,birdSound],generatorNames=["pickupCoin","laserShoot","explosion","powerUp","hitHurt","jump","blipSelect","pushSound","random","birdSound"];function SoundEffect(e,n){this._buffer=AUDIO_CONTEXT.createBuffer(1,e,n)}function ULBS(){if("suspended"===AUDIO_CONTEXT.state){var e=function(){AUDIO_CONTEXT.resume().then((function(){document.body.removeEventListener("touchstart",e),document.body.removeEventListener("touchend",e),document.body.removeEventListener("mousedown",e),document.body.removeEventListener("mouseup",e),document.body.removeEventListener("keydown",e),document.body.removeEventListener("keyup",e)}))};document.body.addEventListener("touchstart",e,!1),document.body.addEventListener("touchend",e,!1),document.body.addEventListener("mousedown",e,!1),document.body.addEventListener("mouseup",e,!1),document.body.addEventListener("keydown",e,!1),document.body.addEventListener("keyup",e,!1)}}if(generateFromSeed=function(e){rng=new RNG(e/100|0);var n=generators[e%100%generators.length];seeded=!0;var t=n();return t.seed=e,seeded=!1,t},SoundEffect.prototype.getBuffer=function(){return this._buffer.getChannelData(0)},SoundEffect.prototype.play=function(){ULBS();var e=AUDIO_CONTEXT.createBufferSource(),n=AUDIO_CONTEXT.createBiquadFilter(),t=AUDIO_CONTEXT.createBiquadFilter(),r=AUDIO_CONTEXT.createBiquadFilter();e.buffer=this._buffer,e.connect(n),n.frequency.value=1600,t.frequency.value=1600,r.frequency.value=1600,n.connect(t),t.connect(r),r.connect(AUDIO_CONTEXT.destination);var o=AUDIO_CONTEXT.currentTime;void 0!==e.start?e.start(o):e.noteOn(o),e.onended=function(){r.disconnect()}},SoundEffect.MIN_SAMPLE_RATE=22050,void 0===AUDIO_CONTEXT&&((SoundEffect=function(e,n){this._sample_rate=n,this._buffer=new Array(e),this._audioElement=null}).prototype.getBuffer=function(){return this._audioElement=null,this._buffer},SoundEffect.prototype.play=function(){if(this._audioElement)this._audioElement.cloneNode(!1).play();else{for(var e=0;e<this._buffer.length;e++)this._buffer[e]=255&Math.floor(128*Math.max(0,Math.min(this._buffer[e]+1,2)));var n=MakeRiff(this._sample_rate,BIT_DEPTH,this._buffer);this._audioElement=new Audio,this._audioElement.src=n.dataURI,this._audioElement.play()}},SoundEffect.MIN_SAMPLE_RATE=1),SoundEffect.generate=function(e){function n(){t=0,r=100/(e.p_base_freq*e.p_base_freq+.001),o=Math.floor(r),a=100/(e.p_freq_limit*e.p_freq_limit+.001),i=1-.01*Math.pow(e.p_freq_ramp,3),l=1e-6*-Math.pow(e.p_freq_dramp,3),s=.5-.5*e.p_duty,c=5e-5*-e.p_duty_ramp,d=e.p_arp_mod>=0?1-.9*Math.pow(e.p_arp_mod,2):1+10*Math.pow(e.p_arp_mod,2),0,u=Math.floor(2e4*Math.pow(1-e.p_arp_speed,2)+32),1==e.p_arp_speed&&(u=0)}var t,r,o,a,i,l,s,c,d,u;n();var h=0,g=0,p=.1*Math.pow(e.p_lpf_freq,3),f=1+1e-4*e.p_lpf_ramp,m=5/(1+20*Math.pow(e.p_lpf_resonance,2))*(.01+p);m>.8&&(m=.8);var v=0,_=.1*Math.pow(e.p_hpf_freq,2),b=1+3e-4*e.p_hpf_ramp,y=0,w=.01*Math.pow(e.p_vib_speed,2),k=.5*e.p_vib_strength,R=0,C=0,E=0,S=[Math.floor(e.p_env_attack*e.p_env_attack*1e5),Math.floor(e.p_env_sustain*e.p_env_sustain*1e5),Math.floor(e.p_env_decay*e.p_env_decay*1e5)],M=S[0]+S[1]+S[2],I=0,x=1020*Math.pow(e.p_pha_offset,2);e.p_pha_offset<0&&(x=-x);var T=1*Math.pow(e.p_pha_ramp,2);e.p_pha_ramp<0&&(T=-T);for(var O=Math.abs(Math.floor(x)),A=0,D=[],N=0;N<1024;++N)D[N]=0;var B=[];for(N=0;N<32;++N)B[N]=2*Math.random()-1;var L=Math.floor(2e4*Math.pow(1-e.p_repeat_speed,2)+32);0==e.p_repeat_speed&&(L=0);for(var P,j=e.sound_vol,F=(j=Math.exp(e.sound_vol)-1,0),V=0,q=Math.floor(44100/e.sample_rate),U=0,z=Math.ceil(M/q),W=(P=e.sample_rate<SoundEffect.MIN_SAMPLE_RATE?new SoundEffect(4*z,SoundEffect.MIN_SAMPLE_RATE):new SoundEffect(z,e.sample_rate)).getBuffer(),G=0;;++G){0!=L&&++t>=L&&n(),0!=u&&G>=u&&(u=0,r*=d),(r*=i+=l)>a&&(r=a,e.p_freq_limit>0&&!0);var H=r;if(k>0&&(y+=w,H=r*(1+Math.sin(y)*k)),(o=Math.floor(H))<8&&(o=8),(s+=c)<0&&(s=0),s>.5&&(s=.5),++E>S[C]){for(E=1,C++;C<3&&0===S[C];)C++;if(3===C)break}R=0===C?E/S[0]:1===C?1+2*Math.pow(1-E/S[1],1)*e.p_env_punch:1-E/S[2],x+=T,(O=Math.abs(Math.floor(x)))>1023&&(O=1023),0!=b&&((_*=b)<1e-5&&(_=1e-5),_>.1&&(_=.1));for(var J=0,X=0;X<8;++X){var Y=0;if(++I>=o&&(I%=o,e.wave_type===NOISE))for(N=0;N<32;++N)B[N]=2*Math.random()-1;var Q=I/o;if(e.wave_type===SQUARE)Y=Q<s?.5:-.5;else if(e.wave_type===SAWTOOTH)Y=1-2*Q;else if(e.wave_type===SINE)Y=Math.sin(2*Q*Math.PI);else if(e.wave_type===NOISE)Y=B[Math.floor(32*I/o)];else if(e.wave_type===TRIANGLE)Y=Math.abs(1-2*Q)-1;else{if(e.wave_type!==BREAKER)throw new Exception("bad wave type! "+e.wave_type);Y=Math.abs(1-Q*Q*2)-1}var $=h;(p*=f)<0&&(p=0),p>.1&&(p=.1),1!=e.p_lpf_freq?(g+=(Y-h)*p,g-=g*m):(h=Y,g=0),v+=(h+=g)-$,Y=v-=v*_,D[1023&A]=Y,Y+=D[A-O+1024&1023],A=A+1&1023,J+=Y*R}F+=J,++V>=q&&(V=0,J=F/q,F=0,J=J/8*masterVolume,J*=j,W[U++]=J,e.sample_rate<SoundEffect.MIN_SAMPLE_RATE&&(W[U++]=J,W[U++]=J,W[U++]=J))}return q>0&&(J=(J=F/q)/8*masterVolume,J*=j,W[U++]=J,e.sample_rate<SoundEffect.MIN_SAMPLE_RATE&&(W[U++]=J,W[U++]=J,W[U++]=J)),P},"undefined"!=typeof exports){var RIFFWAVE=require("./riffwave").RIFFWAVE;exports.Params=Params,exports.generate=generate}var sfxCache={},cachedSeeds=[],CACHE_MAX=50;function cacheSeed(e){if(e in sfxCache)return sfxCache[e];var n=generateFromSeed(e);n.sound_vol=SOUND_VOL,n.sample_rate=SAMPLE_RATE,n.bit_depth=BIT_DEPTH;var t=SoundEffect.generate(n);for(sfxCache[e]=t,cachedSeeds.push(e);cachedSeeds.length>CACHE_MAX;){var r=cachedSeeds[0];cachedSeeds=cachedSeeds.slice(1),delete sfxCache[r]}return t}function playSound(e,n){(!0!==n&&pushSoundToHistory(e),muted)||(checkAudioContextExists(),unitTesting||cacheSeed(e).play())}function killAudioButton(){var e=document.getElementById("muteButton"),n=document.getElementById("unMuteButton");e&&(e.remove(),n.remove())}function showAudioButton(){var e=document.getElementById("muteButton"),n=document.getElementById("unMuteButton");e&&(e.style.display="block",n.style.display="none")}function toggleMute(){0===muted?muteAudio():unMuteAudio()}function muteAudio(){muted=1;var e=document.getElementById("muteButton"),n=document.getElementById("unMuteButton");e&&(e.style.display="none",n.style.display="block")}function unMuteAudio(){muted=0;var e=document.getElementById("muteButton"),n=document.getElementById("unMuteButton");e&&(e.style.display="block",n.style.display="none")}function CodeMirror(e,n){}CodeMirror.defineMode=function(e,n){};var StringStream=CodeMirror.StringStream=function(e,n){this.pos=this.start=0,this.string=e,this.tabSize=n||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};StringStream.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(e){var n=this.string.charAt(this.pos);if("string"==typeof e)var t=n==e;else t=n&&(e.test?e.test(n):e(n));if(t)return++this.pos,n},eatWhile:function(e){for(var n=this.pos;this.eat(e););return this.pos>n},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=countColumn(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?countColumn(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return countColumn(this.string,null,this.tabSize)-(this.lineStart?countColumn(this.string,this.lineStart,this.tabSize):0)},match:function(e,n,t){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&!1!==n&&(this.pos+=r[0].length),r)}var o=function(e){return t?e.toLowerCase():e};if(o(this.string.substr(this.pos,e.length))==o(e))return!1!==n&&(this.pos+=e.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,n){this.lineStart+=e;try{return n()}finally{this.lineStart-=e}}},colorPalettesAliases={1:"mastersystem",2:"gameboycolour",3:"amiga",4:"arnecolors",5:"famicom",6:"atari",7:"pastel",8:"ega",9:"amstrad",10:"proteus_mellow",11:"proteus_rich",12:"proteus_night",13:"c64",14:"whitingjp"},colorPalettes={mastersystem:{black:"#000000",white:"#FFFFFF",grey:"#555555",darkgrey:"#555500",lightgrey:"#AAAAAA",gray:"#555555",darkgray:"#555500",lightgray:"#AAAAAA",red:"#FF0000",darkred:"#AA0000",lightred:"#FF5555",brown:"#AA5500",darkbrown:"#550000",lightbrown:"#FFAA00",orange:"#FF5500",yellow:"#FFFF55",green:"#55AA00",darkgreen:"#005500",lightgreen:"#AAFF00",blue:"#5555AA",lightblue:"#AAFFFF",darkblue:"#000055",purple:"#550055",pink:"#FFAAFF"},gameboycolour:{black:"#000000",white:"#FFFFFF",grey:"#7F7F7C",darkgrey:"#3E3E44",lightgrey:"#BAA7A7",gray:"#7F7F7C",darkgray:"#3E3E44",lightgray:"#BAA7A7",red:"#A7120C",darkred:"#880606",lightred:"#BA381F",brown:"#57381F",darkbrown:"#3E2519",lightbrown:"#8E634B",orange:"#BA4B32",yellow:"#C0BA6F",green:"#517525",darkgreen:"#385D12",lightgreen:"#6F8E44",blue:"#5D6FA7",lightblue:"#8EA7A7",darkblue:"#4B575D",purple:"#3E3E44",pink:"#BA381F"},amiga:{black:"#000000",white:"#FFFFFF",grey:"#BBBBBB",darkgrey:"#333333",lightgrey:"#FFEEDD",gray:"#BBBBBB",darkgray:"#333333",lightgray:"#FFEEDD",red:"#DD1111",darkred:"#990000",lightred:"#FF4422",brown:"#663311",darkbrown:"#331100",lightbrown:"#AA6644",orange:"#FF6644",yellow:"#FFDD66",green:"#448811",darkgreen:"#335500",lightgreen:"#88BB77",blue:"#8899DD",lightblue:"#BBDDEE",darkblue:"#666688",purple:"#665555",pink:"#997788"},arnecolors:{black:"#000000",white:"#FFFFFF",grey:"#9d9d9d",darkgrey:"#697175",lightgrey:"#cccccc",gray:"#9d9d9d",darkgray:"#697175",lightgray:"#cccccc",red:"#be2633",darkred:"#732930",lightred:"#e06f8b",brown:"#a46422",darkbrown:"#493c2b",lightbrown:"#eeb62f",orange:"#eb8931",yellow:"#f7e26b",green:"#44891a",darkgreen:"#2f484e",lightgreen:"#a3ce27",blue:"#1d57f7",lightblue:"#B2DCEF",darkblue:"#1B2632",purple:"#342a97",pink:"#de65e2"},famicom:{black:"#000000",white:"#ffffff",grey:"#7c7c7c",darkgrey:"#080808",lightgrey:"#bcbcbc",gray:"#7c7c7c",darkgray:"#080808",lightgray:"#bcbcbc",red:"#f83800",darkred:"#881400",lightred:"#f87858",brown:"#AC7C00",darkbrown:"#503000",lightbrown:"#FCE0A8",orange:"#FCA044",yellow:"#F8B800",green:"#00B800",darkgreen:"#005800",lightgreen:"#B8F8B8",blue:"#0058F8",lightblue:"#3CBCFC",darkblue:"#0000BC",purple:"#6644FC",pink:"#F878F8"},atari:{black:"#000000",white:"#FFFFFF",grey:"#909090",darkgrey:"#404040",lightgrey:"#b0b0b0",gray:"#909090",darkgray:"#404040",lightgray:"#b0b0b0",red:"#A03C50",darkred:"#700014",lightred:"#DC849C",brown:"#805020",darkbrown:"#703400",lightbrown:"#CB9870",orange:"#CCAC70",yellow:"#ECD09C",green:"#58B06C",darkgreen:"#006414",lightgreen:"#70C484",blue:"#1C3C88",lightblue:"#6888C8",darkblue:"#000088",purple:"#3C0080",pink:"#B484DC"},pastel:{black:"#000000",white:"#FFFFFF",grey:"#3e3e3e",darkgrey:"#313131",lightgrey:"#9cbcbc",gray:"#3e3e3e",darkgray:"#313131",lightgray:"#9cbcbc",red:"#f56ca2",darkred:"#a63577",lightred:"#ffa9cf",brown:"#b58c53",darkbrown:"#787562",lightbrown:"#B58C53",orange:"#EB792D",yellow:"#FFe15F",green:"#00FF4F",darkgreen:"#2b732c",lightgreen:"#97c04f",blue:"#0f88d3",lightblue:"#00fffe",darkblue:"#293a7b",purple:"#ff6554",pink:"#eb792d"},ega:{black:"#000000",white:"#ffffff",grey:"#555555",darkgrey:"#555555",lightgrey:"#aaaaaa",gray:"#555555",darkgray:"#555555",lightgray:"#aaaaaa",red:"#ff5555",darkred:"#aa0000",lightred:"#ff55ff",brown:"#aa5500",darkbrown:"#aa5500",lightbrown:"#ffff55",orange:"#ff5555",yellow:"#ffff55",green:"#00aa00",darkgreen:"#00aaaa",lightgreen:"#55ff55",blue:"#5555ff",lightblue:"#55ffff",darkblue:"#0000aa",purple:"#aa00aa",pink:"#ff55ff"},proteus_mellow:{black:"#3d2d2e",white:"#ddf1fc",grey:"#9fb2d4",darkgrey:"#7b8272",lightgrey:"#a4bfda",gray:"#9fb2d4",darkgray:"#7b8272",lightgray:"#a4bfda",red:"#9d5443",darkred:"#8c5b4a",lightred:"#94614c",brown:"#89a78d",darkbrown:"#829e88",lightbrown:"#aaae97",orange:"#d1ba86",yellow:"#d6cda2",green:"#75ac8d",darkgreen:"#8fa67f",lightgreen:"#8eb682",blue:"#88a3ce",lightblue:"#a5adb0",darkblue:"#5c6b8c",purple:"#d39fac",pink:"#c8ac9e"},proteus_night:{black:"#010912",white:"#fdeeec",grey:"#051d40",darkgrey:"#091842",lightgrey:"#062151",gray:"#051d40",darkgray:"#091842",lightgray:"#062151",red:"#ad4576",darkred:"#934765",lightred:"#ab6290",brown:"#61646b",darkbrown:"#3d2d2d",lightbrown:"#8393a0",orange:"#0a2227",yellow:"#0a2541",green:"#75ac8d",darkgreen:"#0a2434",lightgreen:"#061f2e",blue:"#0b2c79",lightblue:"#809ccb",darkblue:"#08153b",purple:"#666a87",pink:"#754b4d"},proteus_rich:{black:"#6f686f",white:"#d1b1e2",grey:"#b9aac1",darkgrey:"#8e8b84",lightgrey:"#c7b5cd",gray:"#b9aac1",darkgray:"#8e8b84",lightgray:"#c7b5cd",red:"#a11f4f",darkred:"#934765",lightred:"#c998ad",brown:"#89867d",darkbrown:"#797f75",lightbrown:"#ab9997",orange:"#ce8c5c",yellow:"#f0d959",green:"#75bc54",darkgreen:"#599d79",lightgreen:"#90cf5c",blue:"#8fd0ec",lightblue:"#bcdce7",darkblue:"#0b2c70",purple:"#9b377f",pink:"#cd88e5"},amstrad:{black:"#000000",white:"#ffffff",grey:"#7f7f7f",darkgrey:"#636363",lightgrey:"#afafaf",gray:"#7f7f7f",darkgray:"#636363",lightgray:"#afafaf",red:"#ff0000",darkred:"#7f0000",lightred:"#ff7f7f",brown:"#ff7f00",darkbrown:"#7f7f00",lightbrown:"#ffff00",orange:"#ff007f",yellow:"#ffff7f",green:"#01ff00",darkgreen:"#007f00",lightgreen:"#7fff7f",blue:"#0000ff",lightblue:"#7f7fff",darkblue:"#00007f",purple:"#7f007f",pink:"#ff7fff"},c64:{black:"#000000",white:"#ffffff",grey:"#6C6C6C",darkgrey:"#444444",lightgrey:"#959595",gray:"#6C6C6C",darkgray:"#444444",lightgray:"#959595",red:"#68372B",darkred:"#3f1e17",lightred:"#9A6759",brown:"#433900",darkbrown:"#221c02",lightbrown:"#6d5c0d",orange:"#6F4F25",yellow:"#B8C76F",green:"#588D43",darkgreen:"#345129",lightgreen:"#9AD284",blue:"#6C5EB5",lightblue:"#70A4B2",darkblue:"#352879",purple:"#6F3D86",pink:"#b044ac"},whitingjp:{black:"#202527",white:"#eff8fd",grey:"#7b7680",darkgrey:"#3c3b44",lightgrey:"#bed0d7",gray:"#7b7680",darkgray:"#3c3b44",lightgray:"#bed0d7",red:"#bd194b",darkred:"#6b1334",lightred:"#ef2358",brown:"#b52e1c",darkbrown:"#681c12",lightbrown:"#e87b45",orange:"#ff8c10",yellow:"#fbd524",green:"#36bc3c",darkgreen:"#317610",lightgreen:"#8ce062",blue:"#3f62c6",lightblue:"#57bbe0",darkblue:"#2c2fa0",purple:"#7037d9",pink:"#ec2b8f"}};var reg_color_names=/(black|white|darkgray|lightgray|gray|grey|darkgrey|lightgrey|red|darkred|lightred|brown|darkbrown|lightbrown|orange|yellow|green|darkgreen|lightgreen|blue|lightblue|darkblue|purple|pink|transparent)\s*/,reg_color=/(black|white|gray|darkgray|lightgray|grey|darkgrey|lightgrey|red|darkred|lightred|brown|darkbrown|lightbrown|orange|yellow|green|darkgreen|lightgreen|blue|lightblue|darkblue|purple|pink|transparent|#(?:[0-9a-f]{3}){1,2})\s*/;function createSprite(e,n,t,r){void 0===t&&(t=[state.bgcolor,state.fgcolor]);var o=makeSpriteCanvas(e),a=o.getContext("2d");a.clearRect(0,0,cellwidth,cellheight);var i=n[0].length,l=n.length,s=~~(cellwidth/(i+(0|r))),c=~~(cellheight/(l+(0|r))),d=c;"scanline"in state.metadata&&(d=Math.ceil(c/2)),a.fillStyle=state.fgcolor;for(var u=0;u<l;u++)for(var h=0;h<i;h++){var g=n[u][h];if(g>=0){var p=u*c|0,f=h*s|0;a.fillStyle=t[g],a.fillRect(f,p,s,d)}}return o}function regenText(e,n){for(var t in textImages={},titleImage){var r=titleImage[t];for(var o in r){var a=r[o];font.hasOwnProperty(a)&&!textImages.hasOwnProperty(a)&&(fontstr=font[a].split("\n").map((e=>e.trim().split("").map((e=>parseInt(e))))),fontstr.shift(),textImages[a]=createSprite("char"+a,fontstr,void 0,1))}}}var spriteimages,glyphImagesCorrespondance,glyphImages,glyphHighlight,glyphHighlightDiff,glyphHighlightResize,glyphPrintButton,glyphMouseOver,editor_s_grille=[[0,1,1,1,0],[1,0,0,0,0],[0,1,1,1,0],[0,0,0,0,1],[0,1,1,1,0]];function regenSpriteImages(){if(textMode)return spriteimages=[],void regenText();if(!0===IDE&&(textImages.editor_s=createSprite("chars",editor_s_grille,void 0)),0!==state.levels.length){spriteimages=[];for(var e=0;e<sprites.length;e++)null!=sprites[e]&&(spriteimages[e]=createSprite(e.toString(),sprites[e].dat,sprites[e].colors));canOpenEditor&&generateGlyphImages()}}var canvas,ctx,x,y,cellwidth,cellheight,xoffset,yoffset,lastDownTarget,glyphSelectedIndex=0,editorRowCount=1,editorGlyphMovements=[],canvasdict={};function makeSpriteCanvas(e){var n;return e in canvasdict?n=canvasdict[e]:(n=document.createElement("canvas"),canvasdict[e]=n),n.width=cellwidth,n.height=cellheight,n}function generateGlyphImages(){if(0!==cellwidth&&0!==cellheight){for(var e of(glyphImagesCorrespondance=[],glyphImages=[],seenobjects={},state.glyphOrder))if(1==e.length&&state.glyphDict.hasOwnProperty(e)){var n=state.glyphDict[e],t=n.join(",");if(seenobjects.hasOwnProperty(t))continue;var r=makeSpriteCanvas("C"+e),o=r.getContext("2d");glyphImagesCorrespondance.push(e),seenobjects[t]=!0;for(var a=0;a<n.length;a++){var i=n[a];-1!==i&&o.drawImage(spriteimages[i],0,0)}glyphImages.push(r)}if(IDE){(o=(glyphHighlight=makeSpriteCanvas("highlight")).getContext("2d")).fillStyle="#FFFFFF",o.fillRect(0,0,cellwidth,1),o.fillRect(0,0,1,cellheight),o.fillRect(0,cellheight-1,cellwidth,1),o.fillRect(cellwidth-1,0,1,cellheight),glyphPrintButton=textImages.editor_s,(o=(glyphHighlightDiff=makeSpriteCanvas("glyphHighlightDiff")).getContext("2d")).fillStyle=state.bgcolor,o.fillRect(0,0,cellwidth,2),o.fillRect(0,0,2,cellheight),o.fillRect(0,cellheight-2,cellwidth,2),o.fillRect(cellwidth-2,0,2,cellheight),o.fillStyle=state.fgcolor,o.fillRect(0,0,cellwidth,1),o.fillRect(0,0,1,cellheight),o.fillRect(0,cellheight-1,cellwidth,1),o.fillRect(cellwidth-1,0,1,cellheight),glyphPrintButton=textImages.editor_s,(o=(glyphHighlightResize=makeSpriteCanvas("highlightresize")).getContext("2d")).fillStyle="#FFFFFF";var l=cellwidth/2-1|0,s=cellwidth-l-1-l,c=cellheight/2-1|0,d=cellheight-c-1-l;o.fillRect(l,0,s,cellheight),o.fillRect(0,c,cellwidth,d),(o=(glyphMouseOver=makeSpriteCanvas("glyphMouseOver")).getContext("2d")).fillStyle="yellow",o.fillRect(0,0,cellwidth,2),o.fillRect(0,0,2,cellheight),o.fillRect(0,cellheight-2,cellwidth,2),o.fillRect(cellwidth-2,0,2,cellheight);const e=[[[3,2],[5,0],[7,2]],[[3,8],[5,10],[7,8]],[[2,3],[0,5],[2,7]],[[7,3],[10,5],[7,7]],[[3,5],[5,7],[7,5],[5,3]],[[3,3],[5,3],[5,4],[4,4],[4,5],[3,5]]];for(a=0;a<e.length;a++){editorGlyphMovements[a]=makeSpriteCanvas("editorGlyphMovements"+a);var u=e[a];(o=editorGlyphMovements[a].getContext("2d")).lineWidth=1,o.fillStyle=state.bgcolor,o.strokeStyle=state.fgcolor,o.beginPath(),o.moveTo(u[0][0]*cellwidth/10,u[0][1]*cellheight/10);for(var h=1;h<u.length;h++)o.lineTo(u[h][0]*cellwidth/10,u[h][1]*cellheight/10);o.closePath(),o.fill(),o.stroke()}}}}function glyphCount(){var e=0;for(var n of state.glyphOrder)1==n.length&&state.glyphDict.hasOwnProperty(n)&&e++;return e}function redraw(){if(0!==cellwidth&&0!==cellheight)if(void 0===spriteimages&®enSpriteImages(),textMode){ctx.fillStyle=state.bgcolor,ctx.fillRect(0,0,canvas.width,canvas.height);for(var e=0;e<titleWidth;e++)for(var n=0;n<titleHeight;n++){var t=titleImage[n].charAt(e);if(t in textImages){var r=textImages[t];ctx.drawImage(r,xoffset+e*cellwidth,yoffset+n*cellheight)}}}else{var o=level;null!==diffToVisualize&&((o=new Level(-1,diffToVisualize.width,diffToVisualize.height,diffToVisualize.layerCount,diffToVisualize.objects)).movements=diffToVisualize.movements,o.rigidMovementAppliedMask=diffToVisualize.rigidMovementAppliedMask),ctx.fillStyle=state.bgcolor,ctx.fillRect(0,0,canvas.width,canvas.height);var a=0,i=screenwidth,l=0,s=screenheight;if(levelEditorOpened){var c=glyphCount();i-=2,s-=2+(editorRowCount=Math.ceil(c/(screenwidth-1)))}else if(flickscreen){if((h=getPlayerPositions()).length>0){var d=(g=h[0])/o.height|0,u=g%o.height|0;a=(d/screenwidth|0)*screenwidth,l=(u/screenheight|0)*screenheight,i=Math.min(a+screenwidth,o.width),s=Math.min(l+screenheight,o.height),oldflickscreendat=[a,l,i,s]}else oldflickscreendat.length>0&&(a=oldflickscreendat[0],l=oldflickscreendat[1],i=oldflickscreendat[2],s=oldflickscreendat[3])}else if(zoomscreen){var h;if((h=getPlayerPositions()).length>0){var g;d=(g=h[0])/o.height|0,u=g%o.height|0;a=Math.max(Math.min(d-(screenwidth/2|0),o.width-screenwidth),0),l=Math.max(Math.min(u-(screenheight/2|0),o.height-screenheight),0),i=Math.min(a+screenwidth,o.width),s=Math.min(l+screenheight,o.height),oldflickscreendat=[a,l,i,s]}else oldflickscreendat.length>0&&(a=oldflickscreendat[0],l=oldflickscreendat[1],i=oldflickscreendat[2],s=oldflickscreendat[3])}for(e=a;e<i;e++)for(n=l;n<s;n++)for(var p=n+e*o.height,f=o.getCellInto(p,_o12),m=0;m<state.objectCount;m++)if(0!=f.get(m)){r=spriteimages[m];ctx.drawImage(r,xoffset+(e-a)*cellwidth,yoffset+(n-l)*cellheight)}if(null!==diffToVisualize){for(var v=diffToVisualize.lineNumber-1;v>=-1&&!debug_visualisation_array[diffToVisualize.turnIndex].hasOwnProperty(v);v--);var _=debug_visualisation_array[diffToVisualize.turnIndex][v],b=new Level(-1,_.width,_.height,_.layerCount,_.objects);b.movements=_.movements,b.rigidMovementAppliedMask=_.rigidMovementAppliedMask;for(e=a;e<i;e++)for(n=l;n<s;n++){p=n+e*o.height;var y=b.getMovements(p),w=o.getMovements(p),k=b.getCellInto(p,_o11);f=o.getCellInto(p,_o12);w.equals(y)&&f.equals(k)||ctx.drawImage(glyphHighlightDiff,xoffset+(e-a)*cellwidth,yoffset+(n-l)*cellheight)}for(e=a;e<i;e++)for(n=l;n<s;n++){p=n+e*o.height,w=o.getMovements(p);for(var R=0;R<o.layerCount;R++){var C=w.getshiftor(31,5*R);for(m=0;m<5;m++)0!=(C&Math.pow(2,m))&&ctx.drawImage(editorGlyphMovements[m],xoffset+(e-a)*cellwidth,yoffset+(n-l)*cellheight)}}for(e=a;e<i;e++)for(n=l;n<s;n++){p=n+e*o.height;var E=o.getRigids(p);for(R=0;R<o.layerCount;R++){0!==E.getshiftor(31,5*R)&&ctx.drawImage(editorGlyphMovements[5],xoffset+(e-a)*cellwidth,yoffset+(n-l)*cellheight)}}}levelEditorOpened&&drawEditorIcons(a,l)}}function drawEditorIcons(e,n){glyphImages.length;var t=glyphImages.length-0;ctx.drawImage(glyphPrintButton,xoffset-cellwidth,yoffset-cellheight*(1+editorRowCount)),mouseCoordY===-1-editorRowCount&&-1===mouseCoordX&&ctx.drawImage(glyphMouseOver,xoffset-cellwidth,yoffset-cellheight*(1+editorRowCount));for(var r=mouseCoordX+(screenwidth-1)*(l=editorRowCount-(-mouseCoordY-2)-1),o=0;o<t;o++){var a=glyphImages[0+o],i=o%(screenwidth-1),l=o/(screenwidth-1)|0;ctx.drawImage(a,xoffset+i*cellwidth,yoffset+l*cellheight-cellheight*(1+editorRowCount)),mouseCoordX>=0&&mouseCoordX<screenwidth-1&&r===o&&ctx.drawImage(glyphMouseOver,xoffset+i*cellwidth,yoffset+l*cellheight-cellheight*(1+editorRowCount)),o===glyphSelectedIndex&&ctx.drawImage(glyphHighlight,xoffset+i*cellwidth,yoffset+l*cellheight-cellheight*(1+editorRowCount))}var s="",c=null;if(mouseCoordX>=0&&mouseCoordX<screenwidth&&r>=0&&r<t){const e=glyphImagesCorrespondance[0+r];s=e,e in state.synonymsDict?s+=" = "+state.synonymsDict[e]:e in state.aggregatesDict&&(s+=" = "+state.aggregatesDict[e].join(" and "))}if(-1===r)s="print level to console";else if(mouseCoordX>=0&&mouseCoordY>=0&&mouseCoordX<screenwidth&&mouseCoordY<screenheight-editorRowCount-2){const t=level.getCellInto(mouseCoordY+n+(mouseCoordX+e)*level.height,_o12);null!==(c=state.idDict.filter(((e,n)=>0!=t.get(n))))&&(s=c.join(", "))}s.length>0&&(ctx.fillStyle=state.fgcolor,ctx.font='16px "Source Sans Pro", Helvetica, Arial, sans-serif',ctx.fillText(s,xoffset,yoffset-.4*cellheight)),mouseCoordX>=-1&&mouseCoordY>=-1&&mouseCoordX<screenwidth-1&&mouseCoordY<screenheight-1-editorRowCount&&(-1==mouseCoordX||-1==mouseCoordY||mouseCoordX==screenwidth-2||mouseCoordY===screenheight-2-editorRowCount?ctx.drawImage(glyphHighlightResize,xoffset+mouseCoordX*cellwidth,yoffset+mouseCoordY*cellheight):ctx.drawImage(glyphHighlight,xoffset+mouseCoordX*cellwidth,yoffset+mouseCoordY*cellheight))}window.addEventListener("resize",(function(){canvasResize()}),!1),canvas=document.getElementById("gameCanvas"),ctx=canvas.getContext("2d"),x=0,y=0;var oldcellwidth=0,oldcellheight=0,oldtextmode=-1,oldfgcolor=-1,forceRegenImages=!1;function canvasResize(e){if(e||=level,canvas.width=canvas.parentNode.clientWidth,canvas.height=canvas.parentNode.clientHeight,screenwidth=e.width,screenheight=e.height,void 0!==state)if(flickscreen=void 0!==state.metadata.flickscreen,zoomscreen=void 0!==state.metadata.zoomscreen,levelEditorOpened){screenwidth+=2;var n=glyphCount();editorRowCount=Math.ceil(n/(screenwidth-1)),screenheight+=2+editorRowCount}else flickscreen?(screenwidth=state.metadata.flickscreen[0],screenheight=state.metadata.flickscreen[1]):zoomscreen&&(screenwidth=state.metadata.zoomscreen[0],screenheight=state.metadata.zoomscreen[1]);textMode&&(screenwidth=titleWidth,screenheight=titleHeight),cellwidth=canvas.width/screenwidth,cellheight=canvas.height/screenheight;var t=5,r=5;textMode&&(t=6,r=font.X.split("\n").map((e=>e.trim())).length);cellwidth=t*Math.max(~~(cellwidth/t),1),cellheight=r*Math.max(~~(cellheight/r),1),xoffset=0,yoffset=0,cellwidth/t>cellheight/r?(cellwidth=cellheight*t/r,xoffset=(canvas.width-cellwidth*screenwidth)/2,yoffset=(canvas.height-cellheight*screenheight)/2):(cellheight=cellwidth*r/t,yoffset=(canvas.height-cellheight*screenheight)/2,xoffset=(canvas.width-cellwidth*screenwidth)/2),levelEditorOpened&&!textMode&&(xoffset+=cellwidth,yoffset+=cellheight*(1+editorRowCount)),cellheight|=0,xoffset|=0,yoffset|=0,(oldcellwidth!=(cellwidth|=0)||oldcellheight!=cellheight||oldtextmode!=textMode||textMode||oldfgcolor!=state.fgcolor||forceRegenImages)&&(forceRegenImages=!1,regenSpriteImages()),oldcellheight=cellheight,oldcellwidth=cellwidth,oldtextmode=textMode,oldfgcolor=state.fgcolor,redraw()}var RandomGen=new RNG,intro_template=["..................................","..................................","..................................","......Puzzle Script Terminal......","..............v 1.7...............","..................................","..................................","..................................",".........insert cartridge.........","..................................","..................................","..................................",".................................."],messagecontainer_template=["..................................","..................................","..................................","..................................","..................................","..................................","..................................","..................................","..................................","..................................","..........X to continue...........","..................................",".................................."],titletemplate_firstgo=["..................................","..................................","..................................","..................................","..................................","..................................","..........#.start game.#..........","..................................","..................................",".arrow keys to move...............",".X to action......................",".Z to undo, R to restart..........",".................................."],titletemplate_select0=["..................................","..................................","..................................","..................................","..................................","...........#.new game.#...........","..................................",".............continue.............","..................................",".arrow keys to move...............",".X to action......................",".Z to undo, R to restart..........",".................................."],titletemplate_select1=["..................................","..................................","..................................","..................................","..................................",".............new game.............","..................................","...........#.continue.#...........","..................................",".arrow keys to move...............",".X to action......................",".Z to undo, R to restart..........",".................................."],titletemplate_firstgo_selected=["..................................","..................................","..................................","..................................","..................................","..................................","###########.start game.###########","..................................","..................................",".arrow keys to move...............",".X to action......................",".Z to undo, R to restart..........",".................................."],titletemplate_select0_selected=["..................................","..................................","..................................","..................................","..................................","############.new game.############","..................................",".............continue.............","..................................",".arrow keys to move...............",".X to action......................",".Z to undo, R to restart..........",".................................."],titletemplate_select1_selected=["..................................","..................................","..................................","..................................","..................................",".............new game.............","..................................","############.continue.############","..................................",".arrow keys to move...............",".X to action......................",".Z to undo, R to restart..........","................................."],titleImage=[],titleWidth=titletemplate_select1[0].length,titleHeight=titletemplate_select1.length,textMode=!0,titleScreen=!0,titleMode=0,titleSelection=0,titleSelected=!1;function showContinueOptionOnTitleScreen(){return(curlevel>0||null!==curlevelTarget)&&curlevel in state.levels}function unloadGame(){levelEditorOpened=!1,state=introstate,(level=new Level(0,5,5,2,null)).objects=new Int32Array(0),generateTitleScreen(),canvasResize(),redraw()}function generateTitleScreen(){if(titleMode=showContinueOptionOnTitleScreen()?1:0,0!==state.levels.length){var e="PuzzleScript Game";void 0!==state.metadata.title&&(e=state.metadata.title),titleImage=deepClone(0===titleMode?titleSelected?titletemplate_firstgo_selected:titletemplate_firstgo:0===titleSelection?titleSelected?titletemplate_select0_selected:titletemplate_select0:titleSelected?titletemplate_select1_selected:titletemplate_select1);var n="noaction"in state.metadata,t="noundo"in state.metadata,r="norestart"in state.metadata;t&&r?titleImage[11]="..............................................":t?titleImage[11]=".......R to restart...........................":r&&(titleImage[11]=".Z to undo....................."),n&&(titleImage[10]=".......X to select............................");for(var o=0;o<titleImage.length;o++)titleImage[o]=titleImage[o].replace(/\./g," ");var a=titleImage[0].length,i=wordwrap(e,titleImage[0].length);void 0!==state.metadata.author?i.length>3&&(i.splice(3),logWarning("Game title is too long to fit on screen, truncating to three lines.",state.metadata_lines.title,!0)):i.length>5&&(i.splice(5),logWarning("Game title is too long to fit on screen, truncating to five lines.",state.metadata_lines.title,!0));for(o=0;o<i.length;o++){var l=i[o],s=l.length,c=(a-s)/2|0,d=titleImage[1+o];titleImage[1+o]=d.slice(0,c)+l+d.slice(c+l.length)}if(void 0!==state.metadata.author){var u=wordwrap("by "+state.metadata.author,titleImage[0].length);u[0].length<titleImage[0].length&&(u[0]=" "+u[0]),u.length>3&&(u.splice(3),logWarning("Author list too long to fit on screen, truncating to three lines.",state.metadata_lines.author,!0));for(o=0;o<u.length;o++){var h=u[o]+" ";h.length>a&&(h=h.slice(0,a));d=titleImage[3+o];titleImage[3+o]=d.slice(0,a-h.length)+h}}}else titleImage=intro_template}var introstate={title:"EMPTY GAME",attribution:"increpare",objectCount:2,metadata:[],levels:[],bgcolor:"#000000",fgcolor:"#FFFFFF"},state=introstate;function deepClone(e){if(!e)return e;if([Number,String,Boolean].forEach((function(t){e instanceof t&&(n=t(e))})),void 0===n)if("[object Array]"===Object.prototype.toString.call(e))n=[],e.forEach((function(e,t,r){n[t]=deepClone(e)}));else if("object"==typeof e)if(e.nodeType&&"function"==typeof e.cloneNode)var n=e.cloneNode(!0);else if(e.prototype)n=e;else if(e instanceof Date)n=new Date(e);else for(var t in n={},e)n[t]=deepClone(e[t]);else n=e;return n}function wordwrap(e,n){if(!e)return e;var t=".{1,"+(n=n||75)+"}(\\s|$)|.{"+n+"}|.+$";return e.match(RegExp(t,"g"))}var splitMessage=[];function drawMessageScreen(){titleMode=0,textMode=!0,titleImage=deepClone(messagecontainer_template);for(var e=0;e<titleImage.length;e++)titleImage[e]=titleImage[e].replace(/\./g," ");var n=titleImage[9],t=titleImage[10];titleImage[10]=n;var r,o=titleImage[0].length;""===messagetext?r=state.levels[curlevel].message.trim():r=messagetext;var a=5-((splitMessage=wordwrap(r,titleImage[0].length)).length/2|0);a<0&&(a=0);var i=Math.min(splitMessage.length,12);for(e=0;e<i;e++){var l=splitMessage[e],s=a+e,c=l.length,d=(o-c)/2|0,u=titleImage[s];titleImage[s]=u.slice(0,d)+l+u.slice(d+l.length)}var h=10;i>=10&&(h=i<12?i+1:12),titleImage[h]=quittingMessageScreen?n:t,canvasResize()}var loadedLevelSeed=0;function loadLevelFromLevelDat(e,n,t,r){if(null==t&&(t=(Math.random()+Date.now()).toString()),RandomGen=new RNG(loadedLevelSeed=t),forceRegenImages=!0,ignoreNotJustPressedAction=!0,titleScreen=!1,titleMode=showContinueOptionOnTitleScreen()?1:0,titleSelection=showContinueOptionOnTitleScreen()?1:0,titleSelected=!1,againing=!1,void 0===n)return consolePrint("Trying to access a level that doesn't exist.",!0),void goToTitleScreen();void 0===n.message?(titleMode=0,textMode=!1,level=n.clone(),RebuildLevelArrays(),void 0!==e&&(void 0!==e.metadata.flickscreen?oldflickscreendat=[0,0,Math.min(e.metadata.flickscreen[0],level.width),Math.min(e.metadata.flickscreen[1],level.height)]:void 0!==e.metadata.zoomscreen&&(oldflickscreendat=[0,0,Math.min(e.metadata.zoomscreen[0],level.width),Math.min(e.metadata.zoomscreen[1],level.height)])),backups=[],restartTarget=backupLevel(),keybuffer=[],"run_rules_on_level_start"in e.metadata&&(runrulesonlevelstart_phase=!0,processInput(-1,!0),runrulesonlevelstart_phase=!1)):(ignoreNotJustPressedAction=!0,tryPlayShowMessageSound(),drawMessageScreen(),canvasResize()),!0===r&&clearInputHistory()}function loadLevelFromStateTarget(e,n,t,r){curlevel=n,curlevelTarget=t,void 0===t.message&&tryPlayStartLevelSound(),loadLevelFromLevelDat(e,e.levels[n],r),restoreLevel(t),restartTarget=t}function loadLevelFromState(e,n,t){var r=e.levels[n];curlevel=n,curlevelTarget=null,void 0!==r&&void 0===r.message&&tryPlayStartLevelSound(),loadLevelFromLevelDat(e,r,t)}var sprites=[{color:"#423563",dat:[[1,1,1,1,1],[1,0,0,0,1],[1,0,0,0,1],[1,0,0,0,1],[1,1,1,1,1]]},{color:"#252342",dat:[[0,0,1,0,0],[1,1,1,1,1],[0,0,1,0,0],[0,1,1,1,0],[0,1,0,1,0]]}];function tryPlaySimpleSound(e){void 0!==state.sfx_Events[e]&&playSound(state.sfx_Events[e],!0)}function tryPlayTitleSound(){tryPlaySimpleSound("titlescreen")}function tryPlayStartGameSound(){tryPlaySimpleSound("startgame")}function tryPlayEndGameSound(){tryPlaySimpleSound("endgame")}function tryPlayCancelSound(){tryPlaySimpleSound("cancel")}function tryPlayStartLevelSound(){tryPlaySimpleSound("startlevel")}function tryPlayEndLevelSound(){tryPlaySimpleSound("endlevel")}function tryPlayUndoSound(){tryPlaySimpleSound("undo")}function tryPlayRestartSound(){tryPlaySimpleSound("restart")}function tryPlayShowMessageSound(){tryPlaySimpleSound("showmessage")}function tryPlayCloseMessageSound(){tryPlaySimpleSound("closemessage")}generateTitleScreen(),titleMode>0&&(titleSelection=1),canvasResize();var restartTarget,backups=[];function backupLevel(){return{dat:new Int32Array(level.objects),width:level.width,height:level.height,oldflickscreendat:oldflickscreendat.concat([])}}function level4Serialization(){return{dat:Array.from(level.objects),width:level.width,height:level.height,oldflickscreendat:oldflickscreendat.concat([])}}function setGameState(e,n,t){if(void 0!==e){for(var r in oldflickscreendat=[],timer=0,autotick=0,winning=!1,againing=!1,messageselected=!1,STRIDE_MOV=e.STRIDE_MOV,STRIDE_OBJ=e.STRIDE_OBJ,sfxCreateMask=new BitVec(STRIDE_OBJ),sfxDestroyMask=new BitVec(STRIDE_OBJ),void 0===n&&(n=["restart"]),(0===state.levels.length||0===e.levels.length)&&n.length>0&&"rebuild"===n[0]&&(n=["restart"]),void 0===t&&(t=null),RandomGen=new RNG(t),state=e,"rebuild"!==n[0]&&(backups=[]),sprites=[],state.objects)if(state.objects.hasOwnProperty(r)){var o=state.objects[r],a={colors:o.colors,dat:o.spritematrix};sprites[o.id]=a}switch(void 0!==state.metadata.realtime_interval?(autotick=0,autotickinterval=1e3*state.metadata.realtime_interval):(autotick=0,autotickinterval=0),repeatinterval=void 0!==state.metadata.key_repeat_interval?1e3*state.metadata.key_repeat_interval:150,againinterval=void 0!==state.metadata.again_interval?1e3*state.metadata.again_interval:150,throttle_movement&&0===autotickinterval&&logWarning("throttle_movement is designed for use in conjunction with realtime_interval. Using it in other situations makes games gross and unresponsive, broadly speaking. Please don't."),norepeat_action=void 0!==state.metadata.norepeat_action,n[0]){case"restart":winning=!1,timer=0,titleScreen=!0,tryPlayTitleSound(),textMode=!0,titleSelection=showContinueOptionOnTitleScreen()?1:0,titleSelected=!1,quittingMessageScreen=!1,quittingTitleScreen=!1,messageselected=!1,titleMode=0,showContinueOptionOnTitleScreen()&&(titleMode=1),generateTitleScreen();break;case"rebuild":break;case"loadFirstNonMessageLevel":for(var i=0;i<state.levels.length;i++)if(!state.levels[i].hasOwnProperty("message")){curlevel=l=i,curlevelTarget=null,winning=!1,timer=0,titleScreen=!1,textMode=!1,titleSelection=showContinueOptionOnTitleScreen()?1:0,titleSelected=!1,quittingMessageScreen=!1,quittingTitleScreen=!1,messageselected=!1,titleMode=0,loadLevelFromState(state,l,t);break}break;case"loadLevel":var l=n[1];curlevel=l,curlevelTarget=null,winning=!1,timer=0,titleScreen=!1,textMode=!1,titleSelection=showContinueOptionOnTitleScreen()?1:0,titleSelected=!1,quittingMessageScreen=!1,quittingTitleScreen=!1,messageselected=!1,titleMode=0,loadLevelFromState(state,l,t);break;case"levelline":var s=n[1];for(i=state.levels.length-1;i>=0;i--){if(state.levels[i].lineNumber<=s+1){curlevel=i,curlevelTarget=null,winning=!1,timer=0,titleScreen=!1,textMode=!1,titleSelection=showContinueOptionOnTitleScreen()?1:0,titleSelected=!1,quittingMessageScreen=!1,quittingTitleScreen=!1,messageselected=!1,titleMode=0,loadLevelFromState(state,i);break}}}"rebuild"!==n[0]&&clearInputHistory(),canvasResize(),0==state.sounds.length?killAudioButton():showAudioButton()}else e=introstate}function RebuildLevelArrays(){level.movements=new Int32Array(level.n_tiles*STRIDE_MOV),level.rigidMovementAppliedMask=[],level.rigidGroupIndexMask=[],level.rowCellContents=[],level.rowCellContents_Movements=[],level.colCellContents=[],level.colCellContents_Movements=[],level.mapCellContents=new BitVec(STRIDE_OBJ),level.mapCellContents_Movements=new BitVec(STRIDE_MOV),_movementVecs=[new BitVec(STRIDE_MOV),new BitVec(STRIDE_MOV),new BitVec(STRIDE_MOV)],_rigidVecs=[new BitVec(STRIDE_MOV),new BitVec(STRIDE_MOV),new BitVec(STRIDE_MOV)],_o1=new BitVec(STRIDE_OBJ),_o2=new BitVec(STRIDE_OBJ),_o2_5=new BitVec(STRIDE_OBJ),_o3=new BitVec(STRIDE_OBJ),_o4=new BitVec(STRIDE_OBJ),_o5=new BitVec(STRIDE_OBJ),_o6=new BitVec(STRIDE_OBJ),_o7=new BitVec(STRIDE_OBJ),_o8=new BitVec(STRIDE_OBJ),_o9=new BitVec(STRIDE_OBJ),_o10=new BitVec(STRIDE_OBJ),_o11=new BitVec(STRIDE_OBJ),_o12=new BitVec(STRIDE_OBJ),_m1=new BitVec(STRIDE_MOV),_m2=new BitVec(STRIDE_MOV),_m3=new BitVec(STRIDE_MOV);for(var e=0;e<level.height;e++)level.rowCellContents[e]=new BitVec(STRIDE_OBJ);for(e=0;e<level.width;e++)level.colCellContents[e]=new BitVec(STRIDE_OBJ);for(e=0;e<level.height;e++)level.rowCellContents_Movements[e]=new BitVec(STRIDE_MOV);for(e=0;e<level.width;e++)level.colCellContents_Movements[e]=new BitVec(STRIDE_MOV);for(e=0;e<level.n_tiles;e++)level.rigidMovementAppliedMask[e]=new BitVec(STRIDE_MOV),level.rigidGroupIndexMask[e]=new BitVec(STRIDE_MOV)}var messagetext="";function applyDiff(e,n){for(var t=0;t<e.dat.length;){var r=e.dat[t],o=e.dat[t+1];if(0===o)break;for(var a=0;a<o;a++)n[r+a]=e.dat[t+2+a];t+=2+o}}function unconsolidateDiff(e,n){if(!e.hasOwnProperty("diff"))return e;var t=new Int32Array(n.dat);return applyDiff(e,t),{dat:t,width:e.width,height:e.height,oldflickscreendat:e.oldflickscreendat}}function restoreLevel(e){var n=e.hasOwnProperty("diff");if(oldflickscreendat=e.oldflickscreendat.concat([]),n?applyDiff(e,level.objects):level.objects=new Int32Array(e.dat),level.width!==e.width||level.height!==e.height)level.width=e.width,level.height=e.height,level.n_tiles=e.width*e.height,RebuildLevelArrays();else{for(var t=0;t<level.n_tiles;t++)level.movements[t]=0,level.rigidMovementAppliedMask[t].setZero(),level.rigidGroupIndexMask[t].setZero();for(t=0;t<level.height;t++){level.rowCellContents[t].setZero()}for(t=0;t<level.width;t++){level.colCellContents[t].setZero()}}againing=!1,level.commandQueue=[],level.commandQueueSourceRules=[]}var zoomscreen=!1,flickscreen=!1,screenwidth=0,screenheight=0;function consolidateDiff(e,n){if(e.width!==n.width||e.height!==n.height||e.dat.length!==n.dat.length)return e;if(e.hasOwnProperty("diff")||n.hasOwnProperty("diff"))return e;if(e.dat.length<1024)return e;for(var t=new Int32Array(128),r=0,o=!1,a=-1,i=e.dat,l=n.dat,s=0;s<i.length;s++)if(!1===o){if(i[s]!==l[s]){if(o=!0,a=r,t.length<r+4)(c=new Int32Array(2*t.length)).set(t),t=c;t[r+0]=s,t[r+1]=1,t[r+2]=i[s],r+=3}}else if(i[s]!==l[s]){var c;if(r+1>=t.length)if(t.length<r+4)(c=new Int32Array(2*t.length)).set(t),t=c;t[a+1]++,t[r]=i[s],r++}else o=!1;return{diff:!0,dat:t,width:e.width,height:e.height,oldflickscreendat:e.oldflickscreendat}}function addUndoState(e){backups.push(e),backups.length>2&&!backups[backups.length-1].hasOwnProperty("diff")&&(backups[backups.length-3]=consolidateDiff(backups[backups.length-3],backups[backups.length-2]))}function DoRestart(e){!0!==restarting&&(!0!==e&&"norestart"in state.metadata||(againing&&DoUndo(e,!0),restarting=!0,!0!==e&&addUndoState(backupLevel()),verbose_logging&&consolePrint("--- restarting ---",!0),restoreLevel(restartTarget),tryPlayRestartSound(),"run_rules_on_level_start"in state.metadata&&processInput(-1,!0),level.commandQueue=[],level.commandQueueSourceRules=[],restarting=!1))}function backupDiffers(){if(0==backups.length)return!0;var e=backups[backups.length-1];if(e.hasOwnProperty("diff"))return 0!==e.dat.length&&0!==e.dat[1];for(var n=0;n<level.objects.length;n++)if(level.objects[n]!==e.dat[n])return!0;return!1}function DoUndo(e,n){if(levelEditorOpened||!("noundo"in state.metadata)||!0===e){if(verbose_logging&&consolePrint("--- undoing ---",!0),n)for(;0==backupDiffers();)backups.pop();if(backups.length>0)restoreLevel(backups[backups.length-1]),backups=backups.splice(0,backups.length-1),e||tryPlayUndoSound()}}function getPlayerPositions(){for(var e=[],n=state.playerMask,t=0;t<level.n_tiles;t++)level.getCellInto(t,_o11),n.anyBitsInCommon(_o11)&&e.push(t);return e}function getLayersOfMask(e){for(var n=[],t=0;t<state.objectCount;t++)if(e.get(t)){var r=state.idDict[t],o=state.objects[r];n.push(o.layer)}return n}function moveEntitiesAtIndex(e,n,t){var r=level.getCell(e);r.iand(n);for(var o=getLayersOfMask(r),a=level.getMovements(e),i=0;i<o.length;i++)a.ishiftor(t,5*o[i]);level.setMovements(e,a);var l=e/level.height|0,s=e%level.height;level.colCellContents_Movements[l].ior(a),level.rowCellContents_Movements[s].ior(a),level.mapCellContents_Movements.ior(a)}function startMovement(e){for(var n=getPlayerPositions(),t=0;t<n.length;t++){moveEntitiesAtIndex(n[t],state.playerMask,e)}return n}var dirMasksDelta={1:[0,-1],2:[0,1],4:[-1,0],8:[1,0],15:[0,0],16:[0,0],3:[0,0]},dirMaskName={1:"up",2:"down",4:"left",8:"right",15:"?",16:"action",3:"no"},seedsToPlay_CanMove=[],seedsToPlay_CantMove=[];function repositionEntitiesOnLayer(e,n,t){var r=dirMasksDelta[t],o=r[0],a=r[1],i=e/level.height|0,l=e%level.height,s=level.width-1,c=level.height-1;if(0===i&&o<0||i===s&&o>0||0===l&&a<0||l===c&&a>0)return!1;var d=e+r[1]+r[0]*level.height,u=state.layerMasks[n],h=level.getCellInto(d,_o7),g=level.getCellInto(e,_o8);if(u.anyBitsInCommon(h)&&16!=t)return!1;for(var p=0;p<state.sfx_MovementMasks[n].length;p++){var f=state.sfx_MovementMasks[n][p];if(f.objectMask.anyBitsInCommon(g)){var m=level.getMovements(e),v=f.directionMask;m.anyBitsInCommon(v)&&-1===seedsToPlay_CanMove.indexOf(f.seed)&&seedsToPlay_CanMove.push(f.seed)}}var _=g.clone();g.iclear(u),_.iand(u),h.ior(_),level.setCell(e,g),level.setCell(d,h);var b=d/level.height|0,y=d%level.height;return level.colCellContents[b].ior(_),level.rowCellContents[y].ior(_),!0}function repositionEntitiesAtCell(e){var n=level.getMovements(e);if(n.iszero())return!1;for(var t=!1,r=0;r<level.layerCount;r++){var o=n.getshiftor(31,5*r);if(0!==o)repositionEntitiesOnLayer(e,r,o)&&(n.ishiftclear(o,5*r),t=!0)}return level.setMovements(e,n),t}var ellipsisPattern=["ellipsis"];function Rule(e){this.direction=e[0],this.patterns=e[1],this.hasReplacements=e[2],this.lineNumber=e[3],this.ellipsisCount=e[4],this.groupNumber=e[5],this.isRigid=e[6],this.commands=e[7],this.isRandom=e[8],this.cellRowMasks=e[9],this.cellRowMasks_Movements=e[10],this.ruleMask=this.cellRowMasks.reduce(((e,n)=>(e.ior(n),e)),new BitVec(STRIDE_OBJ)),this.cellRowMatches=[];for(var n=0;n<this.patterns.length;n++)this.cellRowMatches.push(this.generateCellRowMatchesFunction(this.patterns[n],this.ellipsisCount[n]))}Rule.prototype.generateCellRowMatchesFunction=function(e,n){if(0===n){for(var t=e.length,r="",o=1===STRIDE_OBJ?"":"*"+STRIDE_OBJ,a=0;a<STRIDE_OBJ;++a)r+="var cellObjects"+a+" = objects[i"+o+(a?"+"+a:"")+"];\n";o=1===STRIDE_MOV?"":"*"+STRIDE_MOV;for(a=0;a<STRIDE_MOV;++a)r+="var cellMovements"+a+" = movements[i"+o+(a?"+"+a:"")+"];\n";r+="return "+e[0].generateMatchString("0_");for(var i=1;i<t;i++)r+="&&cellRow["+i+"].matches(i+"+i+"*d, objects, movements)";return(r+=";")in matchCache?matchCache[r]:matchCache[r]=new Function("cellRow","i","d","objects","movements",r)}if(1===n){t=e.length,r="var result = [];\n";r+="if(cellRow[0].matches(i, objects, movements)";for(i=1;e[i]!==ellipsisPattern;i++)r+="&&cellRow["+i+"].matches(i+"+i+"*d, objects, movements)";for(r+=") {\n",r+="\tfor (var k=kmin;k<kmax;k++) {\n",r+="\t\tif(cellRow["+ ++i+"].matches((i+d*(k+"+(i-1)+")), objects, movements)",i++;i<t;i++)r+="&&cellRow["+i+"].matches((i+d*(k+"+(i-1)+")), objects, movements)";return r+="){\n",r+="\t\t\tresult.push([i,k]);\n",r+="\t\t}\n",r+="\t}\n",r+="}\n",(r+="return result;")in matchCache?matchCache[r]:matchCache[r]=new Function("cellRow","i","kmax","kmin","d","objects","movements",r)}t=e.length;var l=-1,s=-1;for(i=0;i<t;i++)if(e[i]===ellipsisPattern){if(-1!==l){s=i;break}l=i}r="var result = [];\n";r+="if(cellRow[0].matches(i, objects, movements)";for(var c=1;c<l;c++)r+="&&cellRow["+c+"].matches(i+"+c+"*d, objects, movements)";r+=") {\n",r+="\tfor (var k1=k1min;k1<k1max;k1++) {\n",r+="\t\tif(cellRow["+(l+1)+"].matches((i+d*(k1+"+(l+1-1)+")), objects, movements)";for(c=l+2;c<s;c++)r+="&&cellRow["+c+"].matches((i+d*(k1+"+(c-1)+")), objects, movements)";r+="\t\t){\n",r+="\t\t\tfor (var k2=k2min;k1+k2<kmax && k2<k2max;k2++) {\n",r+="\t\t\t\tif(cellRow["+(s+1)+"].matches((i+d*(k1+k2+"+(s+1-2)+")), objects, movements)";for(c=s+2;c<t;c++)r+="&&cellRow["+c+"].matches((i+d*(k1+k2+"+(c-2)+")), objects, movements)";return r+="\t\t\t\t){\n",r+="\t\t\t\t\tresult.push([i,k1,k2]);\n",r+="\t\t\t\t}\n",r+="\t\t\t}\n",r+="\t\t}\n",r+="\t}\n",r+="}\n",(r+="return result;")in matchCache?matchCache[r]:matchCache[r]=new Function("cellRow","i","kmax","kmin","k1max","k1min","k2max","k2min","d","objects","movements",r)};var STRIDE_OBJ=1,STRIDE_MOV=1;function CellPattern(e){this.objectsPresent=e[0],this.objectsMissing=e[1],this.anyObjectsPresent=e[2],this.movementsPresent=e[3],this.movementsMissing=e[4],this.matches=this.generateMatchFunction(),this.replacement=e[5]}function CellReplacement(e){this.objectsClear=e[0],this.objectsSet=e[1],this.movementsClear=e[2],this.movementsSet=e[3],this.movementsLayerMask=e[4],this.randomEntityMask=e[5],this.randomDirMask=e[6]}var _o1,_o2,_o2_5,_o3,_o4,_o5,_o6,_o7,_o8,_o9,_o10,_o11,_o12,_m1,_m2,_m3,matchCache={};function matchCellRow(e,n,t,r,o,a){var i=[];if(!r.bitsSetInArray(level.mapCellContents.data)||!o.bitsSetInArray(level.mapCellContents_Movements.data))return i;var l=0,s=level.width,c=0,d=level.height,u=t.length;switch(e){case 1:c+=u-1;break;case 2:d-=u-1;break;case 4:l+=u-1;break;case 8:s-=u-1;break;default:window.console.log("EEEP "+e)}if(e>2){for(var h=c;h<d;h++)if(r.bitsSetInArray(level.rowCellContents[h].data)&&o.bitsSetInArray(level.rowCellContents_Movements[h].data))for(var g=l;g<s;g++){n(t,p=g*level.height+h,a,level.objects,level.movements)&&i.push(p)}}else for(g=l;g<s;g++)if(r.bitsSetInArray(level.colCellContents[g].data)&&o.bitsSetInArray(level.colCellContents_Movements[g].data))for(h=c;h<d;h++){var p;n(t,p=g*level.height+h,a,level.objects,level.movements)&&i.push(p)}return i}function matchCellRowWildCard(e,n,t,r,o,a,i){var l=[];if(!r.bitsSetInArray(level.mapCellContents.data)||!o.bitsSetInArray(level.mapCellContents_Movements.data))return l;var s=0,c=level.width,d=0,u=level.height,h=t.length-i;switch(e){case 1:d+=h-1;break;case 2:u-=h-1;break;case 4:s+=h-1;break;case 8:c-=h-1;break;default:window.console.log("EEEP2 "+e)}if(e>2){for(var g=d;g<u;g++)if(r.bitsSetInArray(level.rowCellContents[g].data)&&o.bitsSetInArray(level.rowCellContents_Movements[g].data))for(var p=s;p<c;p++){var f=p*level.height+g;4===e?m=p-h+2:8===e?m=level.width-(p+h)+1:window.console.log("EEEP2 "+e),1===i?l.push.apply(l,n(t,f,m,0,a,level.objects,level.movements)):l.push.apply(l,n(t,f,m,0,m,0,m,0,a,level.objects,level.movements))}}else for(p=s;p<c;p++)if(r.bitsSetInArray(level.colCellContents[p].data)&&o.bitsSetInArray(level.colCellContents_Movements[p].data))for(g=d;g<u;g++){var m;f=p*level.height+g;2===e?m=level.height-(g+h)+1:1===e?m=g-h+2:window.console.log("EEEP2 "+e),1===i?l.push.apply(l,n(t,f,m,0,a,level.objects,level.movements)):l.push.apply(l,n(t,f,m,0,m,0,m,0,a,level.objects,level.movements))}return l}function generateTuples(e){for(var n=[[]],t=0;t<e.length;t++){for(var r=e[t],o=[],a=0;a<r.length;a++)for(var i=r[a],l=0;l<n.length;l++){var s=n[l].concat([i]);o.push(s)}n=o}return n}function showTempMessage(){keybuffer=[],textMode=!0,titleScreen=!1,quittingMessageScreen=!1,messageselected=!1,ignoreNotJustPressedAction=!0,tryPlayShowMessageSound(),drawMessageScreen(),canvasResize()}function processOutputCommands(e){for(var n=0;n<e.length;n++){var t=e[n];"f"===t.charAt(1)&&tryPlaySimpleSound(t),!1===unitTesting&&"message"===t&&showTempMessage()}}function applyRandomRuleGroup(e,n){for(var t=[],r=0;r<n.length;r++){var o=(c=n[r]).findMatches();if(o.length>0)for(var a=generateTuples(o),i=0;i<a.length;i++){var l=a[i];t.push([r,l])}}if(0===t.length)return!1;var s=t[Math.floor(RandomGen.uniform()*t.length)],c=n[r=s[0]];l=s[1];const d=e.delta_index(c.direction);var u=c.applyAt(e,l,!1,d);return c.queueCommands(),u}function applyRuleGroup(e){if(e[0].isRandom)return applyRandomRuleGroup(level,e);for(var n=!1,t=!0,r=0,o=-1;t;){if(++r>200){logErrorCacheable("Got caught looping lots in a rule group :O",e[0].lineNumber,!0);break}t=!1;for(var a=0;a<e.length;a++){if(e[a].tryApply(level)?(t=!0,o=0):o++,o===e.length)break}t&&(n=!0,verbose_logging&&(debugger_turnIndex++,addToDebugTimeline(level,-2)))}return n}function applyRules(e,n,t,r){for(var o=t>0,a=0,i=t;i<e.length;){if(r&&r[i]);else o=applyRuleGroup(e[i])||o;if(o&&void 0!==n[i]){if(i=n[i],o=!1,++a>200){logErrorCacheable("got caught in an endless startloop...endloop vortex, escaping!",e[i][0].lineNumber,!0);break}verbose_logging&&(debugger_turnIndex++,addToDebugTimeline(level,-2))}else{if(++i===e.length&&o&&void 0!==n[i]&&(i=n[i],o=!1,++a>200)){logErrorCacheable("got caught in an endless startloop...endloop vortex, escaping!",e[i][0].lineNumber,!0);break}verbose_logging&&(debugger_turnIndex++,addToDebugTimeline(level,-2))}}}function resolveMovements(e,n){for(var t=!0;t;){t=!1;for(var r=0;r<e.n_tiles;r++)t=repositionEntitiesAtCell(r)||t}var o=!1;for(r=0;r<e.n_tiles;r++){var a=e.getCellInto(r,_o6),i=e.getMovements(r);if(!i.iszero()){var l=e.rigidMovementAppliedMask[r];if(!l.iszero()&&(i.iand(l),!i.iszero()))for(var s=0;s<e.layerCount;s++){if(0!==i.getshiftor(31,5*s)){var c=e.rigidGroupIndexMask[r].getshiftor(31,5*s);c--;var d=state.rigidGroupIndex_to_GroupIndex[c];!0!==n[d]&&(n[d]=!0,o=!0);break}}for(s=0;s<state.sfx_MovementFailureMasks.length;s++){var u=state.sfx_MovementFailureMasks[s];if(u.objectMask.anyBitsInCommon(a)){var h=u.directionMask;i.anyBitsInCommon(h)&&-1===seedsToPlay_CantMove.indexOf(u.seed)&&seedsToPlay_CantMove.push(u.seed)}}}for(s=0;s<STRIDE_MOV;s++)e.movements[s+r*STRIDE_MOV]=0;e.rigidGroupIndexMask[r].setZero(),e.rigidMovementAppliedMask[r].setZero()}return o}CellPattern.prototype.generateMatchString=function(){for(var e="(true",n=0;n<Math.max(STRIDE_OBJ,STRIDE_MOV);++n){var t="cellObjects"+n,r="cellMovements"+n,o=this.objectsPresent.data[n],a=this.objectsMissing.data[n],i=this.movementsPresent.data[n],l=this.movementsMissing.data[n];o&&(e+=o&o-1?"\t\t&& (("+t+"&"+o+")==="+o+")\n":"\t\t&& ("+t+"&"+o+")\n"),a&&(e+="\t\t&& !("+t+"&"+a+")\n"),i&&(e+=i&i-1?"\t\t&& (("+r+"&"+i+")==="+i+")\n":"\t\t&& ("+r+"&"+i+")\n"),l&&(e+="\t\t&& !("+r+"&"+l+")\n")}for(var s=0;s<this.anyObjectsPresent.length;s++){e+="\t\t&& (0";for(n=0;n<STRIDE_OBJ;++n){var c=this.anyObjectsPresent[s].data[n];c&&(e+="|(cellObjects"+n+"&"+c+")")}e+=")"}return e+="\t)"},CellPattern.prototype.generateMatchFunction=function(){for(var e="",n=1===STRIDE_OBJ?"":"*"+STRIDE_OBJ,t=0;t<STRIDE_OBJ;++t)e+="\tvar cellObjects"+t+" = objects[i"+n+(t?"+"+t:"")+"];\n";n=1===STRIDE_MOV?"":"*"+STRIDE_MOV;for(t=0;t<STRIDE_MOV;++t)e+="\tvar cellMovements"+t+" = movements[i"+n+(t?"+"+t:"")+"];\n";return(e+="return "+this.generateMatchString()+";")in matchCache?matchCache[e]:matchCache[e]=new Function("i","objects","movements",e)},CellPattern.prototype.replace=function(e,n){var t=this.replacement;if(null===t)return!1;var r=t.randomEntityMask,o=t.randomDirMask,a=t.objectsSet.cloneInto(_o1),i=t.objectsClear.cloneInto(_o2),l=t.movementsSet.cloneInto(_m1),s=t.movementsClear.cloneInto(_m2);if(s.ior(t.movementsLayerMask),!r.iszero()){for(var c=[],d=0;d<32*STRIDE_OBJ;d++)r.get(d)&&c.push(d);var u=c[Math.floor(RandomGen.uniform()*c.length)],h=state.idDict[u],g=state.objects[h];a.ibitset(u),i.ior(state.layerMasks[g.layer]),s.ishiftor(31,5*g.layer)}if(!o.iszero())for(var p=0;p<level.layerCount;p++)if(o.get(5*p)){var f=Math.floor(4*RandomGen.uniform());l.ibitset(f+5*p)}var m=level.getCellInto(n,_o2_5),v=level.getMovements(n),_=m.cloneInto(_o3),b=v.cloneInto(_m3);m.iclear(i),m.ior(a),v.iclear(s),v.ior(l);var y=!1,w=0,k=0;if(e.isRigid){var R=state.groupNumber_to_RigidGroupIndex[e.groupNumber];R++;for(var C=new BitVec(STRIDE_MOV),E=0;E<level.layerCount;E++)C.ishiftor(R,5*E);C.iand(t.movementsLayerMask),w=level.rigidGroupIndexMask[n]||new BitVec(STRIDE_MOV),k=level.rigidMovementAppliedMask[n]||new BitVec(STRIDE_MOV),C.bitsSetInArray(w.data)||t.movementsLayerMask.bitsSetInArray(k.data)||(w.ior(C),k.ior(t.movementsLayerMask),y=!0)}var S=!1;if(!_.equals(m)||!b.equals(v)||y){S=!0,y&&(level.rigidGroupIndexMask[n]=w,level.rigidMovementAppliedMask[n]=k);var M=m.cloneInto(_o4);M.iclear(_),sfxCreateMask.ior(M);var I=_.cloneInto(_o5);I.iclear(m),sfxDestroyMask.ior(I),level.setCell(n,m),level.setMovements(n,v);var x=n/level.height|0,T=n%level.height;level.colCellContents[x].ior(m),level.rowCellContents[T].ior(m),level.mapCellContents.ior(m)}return S},Rule.prototype.findMatches=function(){if(!this.ruleMask.bitsSetInArray(level.mapCellContents.data))return[];const e=level.delta_index(this.direction);for(var n=[],t=this.cellRowMasks,r=this.cellRowMasks_Movements,o=0;o<this.patterns.length;o++){var a=this.patterns[o],i=this.cellRowMatches[o];if(1===this.ellipsisCount[o])var l=matchCellRowWildCard(this.direction,i,a,t[o],r[o],e,this.ellipsisCount[o]);else if(0===this.ellipsisCount[o])l=matchCellRow(this.direction,i,a,t[o],r[o],e);else l=matchCellRowWildCard(this.direction,i,a,t[o],r[o],e,this.ellipsisCount[o]);if(0===l.length)return[];n.push(l)}return n},Rule.prototype.directional=function(){for(var e=0;e<state.rules.length;e++)for(var n=state.rules[e],t=0,r=0;r<n.length;r++)if(this.lineNumber===n[r].lineNumber&&t++,t>1)return!0;return!1},Rule.prototype.applyAt=function(e,n,t,r){var o=this;if(t)for(var a=0;a<this.patterns.length;a++)if(1===this.ellipsisCount[a]){if(0==this.cellRowMatches[a](this.patterns[a],n[a][0],n[a][1]+1,n[a][1],r,e.objects,e.movements).length)return!1}else if(2===this.ellipsisCount[a]){if(0==this.cellRowMatches[a](this.patterns[a],n[a][0],n[a][1]+n[a][2]+1,n[a][1]+n[a][2],n[a][1]+1,n[a][1],n[a][2]+1,n[a][2],r,e.objects,e.movements).length)return!1}else if(!this.cellRowMatches[a](this.patterns[a],n[a],r,e.objects,e.movements))return!1;var i=!1;for(a=0;a<o.patterns.length;a++)for(var l=o.patterns[a],s=0,c=o.ellipsisCount[a]>0?n[a][0]:n[a],d=0;d<l.length;d++){var u=l[d];if(u!==ellipsisPattern)i=u.replace(o,c)||i,c+=r;else{var h=n[a][1+s];s++,!0,c+=r*h}}if(verbose_logging&&i){var g=dirMaskName[o.direction];o.directional()||(g="");var p=addToDebugTimeline(e,o.lineNumber);consolePrint(`<font color="green">Rule <a onclick="jumpToLine(${o.lineNumber});" href="javascript:void(0);">${o.lineNumber}</a> ${g} applied.</font>`,!1,o.lineNumber,p)}return i},Rule.prototype.tryApply=function(e){const n=e.delta_index(this.direction);var t=this.findMatches();if(0===t.length)return!1;var r=!1;if(this.hasReplacements)for(var o=generateTuples(t),a=0;a<o.length;a++){var i=o[a],l=a>0;r=this.applyAt(e,i,l,n)||r}return t.length>0&&this.queueCommands(),r},Rule.prototype.queueCommands=function(){var e=this.commands;if(0!=e.length){for(var n=level.commandQueue.indexOf("cancel")>=0,t=level.commandQueue.indexOf("restart")>=0,r=!1,o=!1,a=0;a<e.length;a++){var i=e[a][0];"cancel"===i?r=!0:"restart"===i&&(o=!0)}if(!n&&(!t||r)){(r||o)&&(level.commandQueue=[],level.commandQueueSourceRules=[],messagetext="");for(a=0;a<e.length;a++){var l=e[a];if(!(level.commandQueue.indexOf(l[0])>=0)){if(level.commandQueue.push(l[0]),level.commandQueueSourceRules.push(this),verbose_logging){var s=this.lineNumber;dirMaskName[this.direction];consolePrint('<font color="green">Rule <a onclick="jumpToLine('+s.toString()+');" href="javascript:void(0);">'+s.toString()+"</a> triggers command "+l[0]+".</font>",!1,s,null)}"message"===l[0]&&(messagetext=l[1])}}}}};var sfxCreateMask=null,sfxDestroyMask=null;function calculateRowColMasks(){for(var e=0;e<level.mapCellContents.data.length;e++)level.mapCellContents.data[e]=0,level.mapCellContents_Movements.data[e]=0;for(e=0;e<level.width;e++){level.colCellContents[e].setZero(),level.colCellContents_Movements[e].setZero()}for(e=0;e<level.height;e++){level.rowCellContents[e].setZero(),level.rowCellContents_Movements[e].setZero()}for(e=0;e<level.width;e++)for(var n=0;n<level.height;n++){var t=n+e*level.height,r=level.getCellInto(t,_o9);level.mapCellContents.ior(r),level.rowCellContents[n].ior(r),level.colCellContents[e].ior(r);var o=level.getMovementsInto(t,_m1);level.mapCellContents_Movements.ior(o),level.rowCellContents_Movements[n].ior(o),level.colCellContents_Movements[e].ior(o)}}function processInput(e,n,t){againing=!1;var r=backupLevel(),o=e,a=[];if(e<=4){if(verbose_logging&&(debugger_turnIndex++,addToDebugTimeline(level,-2)),e>=0){switch(e){case 0:e=parseInt("00001",2);break;case 1:e=parseInt("00100",2);break;case 2:e=parseInt("00010",2);break;case 3:e=parseInt("01000",2);break;case 4:e=parseInt("10000",2)}a=startMovement(e)}if(verbose_logging){consolePrint("Applying rules");var i=addToDebugTimeline(level,-1);consolePrint(-1===e?"Turn starts with no input.":`Turn starts with input of ${["up","left","down","right","action"][o]}.`,!1,null,i)}var l=[];level.commandQueue=[],level.commandQueueSourceRules=[];var s=0,c=!1;const M={objects:new Int32Array(level.objects),movements:new Int32Array(level.movements),rigidGroupIndexMask:level.rigidGroupIndexMask.concat([]),rigidMovementAppliedMask:level.rigidMovementAppliedMask.concat([]),commandQueue:[],commandQueueSourceRules:[]};sfxCreateMask.setZero(),sfxDestroyMask.setZero(),seedsToPlay_CanMove=[],seedsToPlay_CantMove=[],calculateRowColMasks();var d=[],u=0;do{if(c=!1,u++,applyRules(state.rules,state.loopPoint,s,l),resolveMovements(level,l)){if(c=!0,IDE){var h=[];for(var g in l)d.includes(g)||(h.push(g),d.push(g));var p=h.map((e=>state.rules[e][0].lineNumber)),f=p.length>1?"lines ":"line ";consolePrint(`Rigid movement application failed in rule-Group starting from ${f+=p.map((e=>`<a onclick="jumpToLine(${e});" href="javascript:void(0);">${e}</a>`)).join(", ")}, and will be disabled in resimulation. Rolling back...`)}level.objects=new Int32Array(M.objects),level.movements=new Int32Array(M.movements),level.rigidGroupIndexMask=M.rigidGroupIndexMask.concat([]),level.rigidMovementAppliedMask=M.rigidMovementAppliedMask.concat([]),level.commandQueue=M.commandQueue.concat([]),level.commandQueueSourceRules=M.commandQueueSourceRules.concat([]),sfxCreateMask.setZero(),sfxDestroyMask.setZero(),verbose_logging&&c&&u>0&&(consolePrint("Relooping through rules because of rigid."),debugger_turnIndex++,addToDebugTimeline(level,-2)),s=0}else{if(verbose_logging){var m=debug_visualisation_array[debugger_turnIndex].length+1;consolePrint("Processed movements.",!1,null,i=addToDebugTimeline(level,m)),state.lateRules.length>0&&(debugger_turnIndex++,addToDebugTimeline(level,-2),consolePrint("Applying late rules"))}applyRules(state.lateRules,state.lateLoopPoint,0),s=0}}while(u<50&&c);if(u>=50&&consolePrint("Looped through 50 times, gave up. too many loops!"),a.length>0&&void 0!==state.metadata.require_player_movement){var v=!1;for(u=0;u<a.length;u++){var _=a[u],b=level.getCell(_);if(state.playerMask.bitsClearInArray(b.data)){v=!0;break}}if(!1===v)return verbose_logging&&(consolePrint("require_player_movement set, but no player movement detected, so cancelling turn."),consoleCacheDump()),addUndoState(r),DoUndo(!0,!1),messagetext="",textMode=!1,!1}if(level.commandQueue.indexOf("cancel")>=0){if(verbose_logging)consoleCacheDump(),consolePrintFromRule("CANCEL command executed, cancelling turn.",C=level.commandQueueSourceRules[level.commandQueue.indexOf("cancel")],!0);t||processOutputCommands(level.commandQueue);var y=level.commandQueue.length>1;return addUndoState(r),DoUndo(!0,!1),tryPlayCancelSound(),y}if(level.commandQueue.indexOf("restart")>=0){if(verbose_logging&&runrulesonlevelstart_phase)logWarning('A "restart" command is being triggered in the "run_rules_on_level_start" section of level creation, which would cause an infinite loop if it was actually triggered, but it\'s being ignored, so it\'s not.',(C=level.commandQueueSourceRules[level.commandQueue.indexOf("restart")]).lineNumber,!0);if(verbose_logging)consolePrintFromRule("RESTART command executed, reverting to restart state.",C=level.commandQueueSourceRules[level.commandQueue.indexOf("restart")]),consoleCacheDump();return t||processOutputCommands(level.commandQueue),addUndoState(r),t||DoRestart(!0),!0}var w=!1;for(u=0;u<level.objects.length;u++)if(level.objects[u]!==r.dat[u]){if(t)return verbose_logging&&consoleCacheDump(),addUndoState(r),DoUndo(!0,!1),!0;-1!==e?addUndoState(r):backups.length>0&&(backups[backups.length-1]=unconsolidateDiff(backups[backups.length-1],r)),w=!0;break}if(t&&level.commandQueue.indexOf("win")>=0)return!0;if(t)return verbose_logging&&consoleCacheDump(),!1;for(u=0;u<seedsToPlay_CantMove.length;u++)playSound(seedsToPlay_CantMove[u]);for(u=0;u<seedsToPlay_CanMove.length;u++)playSound(seedsToPlay_CanMove[u]);for(u=0;u<state.sfx_CreationMasks.length;u++){var k=state.sfx_CreationMasks[u];sfxCreateMask.anyBitsInCommon(k.objectMask)&&playSound(k.seed)}for(u=0;u<state.sfx_DestructionMasks.length;u++){k=state.sfx_DestructionMasks[u];sfxDestroyMask.anyBitsInCommon(k.objectMask)&&playSound(k.seed)}if(t||processOutputCommands(level.commandQueue),!1===textMode&&(verbose_logging&&consolePrint("Checking win conditions."),void 0===n&&(n=!1),checkWin(n)),!winning){if(level.commandQueue.indexOf("checkpoint")>=0){if(verbose_logging)consolePrintFromRule("CHECKPOINT command executed, saving current state to the restart state.",C=level.commandQueueSourceRules[level.commandQueue.indexOf("checkpoint")]);restartTarget=level4Serialization(),hasUsedCheckpoint=!0;var R=JSON.stringify(restartTarget);storage_set(document.URL+"_checkpoint",R),storage_set(document.URL,curlevel)}if(level.commandQueue.indexOf("again")>=0&&w){var C=level.commandQueueSourceRules[level.commandQueue.indexOf("again")],E=verbose_logging,S=messagetext;verbose_logging=!1,processInput(-1,!0,!0)?((verbose_logging=E)&&consolePrintFromRule("AGAIN command executed, with changes detected - will execute another turn.",C),againing=!0,timer=0):(verbose_logging=E)&&consolePrintFromRule("AGAIN command not executed, it wouldn't make any changes.",C),verbose_logging=E,messagetext=S}}verbose_logging&&consolePrint("Turn complete"),level.commandQueue=[],level.commandQueueSourceRules=[]}return verbose_logging&&consoleCacheDump(),winning&&(againing=!1),w}function checkWin(e){if(levelEditorOpened&&(e=!0),level.commandQueue.indexOf("win")>=0)return consolePrint(runrulesonlevelstart_phase?"Win Condition Satisfied (However this is in the run_rules_on_level_start rule pass, so I'm going to ignore it for you. Why would you want to complete a level before it's already started?!)":"Win Condition Satisfied"),void(e||DoWin());var n=!1;if(state.winconditions.length>0){for(var t=!0,r=0;r<state.winconditions.length;r++){var o=state.winconditions[r],a=o[1],i=o[2],l=!0;const e=o[4]?e=>a.bitsSetInArray(e):e=>!a.bitsClearInArray(e),n=o[5]?e=>i.bitsSetInArray(e):e=>!i.bitsClearInArray(e);switch(o[0]){case-1:for(var s=0;s<level.n_tiles;s++){if(e((d=level.getCellInto(s,_o10)).data)&&n(d.data)){l=!1;break}}break;case 0:var c=!1;for(s=0;s<level.n_tiles;s++){if(e((d=level.getCellInto(s,_o10)).data)&&n(d.data)){c=!0;break}}!1===c&&(l=!1);break;case 1:for(s=0;s<level.n_tiles;s++){var d;if(e((d=level.getCellInto(s,_o10)).data)&&!n(d.data)){l=!1;break}}}!1===l&&(t=!1)}n=t}n&&(consolePrint(runrulesonlevelstart_phase?"Win Condition Satisfied (However this is in the run_rules_on_level_start rule pass, so I'm going to ignore it for you. Why would you want to complete a level before it's already started?!)":"Win Condition Satisfied"),e||DoWin())}function DoWin(){winning||(againing=!1,tryPlayEndLevelSound(),unitTesting?nextLevel():(winning=!0,timer=0))}function nextLevel(){if(againing=!1,messagetext="",state&&state.levels&&curlevel>state.levels.length&&(curlevel=state.levels.length-1),ignoreNotJustPressedAction=!0,titleScreen)0===titleSelection&&(curlevel=0,curlevelTarget=null),null!==curlevelTarget?loadLevelFromStateTarget(state,curlevel,curlevelTarget):loadLevelFromState(state,curlevel);else if(hasUsedCheckpoint&&(curlevelTarget=null,hasUsedCheckpoint=!1),curlevel<state.levels.length-1)curlevel++,textMode=!1,titleScreen=!1,quittingMessageScreen=!1,messageselected=!1,null!==(curlevelTarget=null)?loadLevelFromStateTarget(state,curlevel,curlevelTarget):loadLevelFromState(state,curlevel);else{try{storage_remove(document.URL),storage_remove(document.URL+"_checkpoint")}catch(e){}curlevel=0,curlevelTarget=null,goToTitleScreen(),tryPlayEndGameSound()}try{if(storage_set(document.URL,curlevel),null!==curlevelTarget){restartTarget=level4Serialization();var e=JSON.stringify(restartTarget);storage_set(document.URL+"_checkpoint",e)}else storage_remove(document.URL+"_checkpoint")}catch(e){}void 0!==state&&void 0!==state.metadata.flickscreen&&(oldflickscreendat=[0,0,Math.min(state.metadata.flickscreen[0],level.width),Math.min(state.metadata.flickscreen[1],level.height)]),canvasResize()}function goToTitleScreen(){againing=!1,messagetext="",titleScreen=!0,textMode=!0,doSetupTitleScreenLevelContinue(),titleSelection=showContinueOptionOnTitleScreen()?1:0,generateTitleScreen(),null!==canvas&®enSpriteImages()}const MAX_ERRORS_FOR_REAL=100;var compiling=!1,errorStrings=[],errorCount=0;function TooManyErrors(){const e=compiling?"Too many errors/warnings; aborting compilation.":"Too many errors/warnings; noping out.";throw consolePrint(e,!0),new Error(e)}function logErrorCacheable(e,n,t){if(compiling||t){if(void 0===n)return logErrorNoLine(e,t);var r='<a onclick="jumpToLine('+n.toString()+');" href="javascript:void(0);"><span class="errorTextLineNumber"> line '+n.toString()+'</span></a> : <span class="errorText">'+e+"</span>";errorStrings.indexOf(r)>=0&&!t||(consolePrint(r),errorStrings.push(r),errorCount++,errorStrings.length>MAX_ERRORS_FOR_REAL&&TooManyErrors())}}function logError(e,n,t){if(compiling||t){if(void 0===n)return logErrorNoLine(e,t);var r='<a onclick="jumpToLine('+n.toString()+');" href="javascript:void(0);"><span class="errorTextLineNumber"> line '+n.toString()+'</span></a> : <span class="errorText">'+e+"</span>";errorStrings.indexOf(r)>=0&&!t||(consolePrint(r,!0),errorStrings.push(r),errorCount++,errorStrings.length>MAX_ERRORS_FOR_REAL&&TooManyErrors())}}function logWarning(e,n,t){if(compiling||t){if(void 0===n)return logWarningNoLine(e,t);var r='<a onclick="jumpToLine('+n.toString()+');" href="javascript:void(0);"><span class="errorTextLineNumber"> line '+n.toString()+'</span></a> : <span class="warningText">'+e+"</span>";errorStrings.indexOf(r)>=0&&!t||(consolePrint(r,!0),errorStrings.push(r),errorStrings.length>MAX_ERRORS_FOR_REAL&&TooManyErrors())}}function logWarningNoLine(e,n){if(compiling||n){var t='<span class="warningText">'+e+"</span>";errorStrings.indexOf(t)>=0&&!n||(consolePrint(t,!0),errorStrings.push(t),errorCount++,errorStrings.length>MAX_ERRORS_FOR_REAL&&TooManyErrors())}}function logErrorNoLine(e,n){if(compiling||n){var t='<span class="errorText">'+e+"</span>";errorStrings.indexOf(t)>=0&&!n||(consolePrint(t,!0),errorStrings.push(t),errorCount++,errorStrings.length>MAX_ERRORS_FOR_REAL&&TooManyErrors())}}function blankLineHandle(e){"levels"===e.section?e.levels[e.levels.length-1].length>0&&e.levels.push([]):"objects"===e.section&&(e.objects_section=0)}function wordAlreadyDeclared(e,n){if((n=n.toLowerCase())in e.objects)return e.objects[n];for(var t=0;t<e.legend_aggregates.length;t++){if(e.legend_aggregates[t][0]===n)return e.legend_aggregates[t]}for(t=0;t<e.legend_properties.length;t++){if(e.legend_properties[t][0]===n)return e.legend_properties[t]}for(t=0;t<e.legend_synonyms.length;t++){if(e.legend_synonyms[t][0]===n)return e.legend_synonyms[t]}return null}"function"!=typeof Object.assign&&(Object.assign=function(e){"use strict";if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),t=1;t<arguments.length;t++){var r=arguments[t];if(null!=r)for(var o in r)r.hasOwnProperty(o)&&(n[o]=r[o])}return n});var debugMode,colorPalette,codeMirrorFn=function(){"use strict";function e(e,n){if(void 0===e.objects[n]){for(var t=0;t<e.legend_synonyms.length;t++){if(e.legend_synonyms[t][0]==n)return}for(t=0;t<e.legend_aggregates.length;t++){if(e.legend_aggregates[t][0]==n)return}for(t=0;t<e.legend_properties.length;t++){if(e.legend_properties[t][0]==n)return}logError(`You're talking about ${n.toUpperCase()} but it's not defined anywhere.`,e.lineNumber)}}function n(e,n,t,r){var o=new RegExp("\\b"+(n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")+"\\b"),"i"),a=t.match(o);null!=a&&(e.original_case_names[n]=a[0],e.original_line_numbers[n]=r)}const t=["objects","legend","sounds","collisionlayers","rules","winconditions","levels"],r=["sfx0","sfx1","sfx2","sfx3","sfx4","sfx5","sfx6","sfx7","sfx8","sfx9","sfx10","cancel","checkpoint","restart","win","message","again"],o=/[\p{L}\p{N}_]+[\p{Z}\s]*/u,a=/\d+\b/u,i=/(objects|collisionlayers|legend|sounds|rules|winconditions|levels)(?![\p{L}\p{N}_])[\p{Z}\s]*/u,l=/[\=]+/,s=/[^\(]+/,c=/[^\p{Z}\s\()]+[\p{Z}\s]*/u,d=/[ \,]*/,u=/(move|action|create|destroy|cantmove)\b[\p{Z}\s]*/u,h=["move","cantmove"],g=/(undo|restart|titlescreen|startgame|cancel|endgame|startlevel|endlevel|showmessage|closemessage|sfx0|sfx1|sfx2|sfx3|sfx4|sfx5|sfx6|sfx7|sfx8|sfx9|sfx10)\b[\p{Z}\s]*/u,p=/^(action|up|down|left|right|\^|v|\<|\>|moving|stationary|parallel|perpendicular|horizontal|orthogonal|vertical|no|randomdir|random)$/,f=/^(startloop|endloop)$/,m=/^(up|down|left|right|horizontal|vertical|orthogonal|late|rigid)$/,v=/[\p{Z}\s]*(up|down|left|right|horizontal|vertical|orthogonal)(?![\p{L}\p{N}_])[\p{Z}\s]*/u,_=/^(all|any|no|some)$/,b=["checkpoint","objects","collisionlayers","legend","sounds","rules","...","winconditions","levels","|","[","]","up","down","left","right","late","rigid","^","v",">","<","no","randomdir","random","horizontal","vertical","any","all","no","some","moving","stationary","parallel","perpendicular","action","message","move","action","create","destroy","cantmove","sfx0","sfx1","sfx2","sfx3","Sfx4","sfx5","sfx6","sfx7","sfx8","sfx9","sfx10","cancel","checkpoint","restart","win","message","again","undo","restart","titlescreen","startgame","cancel","endgame","startlevel","endlevel","showmessage","closemessage"];function y(e){var n=e.match(c,!0);return null===n&&(n=e.match(s,!0)),n}function w(t,r){var o=!0,a=t.current_line_wip_array;if(0!==a.length)if(1===a.length)logError('Incorrect format of legend - should be one of "A = B", "A = B or C [ or D ...]", "A = B and C [ and D ...]".',t.lineNumber),o=!1;else if(a.length%2==0)logError(`Incorrect format of legend - should be one of "A = B", "A = B or C [ or D ...]", "A = B and C [ and D ...]", but it looks like you have a dangling "${t.current_line_wip_array[t.current_line_wip_array.length-1].toUpperCase()}"?`,t.lineNumber),o=!1;else{var i=a[0],l=wordAlreadyDeclared(t,i);null!==l&&(logError(`Name "${i.toUpperCase()}" already in use (on line <a onclick="jumpToLine(${l.lineNumber});" href="javascript:void(0);"><span class="errorTextLineNumber">line ${l.lineNumber}</span></a>).`,t.lineNumber),o=!1),b.indexOf(i)>=0&&logWarning('You named an object "'+i.toUpperCase()+"\", but this is a keyword. Don't do that!",t.lineNumber);for(var s=2;s<a.length;s+=2){var c=a[s];if(c===i){logError("You can't define object "+i.toUpperCase()+" in terms of itself!",t.lineNumber),o=!1;for(var d=a.indexOf(i,2);d>=2;)d>=4?a.splice(d-1,2):a.splice(d,2),d=a.indexOf(i,2)}for(var u=2;u<s;u+=2){var h=a[u];h===c&&logWarning("You're repeating the object "+h.toUpperCase()+" here multiple times on the RHS. This makes no sense. Don't do that.",t.lineNumber)}}for(s=2;s<a.length;s+=2){var g=a[s];g!==i&&e(t,g)}if(3===a.length){var p=[a[0],a[2]];p.lineNumber=t.lineNumber,n(t,a[0],r,t.lineNumber),t.legend_synonyms.push(p)}else if("and"===a[3]){var f=function(e){if((e=e.toLowerCase())in t.objects)return[e];for(var n=0;n<t.legend_synonyms.length;n++){if((r=t.legend_synonyms[n])[0]===e)return f(r[1])}for(n=0;n<t.legend_aggregates.length;n++){if((r=t.legend_aggregates[n])[0]===e)return[].concat.apply([],r.slice(1).map(f))}for(n=0;n<t.legend_properties.length;n++){var r;if((r=t.legend_properties[n])[0]===e)return logError("Cannot define an aggregate (using 'and') in terms of properties (something that uses 'or').",t.lineNumber),o=!1,[e]}return[e]},m=[a[0]].concat(f(a[2])).concat(f(a[4]));for(s=6;s<a.length;s+=2)m=m.concat(f(a[s]));m.lineNumber=t.lineNumber,n(t,m[0],r,t.lineNumber),t.legend_aggregates.push(m)}else if("or"===a[3]){var v=!1;for(f=function(e){if((e=e.toLowerCase())in t.objects)return[e];for(var n=0;n<t.legend_synonyms.length;n++){if((r=t.legend_synonyms[n])[0]===e)return f(r[1])}for(n=0;n<t.legend_aggregates.length;n++){if((r=t.legend_aggregates[n])[0]===e)return logError(`Cannot define a property (something defined in terms of 'or') in terms of an aggregate (something that uses 'and'). In this case, you can't define "${a[0]}" in terms of "${e}".`,t.lineNumber),v=!0,[]}for(n=0;n<t.legend_properties.length;n++){var r;if((r=t.legend_properties[n])[0]===e){for(var o=[],i=1;i<r.length;i++)r[i]===e||(o=o.concat(f(r[i])));return o}}return[e]},s=5;s<a.length;s+=2)if("or"!==a[s].toLowerCase()){v=!0;break}if(!v){for(m=[a[0]].concat(f(a[2])).concat(f(a[4])),s=6;s<a.length;s+=2)m.push(a[s].toLowerCase());m.lineNumber=t.lineNumber,n(t,m[0],r,t.lineNumber),t.legend_properties.push(m)}}else o&&(logError("This legend-entry is incorrectly-formatted - it should be one of A = B, A = B or C ( or D ...), A = B and C (and D ...)",t.lineNumber),o=!1)}}function k(e){if(0!==e.current_line_wip_array.length)if("ERROR"===e.current_line_wip_array[e.current_line_wip_array.length-1]);else{var n=e.current_line_wip_array;n.push(e.lineNumber),e.sounds.push(n)}}function R(e,n){"legend"===e.section?w(e,n):"sounds"===e.section&&k(e)}return{copyState:function(e){var n={};for(var t in e.objects)if(e.objects.hasOwnProperty(t)){var r=e.objects[t];n[t]={colors:r.colors.concat([]),lineNumber:r.lineNumber,spritematrix:r.spritematrix.concat([])}}var o=[];for(t=0;t<e.collisionLayers.length;t++)o.push(e.collisionLayers[t].concat([]));var a=[],i=[],l=[],s=[],c=[],d=[],u=[];for(t=0;t<e.legend_synonyms.length;t++)a.push(e.legend_synonyms[t].concat([]));for(t=0;t<e.legend_aggregates.length;t++)i.push(e.legend_aggregates[t].concat([]));for(t=0;t<e.legend_properties.length;t++)l.push(e.legend_properties[t].concat([]));for(t=0;t<e.sounds.length;t++)s.push(e.sounds[t].concat([]));for(t=0;t<e.levels.length;t++)c.push(e.levels[t].concat([]));for(t=0;t<e.winconditions.length;t++)d.push(e.winconditions[t].concat([]));for(t=0;t<e.rules.length;t++)u.push(e.rules[t].concat([]));var h=Object.assign({},e.original_case_names),g=Object.assign({},e.original_line_numbers);return{lineNumber:e.lineNumber,objects:n,collisionLayers:o,commentLevel:e.commentLevel,section:e.section,visitedSections:e.visitedSections.concat([]),line_should_end:e.line_should_end,line_should_end_because:e.line_should_end_because,sol_after_comment:e.sol_after_comment,objects_candname:e.objects_candname,objects_section:e.objects_section,objects_spritematrix:e.objects_spritematrix.concat([]),tokenIndex:e.tokenIndex,current_line_wip_array:e.current_line_wip_array.concat([]),legend_synonyms:a,legend_aggregates:i,legend_properties:l,sounds:s,rules:u,names:e.names.concat([]),winconditions:d,original_case_names:h,original_line_numbers:g,abbrevNames:e.abbrevNames.concat([]),metadata:e.metadata.concat([]),metadata_lines:Object.assign({},e.metadata_lines),levels:c,STRIDE_OBJ:e.STRIDE_OBJ,STRIDE_MOV:e.STRIDE_MOV}},blankLine:function(e){"levels"===e.section&&e.levels[e.levels.length-1].length>0&&e.levels.push([])},token:function(e,c){var C=e.string,E=e.sol();if(E&&(c.current_line_wip_array=[],e.string=e.string.toLowerCase(),c.tokenIndex=0,c.line_should_end=!1),c.sol_after_comment&&(E=!0,c.sol_after_comment=!1),e.eatWhile(/[ \t]/),"("===(B=e.peek())&&-4!==c.tokenIndex)e.next(),c.commentLevel++;else if(")"===B){if(e.next(),!(c.commentLevel>0))return logWarning("You're trying to close a comment here, but I can't find any opening bracket to match it? [This is highly suspicious; you probably want to fix it.]",c.lineNumber),"ERROR";if(c.commentLevel--,0===c.commentLevel)return c.sol_after_comment=!0,"comment"}if(c.commentLevel>0){for(E&&(c.sol_after_comment=!0);e.eatWhile(/[^\(\)]+/),!e.eol()&&("("===(B=e.peek())?c.commentLevel++:")"===B&&c.commentLevel--,e.next(),0!==c.commentLevel););return e.eol()&&R(c,C),"comment"}if(e.eatWhile(/[ \t]/),E&&e.eol())return R(c,C),blankLineHandle(c);if(c.line_should_end&&!e.eol())return logError("Only comments should go after "+c.line_should_end_because+" on a line.",c.lineNumber),e.skipToEnd(),"ERROR";var S=!0;if(E&&"levels"===c.section){var M=e.string.substring(e.pos);/^[\p{Z}\s=]*$/u.test(M)||(S=!1)}if(E&&S&&e.match(l,!0))return c.line_should_end=!0,c.line_should_end_because="a bunch of equals signs ('===')","EQUALSBIT";if("levels"!==c.section){var I=e.match(i,!0);if(E&&I){c.section=I[0].trim(),c.visitedSections.indexOf(c.section)>=0&&logError('cannot duplicate sections (you tried to duplicate "'+c.section.toUpperCase()+'").',c.lineNumber),c.line_should_end=!0,c.line_should_end_because=`a section name ("${c.section.toUpperCase()}")`,c.visitedSections.push(c.section);var x=t.indexOf(c.section);if(0==x?(c.objects_section=0,c.visitedSections.length>1&&logError('section "'+c.section.toUpperCase()+'" must be the first section',c.lineNumber)):-1==c.visitedSections.indexOf(t[x-1])&&logError(-1===x?'no such section as "'+c.section.toUpperCase()+'".':'section "'+c.section.toUpperCase()+'" is out of order, must follow "'+t[x-1].toUpperCase()+'" (or it could be that the section "'+t[x-1].toUpperCase()+'"is just missing totally. You have to include all section headings, even if the section itself is empty).',c.lineNumber),"sounds"===c.section){for(var T in c.objects)c.objects.hasOwnProperty(T)&&c.names.push(T);for(var O=0;O<c.legend_synonyms.length;O++){T=c.legend_synonyms[O][0];c.names.push(T)}for(O=0;O<c.legend_aggregates.length;O++){T=c.legend_aggregates[O][0];c.names.push(T)}for(O=0;O<c.legend_properties.length;O++){T=c.legend_properties[O][0];c.names.push(T)}}else if("levels"===c.section){for(var T in c.objects)c.objects.hasOwnProperty(T)&&1==T.length&&c.abbrevNames.push(T);for(O=0;O<c.legend_synonyms.length;O++)1==c.legend_synonyms[O][0].length&&c.abbrevNames.push(c.legend_synonyms[O][0]);for(O=0;O<c.legend_aggregates.length;O++)1==c.legend_aggregates[O][0].length&&c.abbrevNames.push(c.legend_aggregates[O][0])}return"HEADER"}void 0===c.section&&logError('must start with section "OBJECTS"',c.lineNumber)}if(e.eol())return R(c,C),null;switch(c.section){case"objects":var A=function(){var t=E?e.match(o,!0):e.match(/[^\p{Z}\s\()]+[\p{Z}\s]*/u,!0);if(null==t)return e.match(s,!0),e.pos>0&&logWarning('Unknown junk in object section (possibly: sprites have to be 5 pixels wide and 5 pixels high exactly. Or maybe: the main names for objects have to be words containing only the letters a-z0.9 - if you want to call them something like ",", do it in the legend section).',c.lineNumber),"ERROR";var r=t[0].trim();if(void 0!==c.objects[r])return logError('Object "'+r.toUpperCase()+'" defined multiple times.',c.lineNumber),"ERROR";for(var a=0;a<c.legend_synonyms.length;a++){c.legend_synonyms[a][0]==r&&logError('Name "'+r.toUpperCase()+'" already in use.',c.lineNumber)}if(b.indexOf(r)>=0&&logWarning('You named an object "'+r.toUpperCase()+"\", but this is a keyword. Don't do that!",c.lineNumber),E)c.objects_candname=r,n(c,r,C,c.lineNumber),c.objects[c.objects_candname]={lineNumber:c.lineNumber,colors:[],spritematrix:[]};else{n(c,r,C,c.lineNumber);var i=[r,c.objects_candname];i.lineNumber=c.lineNumber,c.legend_synonyms.push(i)}return c.objects_section=1,"NAME"};switch(E&&2==c.objects_section&&(c.objects_section=3),E&&1==c.objects_section&&(c.objects_section=2),c.objects_section){case 0:case 1:return c.objects_spritematrix=[],A();case 2:c.tokenIndex=0;var D=e.match(reg_color,!0);if(null==D){var N=e.match(o,!0)||e.match(s,!0);return logError("Was looking for color for object "+c.objects_candname.toUpperCase()+', got "'+N+'" instead.',c.lineNumber),null}return void 0===c.objects[c.objects_candname].colors?c.objects[c.objects_candname].colors=[D[0].trim()]:c.objects[c.objects_candname].colors.push(D[0].trim()),(de=D[0].trim().toLowerCase())in colorPalettes.arnecolors?"COLOR COLOR-"+de.toUpperCase():"transparent"===de?"COLOR FADECOLOR":"MULTICOLOR"+D[0];case 3:var B=e.eat(/[.\d]/),L=c.objects_spritematrix;if(void 0===B)return 0===L.length?A():(logError("Unknown junk in spritematrix for object "+c.objects_candname.toUpperCase()+".",c.lineNumber),e.match(s,!0),null);E&&L.push("");var P=c.objects[c.objects_candname];return L[L.length-1]+=B,L[L.length-1].length>5?(logWarning("Sprites must be 5 wide and 5 high.",c.lineNumber),e.match(s,!0),null):(P.spritematrix=c.objects_spritematrix,5===L.length&&5==L[L.length-1].length&&(c.objects_section=0),"."!==B?(T=parseInt(B))>=P.colors.length?(logError("Trying to access color number "+T+" from the color palette of sprite "+c.objects_candname.toUpperCase()+", but there are only "+P.colors.length+" defined in it.",c.lineNumber),"ERROR"):"COLOR BOLDCOLOR COLOR-"+P.colors[T].toUpperCase():"COLOR FADECOLOR");default:window.console.logError("EEK shouldn't get here.")}break;case"legend":var j="",F=null;if(0===c.tokenIndex){var V=(F=e.match(/[^=\p{Z}\s\(]*(\p{Z}\s)*/u,!0))[0].trim();j=wordAlreadyDeclared(c,V)?"ERROR":"NAME",c.tokenIndex++}else if(1===c.tokenIndex)null!==(F=e.match(/=/u,!0))&&"="===F[0].trim()||(logError('In the legend, define new items using the equals symbol - declarations must look like "A = B", "A = B or C [ or D ...]", "A = B and C [ and D ...]".',c.lineNumber),e.match(s,!0),j="ERROR",F=["ERROR"]),e.match(/[\p{Z}\s]*/u,!0),c.tokenIndex++,j="ASSSIGNMENT";else if(c.tokenIndex>=3&&c.tokenIndex%2==1){if(null===(F=e.match(o,!0)))logError("Something bad's happening in the LEGEND",c.lineNumber),he=e.match(s,!0),j="ERROR";else"and"===(q=F[0].trim())||"or"===q?(j="LOGICWORD",c.tokenIndex>=5&&q!==c.current_line_wip_array[3]&&(logError("Hey! You can't go mixing ANDs and ORs in a single legend entry.",c.lineNumber),j="ERROR")):(logError(`Expected and 'AND' or an 'OR' here, but got ${q.toUpperCase()} instead. In the legend, define new items using the equals symbol - declarations must look like 'A = B' or 'A = B and C' or 'A = B or C'.`,c.lineNumber),j="ERROR");c.tokenIndex++}else if(null===(F=e.match(o,!0)))logError("Something bad's happening in the LEGEND",c.lineNumber),he=e.match(s,!0),j="ERROR";else{var q=F[0].trim();j=wordAlreadyDeclared(c,q)?"NAME":"ERROR",c.tokenIndex++}return null!==F&&c.current_line_wip_array.push(F[0].trim()),e.eol()&&w(c,C),j;case"sounds":var U="";if(c.current_line_wip_array.length>0&&"ERROR"===c.current_line_wip_array[c.current_line_wip_array.length-1]){if(null===(he=null)&&null!==(he=e.match(g,!0))&&(U="SOUNDEVENT"),null===he&&null!==(he=e.match(u,!0))&&(U="SOUNDVERB"),null===he&&null!==(he=e.match(v,!0))&&(U="DIRECTION"),null===he)null!==(he=e.match(a,!0))&&(U="SOUND");null===he&&null!==(he=e.match(o,!0))&&(U=wordAlreadyDeclared(c,he[0].trim())?"NAME":"ERROR"),null===he&&(he=y(e),U="ERROR")}else if(0===c.current_line_wip_array.length){if(null==(he=e.match(g,!0)))if(null==(he=e.match(o,!0)))U="ERROR",he=y(e),c.current_line_wip_array.push("ERROR"),logWarning("Was expecting a sound event (like SFX3, or ENDLEVEL) or an object name, but didn't find either.",c.lineNumber);else{var z=he[0].trim();wordAlreadyDeclared(c,z)?(U="NAME",c.current_line_wip_array.push([z,U]),c.tokenIndex++):(U="ERROR",c.current_line_wip_array.push("ERROR"),logError(`unexpected sound token "${z}".`,c.lineNumber))}else U="SOUNDEVENT",c.current_line_wip_array.push([he[0].trim(),U]),c.tokenIndex++}else if(1===c.current_line_wip_array.length){if("SOUNDEVENT"===c.current_line_wip_array[0][1])null!==(he=e.match(a,!0))?(U="SOUND",c.current_line_wip_array.push([he[0].trim(),U]),c.tokenIndex++):(he=y(e),logError("Was expecting a sound seed here (a number like 123123, like you generate by pressing the buttons above the console panel), but found something else.",c.lineNumber),U="ERROR",c.current_line_wip_array.push("ERROR"));else null!==(he=e.match(u,!0))?(U="SOUNDVERB",c.current_line_wip_array.push([he[0].trim(),U]),c.tokenIndex++):(he=y(e),logError("Was expecting a soundverb here (MOVE, DESTROY, CANTMOVE, or the like), but found something else.",c.lineNumber),U="ERROR",c.current_line_wip_array.push("ERROR"))}else{if("SOUNDEVENT"===c.current_line_wip_array[0][1])he=y(e),logError(`I wasn't expecting anything after the sound declaration ${c.current_line_wip_array[c.current_line_wip_array.length-1][0].toUpperCase()} on this line, so I don't know what to do with "${he[0].trim().toUpperCase()}" here.`,c.lineNumber),U="ERROR",c.current_line_wip_array.push("ERROR");else if("SOUND"===c.current_line_wip_array[c.current_line_wip_array.length-1][1])he=y(e),logError(`I wasn't expecting anything after the sound declaration ${c.current_line_wip_array[c.current_line_wip_array.length-1][0].toUpperCase()} on this line, so I don't know what to do with "${he[0].trim().toUpperCase()}" here.`,c.lineNumber),U="ERROR",c.current_line_wip_array.push("ERROR");else if(h.indexOf(c.current_line_wip_array[1][0])>=0){var W=e.match(v,!0);if(null!==W)U="DIRECTION",c.current_line_wip_array.push([W[0].trim(),U]),c.tokenIndex++;else null!==(G=e.match(a,!0))?(U="SOUND",c.current_line_wip_array.push([G[0].trim(),U]),c.tokenIndex++):(he=y(e),logError(`Ah I was expecting direction or a sound seed here after ${c.current_line_wip_array[c.current_line_wip_array.length-1][0].toUpperCase()}, but I don't know what to make of "${he[0].trim().toUpperCase()}".`,c.lineNumber),U="ERROR",c.current_line_wip_array.push("ERROR"))}else{var G;null!==(G=e.match(a,!0))?(U="SOUND",c.current_line_wip_array.push([G[0].trim(),U]),c.tokenIndex++):(he=y(e),logError(`Ah I was expecting a sound seed here after ${c.current_line_wip_array[c.current_line_wip_array.length-1][0].toUpperCase()}, but I don't know what to make of "${he[0].trim().toUpperCase()}".`,c.lineNumber),U="ERROR",c.current_line_wip_array.push("ERROR"))}}return e.eol()&&k(c),U;case"collisionlayers":if(E&&(c.collisionLayers.push([]),c.current_line_wip_array=[],c.tokenIndex=0),null===(F=e.match(o,!0))){var H=e.pos;return e.match(d,!0),e.pos==H&&(logError("error detected - unexpected character "+e.peek(),c.lineNumber),e.next()),null}q=F[0].trim();var J=function(e){if((e=e.toLowerCase())in c.objects)return[e];for(var n=0;n<c.legend_synonyms.length;n++){if((t=c.legend_synonyms[n])[0]===e)return J(t[1])}for(n=0;n<c.legend_aggregates.length;n++){if((t=c.legend_aggregates[n])[0]===e)return logError('"'+e+'" is an aggregate (defined using "and"), and cannot be added to a single layer because its constituent objects must be able to coexist.',c.lineNumber),[]}for(n=0;n<c.legend_properties.length;n++){var t;if((t=c.legend_properties[n])[0]===e){for(var r=[],o=1;o<t.length;o++)t[o]===e||(r=r.concat(J(t[o])));return r}}return logError('Cannot add "'+q.toUpperCase()+'" to a collision layer; it has not been declared.',c.lineNumber),[]};"background"===q?(c.collisionLayers.length>0&&c.collisionLayers[c.collisionLayers.length-1].length>0&&logError("Background must be in a layer by itself.",c.lineNumber),c.tokenIndex=1):0!==c.tokenIndex&&logError("Background must be in a layer by itself.",c.lineNumber);var X=J(q);if(0===c.collisionLayers.length)return logError("no layers found.",c.lineNumber),"ERROR";var Y=[],Q=[];for(O=0;O<X.length;O++)for(var $=X[O],Z=0;Z<=c.collisionLayers.length-1;Z++){c.collisionLayers[Z].indexOf($)>=0&&(Z!==c.collisionLayers.length-1?Y.push(Z):Q.push(Z))}if(Y.length>0){var K='Object "'+q.toUpperCase()+'" included in multiple collision layers ( layers ';for(O=0;O<Y.length;O++)K+="#"+(Y[O]+1)+", ";logWarning((K+="#"+c.collisionLayers.length)+" ). You should fix this!",c.lineNumber)}return c.current_line_wip_array.indexOf(q)>=0&&logWarning(K='Object "'+q.toUpperCase()+"\" included explicitly multiple times in the same layer. Don't do that innit.",c.lineNumber),c.current_line_wip_array.push(q),c.collisionLayers[c.collisionLayers.length-1]=c.collisionLayers[c.collisionLayers.length-1].concat(X),X.length>0?"NAME":"ERROR";case"rules":if(E){var ee=s.exec(e.string)[0];c.rules.push([ee,c.lineNumber,C]),c.tokenIndex=0}if(-4===c.tokenIndex)return e.skipToEnd(),"MESSAGE";if(e.match(/[\p{Z}\s]*->[\p{Z}\s]*/u,!0))return"ARROW";if("["===B||"|"===B||"]"===B||"+"===B)return"+"!==B&&(c.tokenIndex=1),e.next(),e.match(/[\p{Z}\s]*/u,!0),"BRACKET";var ne=e.match(/[^\[\|\]\p{Z}\s]*/u,!0)[0].trim();return 0===c.tokenIndex&&f.exec(ne)?"BRACKET":0===c.tokenIndex&&m.exec(ne)||1===c.tokenIndex&&p.exec(ne)?(e.match(/[\p{Z}\s]*/u,!0),"DIRECTION"):c.names.indexOf(ne)>=0?E?(logError("Objects cannot appear outside of square brackets in rules, only directions can.",c.lineNumber),"ERROR"):(e.match(/[\p{Z}\s]*/u,!0),"NAME"):"..."===ne||"rigid"===ne||"random"===ne?"DIRECTION":r.indexOf(ne)>=0?("message"===ne&&(c.tokenIndex=-4),"COMMAND"):(logError('Name "'+ne+'", referred to in a rule, does not exist.',c.lineNumber),"ERROR");case"winconditions":if(E){var te=s.exec(e.string)[0].split(/[\p{Z}\s]/u).filter((function(e){return""!==e}));te.push(c.lineNumber),c.winconditions.push(te),c.tokenIndex=-1}if(c.tokenIndex++,null===(he=e.match(/[\p{Z}\s]*[\p{L}\p{N}_]+[\p{Z}\s]*/u)))return logError("incorrect format of win condition.",c.lineNumber),e.match(s,!0),"ERROR";var re=he[0].trim();return 0===c.tokenIndex?_.exec(re)?"LOGICWORD":(logError('Expecting the start of a win condition ("ALL","SOME","NO") but got "'+re.toUpperCase()+"'.",c.lineNumber),"ERROR"):2===c.tokenIndex?"on"!=re?(logError('Expecting the word "ON" but got "'+re.toUpperCase()+'".',c.lineNumber),"ERROR"):"LOGICWORD":1===c.tokenIndex||3===c.tokenIndex?-1===c.names.indexOf(re)?(logError('Error in win condition: "'+re.toUpperCase()+'" is not a valid object name.',c.lineNumber),"ERROR"):"NAME":(logError("Error in win condition: I don't know what to do with "+re.toUpperCase()+".",c.lineNumber),"ERROR");case"levels":if(E){if(e.match(/[\p{Z}\s]*message\b[\p{Z}\s]*/u,!0)){c.tokenIndex=-4;var oe=["\n",C.slice(e.pos).trim(),c.lineNumber];return 0==c.levels[c.levels.length-1].length?c.levels.splice(c.levels.length-1,0,oe):c.levels.push(oe),"MESSAGE_VERB"}if(e.match(/[\p{Z}\s]*message[\p{Z}\s]*/u,!0)){logWarning("You probably meant to put a space after 'message' innit. That's ok, I'll still interpret it as a message, but you probably want to put a space there.",c.lineNumber),c.tokenIndex=-4;oe=["\n",C.slice(e.pos).trim(),c.lineNumber];return 0==c.levels[c.levels.length-1].length?c.levels.splice(c.levels.length-1,0,oe):c.levels.push(oe),"MESSAGE_VERB"}var ae=e.match(s,!1);if(null===ae||0===ae.length)return logError("Detected a comment where I was expecting a level. Oh gosh; if this is to do with you using '(' as a character in the legend, please don't do that ^^",c.lineNumber),c.commentLevel++,e.skipToEnd(),"comment";var ie=ae[0].trim();c.tokenIndex=2;var le=c.levels[c.levels.length-1];"\n"==le[0]?c.levels.push([c.lineNumber,ie]):(0==le.length&&le.push(c.lineNumber),le.push(ie),le.length>1&&ie.length!=le[1].length&&logWarning("Maps must be rectangular, yo (In a level, the length of each row must be the same).",c.lineNumber))}else if(-4==c.tokenIndex)return e.skipToEnd(),"MESSAGE";if(2===c.tokenIndex&&!e.eol()){B=e.peek();return e.next(),c.abbrevNames.indexOf(B)>=0?"LEVEL":(logError('Key "'+B.toUpperCase()+'" not found. Do you need to add it to the legend, or define a new object?',c.lineNumber),"ERROR")}break;default:if((E||c.sol_after_comment)&&(c.tokenIndex=0),0!=c.tokenIndex){e.match(s,!0),c.tokenIndex++;var se=c.metadata[c.metadata.length-2],ce=c.metadata[c.metadata.length-1];if(c.tokenIndex>2)return logWarning("Error: you can't embed comments in metadata values. Anything after the comment will be ignored.",c.lineNumber),"ERROR";if("background_color"===se||"text_color"===se){var de;if((de=ce.trim().toLowerCase())in colorPalettes.arnecolors)return"COLOR COLOR-"+de.toUpperCase();if("transparent"===de)return"COLOR FADECOLOR";if(4===de.length||7===de.length){var ue=de.match(/#[0-9a-fA-F]+/);if(null!==ue)return"MULTICOLOR"+ue[0]}}return"METADATATEXT"}var he;if(null!==(he=e.match(/[\p{Z}\s]*[\p{L}\p{N}_]+[\p{Z}\s]*/u))){var ge=he[0].trim();if(E){if(["title","author","homepage","background_color","text_color","key_repeat_interval","realtime_interval","again_interval","flickscreen","zoomscreen","color_palette","youtube"].indexOf(ge)>=0){if("author"!==ge&&"homepage"!==ge&&"title"!==ge||(e.string=C),"youtube"===ge&&logWarning("Unfortunately, YouTube support hasn't been working properly for a long time - it was always a hack and it hasn't gotten less hacky over time, so I can no longer pretend to support it.",c.lineNumber),null!==(fe=e.match(s,!1))){if(c.metadata.push(ge),c.metadata.push(fe[0].trim()),ge in c.metadata_lines){var pe=c.metadata_lines[ge];logWarning(`You've already defined a ${ge.toUpperCase()} in the prelude on line <a onclick="jumpToLine(${pe})>${pe}</a>.`,c.lineNumber)}c.metadata_lines[ge]=c.lineNumber}else logError('MetaData "'+ge+'" needs a value.',c.lineNumber);return c.tokenIndex=1,"METADATA"}if(["run_rules_on_level_start","norepeat_action","require_player_movement","debug","verbose_logging","throttle_movement","noundo","noaction","norestart","scanline"].indexOf(ge)>=0){var fe;if(c.metadata.push(ge),c.metadata.push("true"),c.tokenIndex=-1,null!==(fe=e.match(s,!1))){var me=fe[0].trim();logWarning("MetaData "+ge.toUpperCase()+" doesn't take any parameters, but you went and gave it \""+me+'".',c.lineNumber)}return"METADATA"}return logError("Unrecognised stuff in the prelude.",c.lineNumber),"ERROR"}return-1==c.tokenIndex?(logError('MetaData "'+ge+'" has no parameters.',c.lineNumber),"ERROR"):"METADATA"}logError(`Unrecognised stuff "${e.string}" in the prelude.`,c.lineNumber)}return e.eol()?null:e.eol()?void 0:(e.next(),null)},startState:function(){return{objects:{},lineNumber:0,commentLevel:0,section:"",visitedSections:[],line_should_end:!1,line_should_end_because:"",sol_after_comment:!1,objects_candname:"",objects_section:0,objects_spritematrix:[],collisionLayers:[],tokenIndex:0,current_line_wip_array:[],legend_synonyms:[],legend_aggregates:[],legend_properties:[],sounds:[],rules:[],names:[],winconditions:[],metadata:[],metadata_lines:{},original_case_names:{},original_line_numbers:{},abbrevNames:[],levels:[[]],subsection:""}}}};function github_authURL(){var e=window.btoa(Array.prototype.map.call(window.crypto.getRandomValues(new Uint8Array(24)),(function(e){return String.fromCharCode(e)})).join(""));return"https://github.com/login/oauth/authorize?client_id="+OAUTH_CLIENT_ID+"&scope=gist&state="+e+"&allow_signup=true"}function github_signOut(){storage_remove("oauth_access_token")}function github_isSignedIn(){return"string"==typeof storage_get("oauth_access_token")}function github_load(e,n){var t="https://api.github.com/gists/"+e,r=new XMLHttpRequest;if(r.open("GET",t),r.onreadystatechange=function(){if(4==r.readyState)if(""!==r.responseText){var e=window.parseInt(r.getResponseHeader("x-ratelimit-limit")),t=window.parseInt(r.getResponseHeader("x-ratelimit-used")),o=new Date(1e3*window.parseInt(r.getResponseHeader("x-ratelimit-reset")));console.log("Rate limit used "+t+"/"+e+" (resets "+o.toISOString()+")");var a=JSON.parse(r.responseText);if(403===r.status)github_isSignedIn()||-1===a.message.indexOf("rate limit")?n(null,a.message):n(null,"Exceeded GitHub rate limits. Try signing in from the editor.");else if(401===r.status)github_signOut(),n(null,"Authorization check failed. Try reloading or signing back in from the editor.");else if(r.status>=500)n(null,"HTTP Error "+r.status+" - "+r.statusText+".");else if(200!==r.status&&201!==r.status)n(null,"HTTP Error "+r.status+" - "+r.statusText);else{var i=(a=JSON.parse(r.responseText)).files["script.txt"].content;n(i,null)}}else n(null,"GitHub request returned nothing. A connection fault, maybe?")},github_isSignedIn()){var o=storage_get("oauth_access_token");r.setRequestHeader("Authorization","Token "+o)}r.setRequestHeader("Content-type","application/x-www-form-urlencoded"),r.send()}function github_save(e,n,t){var r=storage_get("oauth_access_token");if("string"==typeof r){var o={description:e,public:!0,files:{"readme.txt":{content:"Play this game by pasting the script in http://www.puzzlescript.net/editor.html"},"script.txt":{content:n}}},a=new XMLHttpRequest;a.open("POST","https://api.github.com/gists"),a.onreadystatechange=function(){if(4==a.readyState){var e=JSON.parse(a.responseText);403===a.status?t(null,e.message):401===a.status?(github_signOut(),t(null,"Authorization check failed. You have to log back into GitHub (or give it permission again or something).")):a.status>=500?t(null,"HTTP Error "+a.status+" - "+a.statusText+"."):200!==a.status&&201!==a.status?(github_signOut(),t(null,"HTTP Error "+a.status+" - "+a.statusText+". Try giving puzzlescript permission again, that might fix things...")):t(e.id,null)}},a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.setRequestHeader("Authorization","Token "+r);var i=JSON.stringify(o);a.send(i)}else printUnauthorized()}window.CodeMirror.defineMode("puzzle",codeMirrorFn),OAUTH_CLIENT_ID="211570277eb588cddf44";"use strict";function isColor(e){return(e=e.trim())in colorPalettes.arnecolors||(!!/^#([0-9A-F]{3}){1,2}$/i.test(e)||"transparent"===e)}function colorToHex(e,n){return(n=n.trim())in e?e[n]:n}function generateSpriteMatrix(e){for(var n=[],t=0;t<e.length;t++){for(var r=[],o=0;o<e.length;o++){var a=e[t].charAt(o);"."==a?r.push(-1):r.push(a)}n.push(r)}return n}function generateExtraMembers(e){e.idDict=[];for(var n=0,t=0;t<e.collisionLayers.length;t++)for(var r=0;r<e.collisionLayers[t].length;r++){if((c=e.collisionLayers[t][r])in e.objects)(g=e.objects[c]).layer=t,g.id=n,e.idDict[n]=c,n++}e.objectCount=n;for(var o=e.collisionLayers.length,a=[],i=0;i<o;i++)a.push(-1);STRIDE_OBJ=0|Math.ceil(e.objectCount/32),STRIDE_MOV=0|Math.ceil(o/5),e.STRIDE_OBJ=STRIDE_OBJ,e.STRIDE_MOV=STRIDE_MOV,debugMode=!1,verbose_logging=!1,throttle_movement=!1,colorPalette=colorPalettes.arnecolors;for(i=0;i<e.metadata.length;i+=2){var l=e.metadata[i],s=e.metadata[i+1];"color_palette"===l?(s in colorPalettesAliases&&(s=colorPalettesAliases[s]),void 0===colorPalettes[s]?logError('Palette "'+s+'" not found, defaulting to arnecolors.',0):colorPalette=colorPalettes[s]):"debug"===l?IDE&&!1===unitTesting&&(debugMode=!0,cache_console_messages=!0):"verbose_logging"===l?IDE&&!1===unitTesting&&(verbose_logging=!0,cache_console_messages=!0):"throttle_movement"===l&&(throttle_movement=!0)}for(var c in e.objects)if(e.objects.hasOwnProperty(c)){(g=e.objects[c]).colors.length>10&&logError("a sprite cannot have more than 10 colors. Why you would want more than 10 is beyond me.",g.lineNumber+1);for(i=0;i<g.colors.length;i++){var d=g.colors[i];isColor(d)?(d=colorToHex(colorPalette,d),g.colors[i]=d):(logError('Invalid color specified for object "'+c+'", namely "'+g.colors[i]+'".',g.lineNumber+1),g.colors[i]="#ff00ff")}}for(var c in e.objects){if(e.objects.hasOwnProperty(c))0==(g=e.objects[c]).colors.length&&(logError('color not specified for object "'+c+'".',g.lineNumber),g.colors=["#ff00ff"]),0===g.spritematrix.length?g.spritematrix=[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]:(5===g.spritematrix.length&&5===g.spritematrix[0].length&&5===g.spritematrix[1].length&&5===g.spritematrix[2].length&&5===g.spritematrix[3].length&&5===g.spritematrix[4].length||logWarning("Sprite graphics must be 5 wide and 5 high exactly.",g.lineNumber),g.spritematrix=generateSpriteMatrix(g.spritematrix))}var u=[],h={};for(var c in e.objects)if(e.objects.hasOwnProperty(c)){var g=e.objects[c];(_=a.concat([]))[g.layer]=g.id,h[c]=_,u.push([g.lineNumber,c])}for(var p=!0;p;){p=!1;for(i=0;i<e.legend_synonyms.length;i++){l=(f=e.legend_synonyms[i])[0],s=f[1];l in h&&void 0!==h[l]||void 0===h[s]||(p=!0,h[l]=h[s],u.push([f.lineNumber,l]))}for(i=0;i<e.legend_aggregates.length;i++){l=(f=e.legend_aggregates[i])[0];var f,m=f.slice(1),v=!0;for(r=0;r<m.length;r++){if(void 0===h[m[r]]){v=!1;break}}if((!(l in h)||void 0===h[l])&&v){var _=a.concat([]);for(r=1;r<f.length;r++){c=f[r];if(null==(g=e.objects[c])&&logError("Object not found with name "+c,e.lineNumber),-1==_[g.layer])_[g.layer]=g.id;else if(void 0===g.layer)logError('Object "'+c.toUpperCase()+'" has been defined, but not assigned to a layer.',f.lineNumber);else logError('Trying to create an aggregate object (something defined in the LEGEND section using AND) with both "'+c.toUpperCase()+'" and "'+e.idDict[_[g.layer]].toUpperCase()+"\", which are on the same layer and therefore can't coexist.",f.lineNumber)}p=!0,h[f[0]]=_,u.push([f.lineNumber,l])}}}u.sort(((e,n)=>e[0]-n[0])),u=u.map((e=>e[1])),e.glyphDict=h,e.glyphOrder=u;var b={};for(i=0;i<e.legend_aggregates.length;i++){b[(k=e.legend_aggregates[i])[0]]=k.slice(1)}e.aggregatesDict=b;var y={};for(i=0;i<e.legend_properties.length;i++){y[(k=e.legend_properties[i])[0]]=k.slice(1)}e.propertiesDict=y;var w={};for(i=0;i<e.legend_synonyms.length;i++){var k;l=(k=e.legend_synonyms[i])[0];(x=k[1])in b?b[l]=b[x]:x in y?y[l]=y[x]:l!==x&&(w[l]=x)}e.synonymsDict=w;for(var R,C,E=!0;E;){for(var c in E=!1,w){if(w.hasOwnProperty(c))(x=w[c])in y?(delete w[c],y[c]=y[x],E=!0):x in b?(delete b[c],b[c]=b[x],E=!0):x in w&&(w[c]=w[x])}for(var c in y)if(y.hasOwnProperty(c)){var S=y[c];for(i=0;i<S.length;i++){if((x=S[i])in w)S[i]=w[x],E=!0;else if(x in y){S.splice(i,1);var M=y[x];for(r=0;r<M.length;r++){var I=M[r];-1===S.indexOf(I)&&S.push(I)}E=!0}x in b&&logError('Trying to define property "'+c.toUpperCase()+'" in terms of aggregate "'+x.toUpperCase()+'".')}}for(var c in b)if(b.hasOwnProperty(c))for(S=b[c],i=0;i<S.length;i++){var x;if((x=S[i])in w)S[i]=w[x],E=!0;else if(x in b){S.splice(i,1);for(M=b[x],r=0;r<M.length;r++){I=M[r];-1===S.indexOf(I)&&S.push(I)}E=!0}x in y&&logError('Trying to define aggregate "'+c.toUpperCase()+'" in terms of property "'+x.toUpperCase()+'".')}}for(var l in e.propertiesSingleLayer={},y)if(y.hasOwnProperty(l)){S=y[l];var T=!0;for(i=1;i<S.length;i++)if(e.objects[S[i-1]].layer!==e.objects[S[i]].layer){T=!1;break}T&&(e.propertiesSingleLayer[l]=e.objects[S[0]].layer)}if(void 0===e.idDict[0]&&e.collisionLayers.length>0&&logError("You need to have some objects defined"),void 0===e.objects.background)if("background"in e.synonymsDict){c=e.synonymsDict.background;R=(g=e.objects[c]).id,C=g.layer}else if("background"in e.propertiesDict){var O=e.propertiesDict.background;c=O[0];R=(g=e.objects[c]).id,C=g.layer;for(i=1;i<O.length;i++){var A=O[i];if(e.objects[A].layer!==C)logError("Background objects must be on the same layer",e.original_line_numbers.background)}}else if("background"in e.aggregatesDict){R=(g=e.objects[e.idDict[0]]).id,C=g.layer,logError("background cannot be an aggregate (declared with 'and'), it has to be a simple type, or property (declared in terms of others using 'or').",e.original_line_numbers.background)}else{null!=(g=e.objects[e.idDict[0]])&&(R=g.id,C=g.layer),logError("Seriously, you have to define something to be the background.")}else R=e.objects.background.id,C=e.objects.background.layer;e.backgroundid=R,e.backgroundlayer=C}function levelFromString(e,n){var t=e.backgroundlayer,r=(e.backgroundid,e.layerMasks[t]),o=new Level(n[0],n[1].length,n.length-1,e.collisionLayers.length,null);o.objects=new Int32Array(o.width*o.height*STRIDE_OBJ);for(var a=0;a<o.width;a++)for(var i=0;i<o.height;i++){var l=n[i+1].charAt(a);0==l.length&&(l=n[i+1].charAt(n[i+1].length-1));var s=e.glyphDict[l];if(null==s)return void 0===e.propertiesDict[l]?logError('Error, symbol "'+l+'", used in map, not found.',n[0]+i):logError('Error, symbol "'+l+'" is defined using OR, and therefore ambiguous - it cannot be used in a map. Did you mean to define it in terms of AND?',n[0]+i),o;var c=new BitVec(STRIDE_OBJ);s=s.concat([]);for(var d=0;d<o.layerCount;d++)s[d]>=0&&c.ibitset(s[d]);for(var u=0;u<STRIDE_OBJ;++u)o.objects[STRIDE_OBJ*(a*o.height+i)+u]=c.data[u]}var h=o.calcBackgroundMask(e);for(a=0;a<o.n_tiles;a++){var g=o.getCell(a);r.anyBitsInCommon(g)||(g.ior(h),o.setCell(a,g))}return o}function levelsToArray(e){for(var n=e.levels,t=[],r=0;r<n.length;r++){var o=n[r];if(0!=o.length)if("\n"==o[0]){var a={message:o[1]};(splitMessage=wordwrap(a.message,intro_template[0].length)).length>12&&logWarning("Message too long to fit on screen.",o[2]),t.push(a)}else{a=levelFromString(e,o);t.push(a)}}e.levels=t}var directionaggregates={horizontal:["left","right"],horizontal_par:["left","right"],horizontal_perp:["left","right"],vertical:["up","down"],vertical_par:["up","down"],vertical_perp:["up","down"],moving:["up","down","left","right","action"],orthogonal:["up","down","left","right"],perpendicular:["^","v"],parallel:["<",">"]},relativeDirections=["^","v","<",">","perpendicular","parallel"],simpleAbsoluteDirections=["up","down","left","right"],simpleRelativeDirections=["^","v","<",">"],reg_directions_only=/^(\>|\<|\^|v|up|down|left|right|moving|stationary|no|randomdir|random|horizontal|vertical|orthogonal|perpendicular|parallel|action)$/,commandwords=["sfx0","sfx1","sfx2","sfx3","sfx4","sfx5","sfx6","sfx7","sfx8","sfx9","sfx10","cancel","checkpoint","restart","win","message","again"],commandwords_sfx=["sfx0","sfx1","sfx2","sfx3","sfx4","sfx5","sfx6","sfx7","sfx8","sfx9","sfx10"];function directionalRule(e){for(var n=0;n<e.lhs.length;n++){if((a=e.lhs[n]).length>1)return!0;for(var t=0;t<a.length;t++)for(var r=a[t],o=0;o<r.length;o+=2)if(relativeDirections.indexOf(r[o])>=0)return!0}for(n=0;n<e.rhs.length;n++){var a=e.rhs[n];for(t=0;t<a.length;t++)for(r=a[t],o=0;o<r.length;o+=2)if(relativeDirections.indexOf(r[o])>=0)return!0}return!1}function findIndexAfterToken(e,n,t){e=e.toLowerCase();for(var r=0,o=0;o<=t;o++){var a=n[o];r=e.indexOf(a,r)+a.length}return r}function rightBracketToRightOf(e,n){for(;n<e.length;n++)if("]"===e[n])return!0;return!1}function processRuleString(e,n,t){var r=e[0],o=e[1],a=e[2];"+"===(r=(r=r.replace(/\[/g," [ ").replace(/\]/g," ] ").replace(/\|/g," | ").replace(/\-\>/g," -> ")).trim())[0]&&(r=r.substring(0,1)+" "+r.substring(1,r.length));var i=r.split(/\s/).filter((function(e){return""!==e}));0==i.length&&logError("Spooky error! Empty line passed to rule function.",o);var l=0,s=[],c=null,d=[],u=!1,h=!1,g=[],p=[],f=!1,m=!1,v=o,_=[],b=!1,y=!1;if(1===i.length){if("startloop"===i[0])return I={bracket:1};if("endloop"===i[0])return I={bracket:-1}}-1==i.indexOf("->")&&logError("A rule has to have an arrow in it. There's no arrow here! Consider reading up about rules - you're clearly doing something weird",o);c=[];for(var w=0,k=0;k<i.length;k++){var R=i[k];switch(l){case 0:"+"===R?(y=!0,v===o?(0==t.length&&(logError('The "+" symbol, for joining a rule with the group of the previous rule, needs a previous rule to be applied to.',o),y=!1),0!==k&&logError('The "+" symbol, for joining a rule with the group of the previous rule, must be the first symbol on the line ',o),y&&(v=t[t.length-1].groupNumber)):logError('Two "+"s (the "append to previous rule group" symbol) applied to the same rule.',o)):R in directionaggregates?s=s.concat(directionaggregates[R]):"late"===R?f=!0:"rigid"===R?m=!0:"random"===R?(b=!0,y&&logError("A rule-group can only be marked random by the opening rule in the group (aka, a '+' and 'random' can't appear as rule modifiers on the same line). Why? Well, you see \"random\" isn't a property of individual rules, but of whole rule groups. It indicates that a single possible application of some rule from the whole group should be applied at random.",o)):simpleAbsoluteDirections.indexOf(R)>=0?s.push(R):simpleRelativeDirections.indexOf(R)>=0?logError('You cannot use relative directions ("^v<>") to indicate in which direction(s) a rule applies. Use absolute directions indicators (Up, Down, Left, Right, Horizontal, or Vertical, for instance), or, if you want the rule to apply in all four directions, do not specify directions',o):"["==R?(0==s.length&&(s=s.concat(directionaggregates.orthogonal)),l=1,k--):logError("The start of a rule must consist of some number of directions (possibly 0), before the first bracket, specifying in what directions to look (with no direction specified, it applies in all four directions). It seems you've just entered \""+R.toUpperCase()+'".',o);break;case 1:if("["==R)++w>1&&logWarning("Multiple opening brackets without closing brackets. Something fishy here. Every '[' has to be closed by a ']', and you can't nest them.",o),c.length>0&&logError('Error, malformed cell rule - encountered a "["" before previous bracket was closed',o),u=!0,c=[];else if(reg_directions_only.exec(R))c.length%2==1?logError("Error, an item can only have one direction/action at a time, but you're looking for several at once!",o):u?f&&"no"!==R&&"random"!==R&&"randomdir"!==R?logError("Movements cannot appear in late rules.",o):c.push(R):logWarning("Invalid syntax. Directions should be placed at the start of a rule.",o);else if("|"==R)u?c.length%2==1?logError("In a rule, if you specify a movement, it has to act on an object.",o):(d.push(c),c=[]):logWarning('Janky syntax. "|" should only be used inside cell rows (the square brackety bits).',o);else if("]"===R){if(--w<0)return logWarning("Multiple closing brackets without corresponding opening brackets. Something fishy here. Every '[' has to be closed by a ']', and you can't nest them.",o),null;c.length%2==1?"..."===c[0]?logError("Cannot end a rule with ellipses.",o):logError("In a rule, if you specify a movement, it has to act on an object.",o):(d.push(c),c=[]),h?p.push(d):g.push(d),d=[],u=!1}else if("->"===R){if(v!==o)t[t.length-1].late!==f&&logWarning("Oh gosh you can mix late and non-late rules in a rule-group if you really want to, but gosh why would you want to do that? What do you expect to accomplish?",o);if(u)logWarning('Encountered an unexpected "->" inside square brackets. It\'s used to separate states, it has no place inside them >:| .',o);else{if(h)return logError('Error, you can only use "->" once in a rule; it\'s used to separate before and after states.',o),null;h=!0}}else if(n.names.indexOf(R)>=0)u?c.length%2==0?(c.push(""),c.push(R)):c.length%2==1&&c.push(R):logWarning("Invalid token "+R.toUpperCase()+". Object names should only be used within cells (square brackets).",o);else if("..."===R)u?(c.push(R),c.push(R)):logWarning("Invalid syntax, ellipses should only be used within cells (square brackets).",o);else if(commandwords.indexOf(R)>=0)if(!1===h?logError("Commands should only appear at the end of rules, not in or before the pattern-detection/-replacement sections.",o):(u||rightBracketToRightOf(i,k))&&logWarning("Commands should only appear at the end of rules, not in or before the pattern-detection/-replacement sections.",o),"message"===R){var C=findIndexAfterToken(a,i,k),E=a.substring(C).trim();""===E&&(E=" "),_.push([R,E]),k=i.length}else{if(commandwords_sfx.indexOf(R)>=0){for(var S=!1,M=0;M<n.sounds.length;M++){n.sounds[M][0][0]===R&&(S=!0)}S||logWarning('Sound effect "'+R+'" not defined.',o)}_.push([R])}else logError('Error, malformed cell rule - was looking for cell contents, but found "'+R+'". What am I supposed to do with this, eh, please tell me that.',o)}}if(f&&m&&logError("Late rules cannot be marked as rigid (rigid rules are all about dealing with the consequences of unresolvable movements, and late rules can't even have movements).",o),g.length!=p.length)_.length>0&&0==p.length||logWarning("Error, when specifying a rule, the number of matches (square bracketed bits) on the left hand side of the arrow must equal the number on the right",o);else for(k=0;k<g.length;k++)g[k].length!=p[k].length&&(logError("In a rule, each pattern to match on the left must have a corresponding pattern on the right of equal length (number of cells).",o),n.invalid=!0),0==g[k].length&&logError("You have an totally empty pattern on the left-hand side. This will match *everything*. You certainly don't want this.");0==g.length&&logError("This rule refers to nothing. What the heck? :O",o);var I={directions:s,lhs:g,rhs:p,lineNumber:o,late:f,rigid:m,groupNumber:v,commands:_,randomRule:b};return!1===directionalRule(I)&&I.directions.length>1&&I.directions.splice(1),I}function deepCloneHS(e){return e.map((function(e){return e.map((function(e){return e.slice()}))}))}function deepCloneRule(e){return{direction:e.direction,lhs:deepCloneHS(e.lhs),rhs:deepCloneHS(e.rhs),lineNumber:e.lineNumber,late:e.late,rigid:e.rigid,groupNumber:e.groupNumber,commands:e.commands,randomRule:e.randomRule}}function rulesToArray(e){for(var n=e.rules,t=[],r=[],o=0;o<n.length;o++){var a=n[o][1],i=processRuleString(n[o],e,t);null!=i&&(void 0===i.bracket?t.push(i):r.push([a,i.bracket]))}e.loops=r;var l=[];for(o=0;o<t.length;o++)for(var s=(f=t[o]).directions,c=0;c<s.length;c++){var d=s[c];if(d in directionaggregates&&directionalRule(f))for(var u=directionaggregates[d],h=0;h<u.length;h++){var g;(g=deepCloneRule(f)).direction=u[h],l.push(g)}else(g=deepCloneRule(f)).direction=d,l.push(g)}for(o=0;o<l.length;o++){if(convertRelativeDirsToAbsolute(f=l[o]),rewriteUpLeftRules(f),atomizeAggregates(e,f),e.invalid)return;rephraseSynonyms(e,f)}var p=[];for(o=0;o<l.length;o++){var f=l[o];p=p.concat(concretizeMovingRule(e,f,f.lineNumber))}var m=[];for(o=0;o<p.length;o++){f=p[o];m=m.concat(concretizePropertyRule(e,f,f.lineNumber))}for(o=0;o<m.length;o++)makeSpawnedObjectsStationary(e,m[o],f.lineNumber);e.rules=m}function containsEllipsis(e){for(var n=0;n<e.lhs.length;n++)for(var t=0;t<e.lhs[n].length;t++)if("..."===e.lhs[n][t][1])return!0;return!1}function rewriteUpLeftRules(e){if(!containsEllipsis(e)){if("up"==e.direction)e.direction="down";else{if("left"!=e.direction)return;e.direction="right"}for(var n=0;n<e.lhs.length;n++)e.lhs[n].reverse(),e.rhs.length>0&&e.rhs[n].reverse()}}function getPossibleObjectsFromCell(e,n){for(var t=[],r=0;r<n.length;r+=2){n[r];var o=n[r+1];if(o in e.objects)t.push(o);else if(o in e.propertiesDict)for(var a=e.propertiesDict[o],i=0;i<a.length;i++){var l=a[i];t.push(l)}}return t}function getPropertiesFromCell(e,n){for(var t=[],r=0;r<n.length;r+=2){var o=n[r],a=n[r+1];"random"!=o&&(a in e.propertiesDict&&t.push(a))}return t}function getMovings(e,n){for(var t=[],r=0;r<n.length;r+=2){var o=n[r],a=n[r+1];o in directionaggregates&&t.push([a,o])}return t}function concretizePropertyInCell(e,n,t){for(var r=0;r<e.length;r+=2)e[r+1]===n&&"random"!==e[r]&&(e[r+1]=t)}function concretizeMovingInCell(e,n,t,r){for(var o=0;o<e.length;o+=2)e[o]===n&&e[o+1]===t&&(e[o]=r)}function concretizeMovingInCellByAmbiguousMovementName(e,n,t){for(var r=0;r<e.length;r+=2)e[r]===n&&(e[r]=t)}function expandNoPrefixedProperties(e,n){for(var t=[],r=0;r<n.length;r+=2){var o=n[r],a=n[r+1];if("no"===o&&a in e.propertiesDict)for(var i=e.propertiesDict[a],l=0;l<i.length;l++){var s=i[l];t.push(o),t.push(s)}else t.push(o),t.push(a)}return t}function concretizePropertyRule(e,n,t){for(var r=0;r<n.lhs.length;r++)for(var o=n.lhs[r],a=0;a<o.length;a++)o[a]=expandNoPrefixedProperties(e,o[a]),n.rhs.length>0&&(n.rhs[r][a]=expandNoPrefixedProperties(e,n.rhs[r][a]));var i,l={};for(a=0;a<n.rhs.length;a++)for(var s=n.lhs[a],c=n.rhs[a],d=0;d<c.length;d++)for(var u=getPropertiesFromCell(e,s[d]),h=getPropertiesFromCell(e,c[d]),g=0;g<h.length;g++){var p=h[g];-1==u.indexOf(p)&&(l[p]=!0)}for(var f=[n],m=!0;m;){m=!1;for(r=0;r<f.length;r++){var v=f[r];i=!1;for(a=0;a<v.lhs.length&&!i;a++){var _=v.lhs[a];for(d=0;d<_.length&&!i;d++){var b=getPropertiesFromCell(e,_[d]);for(g=0;g<b.length;++g){p=b[g];if(!e.propertiesSingleLayer.hasOwnProperty(p)||!0===l[p]){var y=e.propertiesDict[p];i=!0,m=!0;for(var w=0;w<y.length;w++){var k=y[w],R=deepCloneRule(v);for(var C in R.propertyReplacement={},v.propertyReplacement)if(v.propertyReplacement.hasOwnProperty(C)){var E=v.propertyReplacement[C];R.propertyReplacement[C]=[E[0],E[1]]}concretizePropertyInCell(R.lhs[a][d],p,k),R.rhs.length>0&&concretizePropertyInCell(R.rhs[a][d],p,k),void 0===R.propertyReplacement[p]?R.propertyReplacement[p]=[k,1]:R.propertyReplacement[p][1]=R.propertyReplacement[p][1]+1,f.push(R)}break}}}}i&&(f.splice(r,1),r--)}}for(r=0;r<f.length;r++){if(void 0!==(v=f[r]).propertyReplacement)for(var p in v.propertyReplacement)if(v.propertyReplacement.hasOwnProperty(p)){var S=v.propertyReplacement[p];k=S[0];if(1===S[1])for(a=0;a<v.rhs.length;a++){var M=v.rhs[a];for(d=0;d<M.length;d++){concretizePropertyInCell(M[d],p,k)}}}}var I="";for(r=0;r<f.length;r++){v=f[r];delete f.propertyReplacement;for(a=0;a<v.rhs.length;a++)for(_=v.rhs[a],d=0;d<_.length;d++)for(b=getPropertiesFromCell(e,_[d]),g=0;g<b.length;g++)l.hasOwnProperty(b[g])&&(I=b[g])}return I.length>0?(logError('This rule has a property on the right-hand side, "'+I.toUpperCase()+"\", that can't be inferred from the left-hand side. (either for every property on the right there has to be a corresponding one on the left in the same cell, OR, if there's a single occurrence of a particular property name on the left, all properties of the same name on the right are assumed to be the same).",t),[]):f}function makeSpawnedObjectsStationary(e,n,t){if(!n.late)for(var r=0;r<n.rhs.length;r++)for(var o=n.lhs[r],a=n.rhs[r],i=0;i<a.length;i++)for(var l=a[i],s=getPossibleObjectsFromCell(e,o[i]),c=s.map((n=>e.objects[n].layer)),d=0;d<l.length;d+=2){if(""===l[d]){var u=l[d+1];if(!(u in e.propertiesDict||s.indexOf(u)>=0)){var h=e.objects[u].layer;-1===c.indexOf(h)&&(l[d]="stationary")}}}}function concretizeMovingRule(e,n,t){for(var r,o=[n],a=!0;a;){a=!1;for(var i=0;i<o.length;i++){var l=o[i];r=!1;for(var s=0;s<l.lhs.length;s++)for(var c=l.lhs[s],d=0;d<c.length;d++){if((x=getMovings(e,c[d])).length>0){r=!0,a=!0;for(var u=x[0][0],h=x[0][1],g=directionaggregates[h],p=0;p<g.length;p++){var f=g[p],m=deepCloneRule(l);for(var v in m.movingReplacement={},l.movingReplacement)if(l.movingReplacement.hasOwnProperty(v)){var _=l.movingReplacement[v];m.movingReplacement[v]=[_[0],_[1],_[2],_[3],_[4],_[5]]}for(var v in m.aggregateDirReplacement={},l.aggregateDirReplacement)if(l.aggregateDirReplacement.hasOwnProperty(v)){_=l.aggregateDirReplacement[v];m.aggregateDirReplacement[v]=[_[0],_[1],_[2]]}if(concretizeMovingInCell(m.lhs[s][d],h,u,f),m.rhs.length>0&&concretizeMovingInCell(m.rhs[s][d],h,u,f),void 0===m.movingReplacement[u+h])m.movingReplacement[u+h]=[f,1,h,u,s,d];else{var b=m.movingReplacement[u+h];s===b[4]&&d===b[5]||(b[1]=b[1]+1)}void 0===m.aggregateDirReplacement[h]?m.aggregateDirReplacement[h]=[f,1,h]:m.aggregateDirReplacement[h][1]=m.aggregateDirReplacement[h][1]+1,o.push(m)}}}r&&(o.splice(i,1),i--)}}for(i=0;i<o.length;i++){if(void 0!==(l=o[i]).movingReplacement){var y={};for(var u in l.movingReplacement)if(l.movingReplacement.hasOwnProperty(u)){var w=(M=l.movingReplacement[u])[0],k=M[1],R=M[2],C=M[3];if(1===k)for(s=0;s<l.rhs.length;s++){var E=l.rhs[s];for(d=0;d<E.length;d++){concretizeMovingInCell(E[d],R,C,w)}}}var S={};for(var u in l.aggregateDirReplacement)if(l.aggregateDirReplacement.hasOwnProperty(u)){var M;w=(M=l.aggregateDirReplacement[u])[0],k=M[1];S[R=M[2]]=R in S||1!==k?"INVALID":w}for(var R in y)if(y.hasOwnProperty(R)&&"INVALID"!==R){if("INVALID"===(w=y[R]))continue;for(s=0;s<l.rhs.length;s++)for(E=l.rhs[s],d=0;d<E.length;d++){concretizeMovingInCellByAmbiguousMovementName(E[d],R,w)}}for(var R in S)if(S.hasOwnProperty(R)&&"INVALID"!==R){if("INVALID"===(w=S[R]))continue;for(s=0;s<l.rhs.length;s++)for(E=l.rhs[s],d=0;d<E.length;d++){concretizeMovingInCellByAmbiguousMovementName(E[d],R,w)}}}}var I="";for(i=0;i<o.length;i++){l=o[i];delete o.movingReplacement;for(s=0;s<l.rhs.length;s++)for(c=l.rhs[s],d=0;d<c.length;d++){var x;(x=getMovings(e,c[d])).length>0&&(I=x[0][1])}}return I.length>0&&(logError('This rule has an ambiguous movement on the right-hand side, "'+I+"\", that can't be inferred from the left-hand side. (either for every ambiguous movement associated to an entity on the right there has to be a corresponding one on the left attached to the same entity, OR, if there's a single occurrence of a particular ambiguous movement on the left, all properties of the same movement attached to the same object on the right are assumed to be the same (or something like that)).",t),e.invalid=!0),o}function rephraseSynonyms(e,n){for(var t=0;t<n.lhs.length;t++)for(var r=n.lhs[t],o=n.rhs[t],a=0;a<r.length;a++){for(var i=r[a],l=1;l<i.length;l+=2){i[l]in e.synonymsDict&&(i[l]=e.synonymsDict[i[l]])}if(n.rhs.length>0){var s=o[a];for(l=1;l<s.length;l+=2){s[l]in e.synonymsDict&&(s[l]=e.synonymsDict[s[l]])}}}}function atomizeAggregates(e,n){for(var t=0;t<n.lhs.length;t++)for(var r=n.lhs[t],o=0;o<r.length;o++){atomizeCellAggregates(e,r[o],n.lineNumber)}for(t=0;t<n.rhs.length;t++)for(r=n.rhs[t],o=0;o<r.length;o++){atomizeCellAggregates(e,r[o],n.lineNumber)}}function atomizeCellAggregates(e,n,t){for(var r=0;r<n.length;r+=2){var o=n[r],a=n[r+1];if(a in e.aggregatesDict){"no"===o&&logError("You cannot use 'no' to exclude the aggregate object "+a.toUpperCase()+" (defined using 'AND'), only regular objects, or properties (objects defined using 'OR'). If you want to do this, you'll have to write it out yourself the long way.",t);var i=e.aggregatesDict[a];n[r+1]=i[0];for(var l=1;l<i.length;l++)n.push(n[r]),n.push(i[l])}}}function convertRelativeDirsToAbsolute(e){for(var n=e.direction,t=0;t<e.lhs.length;t++)for(var r=e.lhs[t],o=0;o<r.length;o++){absolutifyRuleCell(n,r[o])}for(t=0;t<e.rhs.length;t++)for(r=e.rhs[t],o=0;o<r.length;o++){absolutifyRuleCell(n,r[o])}}var relativeDirs=["^","v","<",">","parallel","perpendicular"],relativeDict={right:["up","down","left","right","horizontal_par","vertical_perp"],up:["left","right","down","up","vertical_par","horizontal_perp"],down:["right","left","up","down","vertical_par","horizontal_perp"],left:["down","up","right","left","horizontal_par","vertical_perp"]};function absolutifyRuleCell(e,n){for(var t=0;t<n.length;t+=2){var r=n[t],o=relativeDirs.indexOf(r);o>=0&&(n[t]=relativeDict[e][o])}}var dirMasks={up:parseInt("00001",2),down:parseInt("00010",2),left:parseInt("00100",2),right:parseInt("01000",2),moving:parseInt("01111",2),no:parseInt("00011",2),randomdir:parseInt("00101",2),random:parseInt("10010",2),action:parseInt("10000",2),"":parseInt("00000",2)};function rulesToMask(e){for(var n=e.collisionLayers.length,t=[],r=0;r<n;r++)t.push(null);e:for(r=0;r<e.rules.length;r++)for(var o=e.rules[r],a=0;a<o.lhs.length;a++)for(var i=o.lhs[a],l=o.rhs[a],s=0;s<i.length;s++){for(var c=i[s],d=t.concat([]),u=new BitVec(STRIDE_OBJ),h=new BitVec(STRIDE_OBJ),g=[],p=new BitVec(STRIDE_MOV),f=new BitVec(STRIDE_MOV),m=new BitVec(STRIDE_MOV),v=0;v<c.length;v+=2){if("..."===(L=c[v])){if(u=ellipsisPattern,2!==c.length){logError("You can't have anything in with an ellipsis. Sorry.",o.lineNumber),e.rules.splice(r,1),r--;continue e}if(0===s||s===i.length-1)logError("There's no point in putting an ellipsis at the very start or the end of a rule",o.lineNumber);else if(o.rhs.length>0){2===(k=l[s]).length&&"..."===k[0]||logError("An ellipsis on the left must be matched by one in the corresponding place on the right.",o.lineNumber)}break}if("random"!==L){var _=c[v+1],b=e.objects[_],y=e.objectMasks[_];if(b)var w=0|b.layer;else w=e.propertiesSingleLayer[_];if(void 0===w&&logError("Oops! "+_.toUpperCase()+" not assigned to a layer.",o.lineNumber),"no"===L)h.ior(y);else null!==(q=d[w])&&(o.discard=[_.toUpperCase(),q.toUpperCase()]),d[w]=_,b?(u.ior(y),m.ishiftor(31,5*w)):g.push(y),"stationary"===L?f.ishiftor(31,5*w):p.ishiftor(dirMasks[L],5*w)}else logError("RANDOM cannot be matched on the left-hand side, it can only appear on the right",o.lineNumber)}if(o.rhs.length>0){var k=l[s],R=i[s];"..."===k[0]&&"..."!==R[0]&&logError("An ellipsis on the right must be matched by one in the corresponding place on the left.",o.lineNumber);for(v=0;v<k.length;v+=2){"..."===k[v]&&2!==k.length&&logError("You can't have anything in with an ellipsis. Sorry.",o.lineNumber)}}if(u!==ellipsisPattern){if(i[s]=new CellPattern([u,h,g,p,f,null]),u.anyBitsInCommon(h)){var C=o.lineNumber;r>0&&e.rules[r-1].lineNumber===C||r+1<e.rules.length&&e.rules[r+1].lineNumber===C||logWarning('This rule has some content of the form "X no X" (either directly or maybe indirectly - check closely how the terms are defined if nothing stands out) which can never match and so the rule is getting removed during compilation.',o.lineNumber),e.rules.splice(r,1),r--}else if(0!==o.rhs.length){var E=l[s],S=t.concat([]),M=t.concat([]),I=new BitVec(STRIDE_OBJ),x=new BitVec(STRIDE_OBJ),T=new BitVec(STRIDE_MOV),O=new BitVec(STRIDE_MOV),A=new BitVec(STRIDE_MOV),D=new BitVec(STRIDE_OBJ),N=new BitVec(STRIDE_MOV),B=new BitVec(STRIDE_MOV);for(v=0;v<E.length;v+=2){var L=E[v];_=E[v+1];if("..."===L)break;if("random"!==L){b=e.objects[_],y=e.objectMasks[_];if(b)w=0|b.layer;else w=e.propertiesSingleLayer[_];if("no"==L)I.ior(y);else{null===(q=S[w])&&(q=M[w]),null!==q&&(o.hasOwnProperty("discard")||logError("Rule matches object types that can't overlap: \""+_.toUpperCase()+'" and "'+q.toUpperCase()+'".',o.lineNumber)),S[w]=_,L.length>0&&N.ishiftor(31,5*w);var P=e.layerMasks[w];b&&(x.ibitset(b.id),I.ior(P),A.ishiftor(31,5*w)),"stationary"===L&&T.ishiftor(31,5*w),"randomdir"===L?B.ishiftor(dirMasks[L],5*w):O.ishiftor(dirMasks[L],5*w)}}else if(_ in e.objectMasks){var j,F=e.objectMasks[_];D.ior(F),e.propertiesDict.hasOwnProperty(_)?j=e.propertiesDict[_]:(logWarning(`In this rule you're asking me to spawn a random ${_.toUpperCase()} for you, but that's already a concrete single object. You wanna be using random with properties (things defined in terms of OR in the legend) so there's some things to select between.`,o.lineNumber),j=[_]);for(var V=0;V<j.length;V++){var q,U=j[V];if(null!==(q=S[w=0|e.objects[U].layer])){var z=U.toUpperCase(),W=q.toUpperCase();z!==W&&logWarning("This rule may try to spawn a "+z+" with random, but also requires a "+W+" be here, which is on the same layer - they shouldn't be able to coexist!",o.lineNumber)}M[w]=U}}else logError('You want to spawn a random "'+_.toUpperCase()+"\", but I don't know how to do that",o.lineNumber)}u.bitsSetInArray(x.data)||I.ior(u),p.bitsSetInArray(O.data)||T.ior(p);for(v=0;v<n;v++)null!==d[v]&&null===S[v]&&(I.ior(e.layerMasks[v]),N.ishiftor(31,5*v));m.iclear(A),N.ior(m),I.iszero()&&x.iszero()&&T.iszero()&&O.iszero()&&N.iszero()&&D.iszero()&&B.iszero()||(i[s].replacement=new CellReplacement([I,x,T,O,N,D,B]))}}else i[s]=ellipsisPattern}}function cellRowMasks(e){for(var n=[],t=e[1],r=0;r<t.length;r++){for(var o=t[r],a=new BitVec(STRIDE_OBJ),i=0;i<o.length;i++)o[i]!==ellipsisPattern&&a.ior(o[i].objectsPresent);n.push(a)}return n}function cellRowMasks_Movements(e){for(var n=[],t=e[1],r=0;r<t.length;r++){for(var o=t[r],a=new BitVec(STRIDE_MOV),i=0;i<o.length;i++)o[i]!==ellipsisPattern&&a.ior(o[i].movementsPresent);n.push(a)}return n}function collapseRules(e){for(var n=0;n<e.length;n++)for(var t=e[n],r=0;r<t.length;r++){for(var o=t[r],a=[0,[],o.rhs.length>0,o.lineNumber],i=[],l=0;l<o.lhs.length;l++)i.push(0);a[0]=dirMasks[o.direction];for(l=0;l<o.lhs.length;l++){for(var s=o.lhs[l],c=0;c<s.length;c++)s[c]===ellipsisPattern&&(i[l]++,i[l]>2?logError("You can't use more than two ellipses in a single cell match pattern.",o.lineNumber):c>0&&s[c-1]===ellipsisPattern&&logWarning("Why would you go and have two ellipses in a row like that? It's exactly the same as just having a single ellipsis, right?",o.lineNumber));a[1][l]=s}a.push(i),a.push(o.groupNumber),a.push(o.rigid),a.push(o.commands),a.push(o.randomRule),a.push(cellRowMasks(a)),a.push(cellRowMasks_Movements(a)),t[r]=new Rule(a)}matchCache={}}function ruleGroupDiscardOverlappingTest(e){if(0!==e.length)for(var n=[],t=0;t<e.length;t++){var r=e[t];if(r.hasOwnProperty("discard")){var o=0!==t&&e[t-1].lineNumber===r.lineNumber,a=t!==e.length-1&&e[t+1].lineNumber===r.lineNumber;e.splice(t,1);for(var i=!1,l=0;l<n.length;l++){var s=n[l];if(s[0]===r.discard[0]&&s[1]===r.discard[1]){i=!0;break}}if(i||n.push(r.discard),!o&&!a||0===e.length){const e=n[0];var c="";if(n.length>1){c=" (ditto for ";for(l=1;l<n.length;l++){l>1&&(c+=", ",l===n.length-1&&(c+="and "));const e=n[l];if(c+=`${e[0]}/${e[1]}`,3===l&&n.length>4){c+=" etc.";break}}c+=")"}logError(`${e[0]} and ${e[1]} can never overlap${c}, but this rule requires that to happen, so it's being culled.`,r.lineNumber)}t--}}}function arrangeRulesByGroupNumber(e){for(var n={},t={},r=0;r<e.rules.length;r++){var o=e.rules[r],a=n;o.late&&(a=t),null==a[o.groupNumber]&&(a[o.groupNumber]=[]),a[o.groupNumber].push(o)}var i=[];for(var l in n){if(n.hasOwnProperty(l))ruleGroupDiscardOverlappingTest(c=n[l]),c.length>0&&i.push(c)}var s=[];for(var l in t){var c;if(t.hasOwnProperty(l))ruleGroupDiscardOverlappingTest(c=t[l]),c.length>0&&s.push(c)}e.rules=i,e.lateRules=s}function generateRigidGroupList(e){for(var n=[],t=[],r=[],o=[],a=[],i=0;i<e.rules.length;i++){for(var l=e.rules[i],s=!1,c=0;c<l.length;c++){l[c].isRigid&&(s=!0)}if(a[i]=s,s){var d=l[0].groupNumber;r[d]=i;var u=n.length;t[i]=u,o[d]=u,n.push(i)}}if(n.length>30){var h=n[30];logError("There can't be more than 30 rigid groups (rule groups containing rigid members).",e.rules[h][0].lineNumber)}e.rigidGroups=a,e.rigidGroupIndex_to_GroupIndex=n,e.groupNumber_to_RigidGroupIndex=o,e.groupIndex_to_RigidGroupIndex=t}function isObjectDefined(e,n){var t=n in e.objects||void 0!==e.aggregatesDict&&n in e.aggregatesDict||void 0!==e.propertiesDict&&n in e.propertiesDict||void 0!==e.synonymsDict&&n in e.synonymsDict;if(void 0!==e.legend_aggregates)for(var r=0;r<e.legend_aggregates.length;r++)if(e.legend_aggregates[r][0]===n){t=!0;break}if(void 0!==e.legend_properties)for(r=0;r<e.legend_properties.length;r++)if(e.legend_properties[r][0]===n){t=!0;break}if(void 0!==e.legend_synonyms)for(r=0;r<e.legend_synonyms.length;r++)if(e.legend_synonyms[r][0]===n){t=!0;break}return t}function getMaskFromName(e,n){var t=new BitVec(STRIDE_OBJ);if(n in e.objects){var r=e.objects[n];t.ibitset(r.id)}if(n in e.aggregatesDict)for(var o=e.aggregatesDict[n],a=0;a<o.length;a++){var i=o[a];r=e.objects[i];t.ibitset(r.id)}if(n in e.propertiesDict)for(o=e.propertiesDict[n],a=0;a<o.length;a++){i=o[a],r=e.objects[i];t.ibitset(r.id)}if(n in e.synonymsDict){i=e.synonymsDict[n],r=e.objects[i];t.ibitset(r.id)}return t.iszero()&&logErrorNoLine(`Error, didn't find any object called ${n}, either in the objects section, or the legends section.`),t}function generateMasks(e){e.playerMask=getMaskFromName(e,"player");for(var n=[],t=e.collisionLayers.length,r=0;r<t;r++){for(var o=new BitVec(STRIDE_OBJ),a=0;a<e.objectCount;a++){var i=e.idDict[a];(s=e.objects[i]).layer==r&&o.ibitset(s.id)}n.push(o)}e.layerMasks=n;var l={};for(var i in e.objects)if(e.objects.hasOwnProperty(i)){var s=e.objects[i];l[i]=new BitVec(STRIDE_OBJ),l[i].ibitset(s.id)}var c=e.legend_synonyms.concat(e.legend_properties);c.sort((function(e,n){return e.lineNumber-n.lineNumber}));for(var d=0;d<c.length;d++){var u=c[d];if(2==u.length)l[u[0]]=l[u[1]];else{var h=new BitVec(STRIDE_OBJ);for(a=1;a<u.length;a++){i=u[a];h.ior(l[i])}l[u[0]]=h}}var g=new BitVec(STRIDE_OBJ);for(var p of(g.inot(),l["\nall\n"]=g,e.objectMasks=l,e.aggregateMasks={},Object.keys(e.aggregatesDict))){var f=e.aggregatesDict[p],m=new BitVec(STRIDE_OBJ);for(d=0;d<f.length;d++){i=f[d],s=e.objects[i];m.ior(l[i])}e.aggregateMasks[p]=m}}function checkObjectsAreLayered(e){for(var n in e.objects)if(e.objects.hasOwnProperty(n)){for(var t=!1,r=0;r<e.collisionLayers.length;r++){for(var o=e.collisionLayers[r],a=0;a<o.length;a++)if(o[a]===n){t=!0;break}if(t)break}if(!1===t){var i=e.objects[n];logError('Object "'+n.toUpperCase()+'" has been defined, but not assigned to a layer.',i.lineNumber)}}}function isInt(e){return!isNaN(e)&&function(e){return(0|e)===e}(parseFloat(e))}function twiddleMetaData(e){for(var n={},t=0;t<e.metadata.length;t+=2){var r=e.metadata[t],o=e.metadata[t+1];n[r]=o}const a=function(e,n){if(!isFinite(e)||!isInt(e))return logWarning(`Wasn't able to make sense of "${e}" as a (whole number) dimension.`,n),NaN;var t=parseInt(e);return isNaN(t)&&logWarning(`Wasn't able to make sense of "${e}" as a dimension.`,n),t<=0&&logWarning(`The dimension given to me (you gave "${e}") is baad - it should be greater than 0.`,n),t},i=function(e,n){var t=o.split("x");if(2!==t.length)return logWarning("Dimensions must be of the form AxB.",n),null;var r=[a(t[0],n),a(t[1],n)];return!isFinite(t[0])||!isFinite(t[1])||isNaN(r[0])||isNaN(r[1])?(logWarning(`Couldn't understand the dimensions given to me (you gave "${o}") - should be of the form AxB.`,n),null):((r[0]<=0||r[1]<=0)&&logWarning(`The dimensions given to me (you gave "${o}") are baad - they should be > 0.`,n),r)};if(void 0!==n.flickscreen){o=n.flickscreen;n.flickscreen=i(0,e.metadata_lines.flickscreen),null===n.flickscreen&&delete n.flickscreen}if(void 0!==n.zoomscreen){o=n.zoomscreen;n.zoomscreen=i(0,e.metadata_lines.zoomscreen),null===n.zoomscreen&&delete n.zoomscreen}e.metadata=n}function processWinConditions(e){for(var n=[],t=0;t<e.winconditions.length;t++){var r=e.winconditions[t];if(0==r.length)return;var o=0;switch(r[0]){case"no":o=-1;break;case"all":o=1}var a,i=r[r.length-1],l=r[1];a=5==r.length?r[3]:"\nall\n";var s=0,c=0,d=!1,u=!1;r.length<=2?logError('Win conditions is badly formatted - needs to look something like "No Fruit", "All Target On Crate", "Some Fruit", "Some Gold on Chest", "No Gold on Chest", or the like.',i):l in e.objectMasks?(d=!1,s=e.objectMasks[l]):l in e.aggregateMasks?(d=!0,s=e.aggregateMasks[l]):logError('Unwelcome term "'+l+"\" found in win condition. I don't know what I'm supposed to do with this. ",i),a in e.objectMasks?(u=!1,c=e.objectMasks[a]):a in e.aggregateMasks?(u=!0,c=e.aggregateMasks[a]):logError('Unwelcome term "'+l+"\" found in win condition. I don't know what I'm supposed to do with this. ",i);var h=[o,s,c,i,d,u];n.push(h)}e.winconditions=n}function printCellRow(e){for(var n="[ ",t=0;t<e.length;t++){t>0&&(n+="| ");for(var r=e[t],o=0;o<r.length;o+=2){var a=r[o],i=r[o+1];n+="..."===a?a+" ":a+" "+i+" "}}return n+="] "}function cacheRuleStringRep(e){var n="(<a onclick=\"jumpToLine('"+e.lineNumber.toString()+'\');" href="javascript:void(0);">'+e.lineNumber+"</a>) "+e.direction.toString().toUpperCase()+" ";e.rigid&&(n="RIGID "+n+" "),e.randomRule&&(n="RANDOM "+n+" "),e.late&&(n="LATE "+n+" ");for(var t=0;t<e.lhs.length;t++){n+=printCellRow(e.lhs[t])}n+="-> ";for(t=0;t<e.rhs.length;t++){n+=printCellRow(e.rhs[t])}for(t=0;t<e.commands.length;t++){var r=e.commands[t];1===r.length?n+=r[0].toString():n=n+"("+r[0].toString()+", "+r[1].toString()+") "}e.stringRep=n}function cacheAllRuleNames(e){for(var n=0;n<e.rules.length;n++){cacheRuleStringRep(e.rules[n])}}function printRules(e){for(var n="",t=0,r=-1,o=0,a=0;a<e.rules.length;a++){var i=e.rules[a];if(t<e.loops.length&&e.loops[t][0]<i.lineNumber&&(n+="STARTLOOP<br>",++t<e.loops.length&&(r=e.loops[t][0],t++)),-1!==r&&r<i.lineNumber&&(n+="ENDLOOP<br>",r=-1),i.hasOwnProperty("discard"))o++;else n+=a>0&&e.rules[a-1].groupNumber===i.groupNumber?"+ ":" ",n+=i.stringRep+"<br>"}-1!==r&&(n+="ENDLOOP<br>"),n+="===========<br>",consolePrint(n="<br>Rule Assembly : ("+(e.rules.length-o)+" rules)<br>===========<br>"+n)}function removeDuplicateRules(e){for(var n={},t=-1,r=e.rules.length-1;r>=0;r--){var o=e.rules[r],a=o.groupNumber;a!==t&&(n={});var i=o.stringRep;n.hasOwnProperty(i)?e.rules.splice(r,1):n[i]=!0,t=a}}function generateLoopPoints(e){var n={},t=!0,r=0;if(e.loops.length>0){for(var o=0;o<e.loops.length;o++){var a=e.loops[o];o%2==0?-1===a[1]&&logError("Found an ENDLOOP, but I'm not in a loop?",a[0]):1===a[1]&&logError("Found a STARTLOOP, but I'm already inside a loop? (Puzzlescript can't nest loops, FWIW).",a[0])}var i=e.loops[e.loops.length-1];-1!==i[1]&&logError("Yo I found a STARTLOOP without a corresponding ENDLOOP.",i[0])}for(var l=0;l<e.loops.length;l++)for(a=e.loops[l],o=0;o<e.rules.length;o++){var s=(h=e.rules[o])[0],c=h[h.length-1],d=s.lineNumber,u=c.lineNumber;if(a[0]>=d&&a[0]<=u&&logWarning("Found a loop point in the middle of a rule. You probably don't want to do this, right?",a[0]),t){if(d>=a[0]){r=o,t=!1;break}}else if(d>=a[0]){n[o-1]=r,t=!0;break}}!1===t&&(n[e.rules.length]=r);e.loopPoint=n,n={},t=!0;for(l=0;l<e.loops.length;l++)for(a=e.loops[l],o=0;o<e.lateRules.length;o++){var h;s=(h=e.lateRules[o])[0],c=h[h.length-1],d=s.lineNumber,u=c.lineNumber;if(t){if(d>=a[0]){r=o,t=!1;break}}else if(d>=a[0]){n[o-1]=r,t=!0;break}}!1===t&&(n[e.lateRules.length]=r);e.lateLoopPoint=n}var soundDirectionIndicatorMasks={up:parseInt("00001",2),down:parseInt("00010",2),left:parseInt("00100",2),right:parseInt("01000",2),horizontal:parseInt("01100",2),vertical:parseInt("00011",2),orthogonal:parseInt("01111",2),___action____:parseInt("10000",2)},soundDirectionIndicators=["up","down","left","right","horizontal","vertical","orthogonal","___action____"];function generateSoundData(e){for(var n={},t=[],r=[],o=e.collisionLayers.map((e=>[])),a=[],i=0;i<e.sounds.length;i++){var l=e.sounds[i];if(l.length<=1)continue;var s=l[l.length-1];if(2===l.length){logWarning("incorrect sound declaration.",s);continue}const M=l[0][0].trim(),I=l[0][1].trim(),x=l[1][0].trim();l[1][1].trim();var c=l[l.length-2][0];if("SOUND"!==l[l.length-2][1]&&logError('Expecting sfx data, instead found "'+c+'".',s),"SOUNDEVENT"===I)l.length>4?logError("too much stuff to define a sound event.",s):l.length>3&&logWarning("too much stuff to define a sound event.",s),void 0!==n[M]&&logWarning(M.toUpperCase()+" already declared.",s),n[M]=c;else{for(var d=M,u=x,h=[],g=2;g<l.length-2;g++)"DIRECTION"===l[g][1]?h.push(l[g][0]):logError('Expected a direction here, but found instead "$(sound[j][0])".',s);h.length>0&&"move"!==u&&"cantmove"!==u&&logError("Incorrect sound declaration - cannot have directions (UP/DOWN/etc.) attached to non-directional sound verbs (CREATE is not directional, but MOVE is directional).",s),"action"===u&&(u="move",h=["___action____"]),0==h.length&&(h=["orthogonal"]),d in e.aggregatesDict?logError('cannot assign sound events to aggregate objects (declared with "and"), only to regular objects, or properties, things defined in terms of "or" ("'+d+'").',s):d in e.objectMasks||logError('Object "'+d+'" not found.',s);var p=e.objectMasks[d],f=0;for(g=0;g<h.length;g++){h[g]=h[g].trim();var m=h[g];if(-1===soundDirectionIndicators.indexOf(m))logError('Was expecting a direction, instead found "'+m+'".',s);else f|=soundDirectionIndicatorMasks[m]}for(var v=[d],_=!0;_;){_=!1;for(var b=0;b<v.length;b++){var y=v[b];if(y in e.synonymsDict)v[b]=e.synonymsDict[y],_=!0;else if(y in e.propertiesDict){_=!0;var w=e.propertiesDict[y];v.splice(b,1),b--;for(var k=0;k<w.length;k++)v.push(w[k])}}}if("move"===u||"cantmove"===u)for(g=0;g<v.length;g++){var R=v[g],C=e.objects[R].layer;if(void 0!==C){var E=new BitVec(STRIDE_MOV);E.ishiftor(f,5*C);var S={objectMask:p,directionMask:E,layer:C,seed:c};"move"===u?o[C].push(S):a.push(S)}}switch(u){case"create":S={objectMask:p,seed:c};t.push(S);break;case"destroy":S={objectMask:p,seed:c};r.push(S)}}}e.sfx_Events=n,e.sfx_CreationMasks=t,e.sfx_DestructionMasks=r,e.sfx_MovementMasks=o,e.sfx_MovementFailureMasks=a}function formatHomePage(e){if("background_color"in e.metadata?e.bgcolor=colorToHex(colorPalette,e.metadata.background_color):e.bgcolor="#000000","text_color"in e.metadata?e.fgcolor=colorToHex(colorPalette,e.metadata.text_color):e.fgcolor="#FFFFFF",!1===isColor(e.fgcolor)&&(logError("text_color in incorrect format - found "+e.fgcolor+", but I expect a color name (like 'pink') or hex-formatted color (like '#1412FA'). Defaulting to white.",e.metadata_lines.text_color),e.fgcolor="#FFFFFF"),!1===isColor(e.bgcolor)&&(logError("background_color in incorrect format - found "+e.bgcolor+", but I expect a color name (like 'pink') or hex-formatted color (like '#1412FA'). Defaulting to black.",e.metadata_lines.background_color),e.bgcolor="#000000"),canSetHTMLColors&&("background_color"in e.metadata&&(document.body.style.backgroundColor=e.bgcolor),"text_color"in e.metadata)){var n=document.getElementById("separator");null!=n&&(n.style.color=e.fgcolor);for(var t=document.getElementsByTagName("a"),r=0;r<t.length;r++)t[r].style.color=e.fgcolor;for(t=document.getElementsByTagName("h1"),r=0;r<t.length;r++)t[r].style.color=e.fgcolor}if("homepage"in e.metadata){var o=e.metadata.homepage;o=(o=o.replace("http://","")).replace("https://",""),e.metadata.homepage=o}}var ifrm,MAX_ERRORS=5;function loadFile(e){for(var n=new codeMirrorFn,t=n.startState(),r=e.split("\n"),o=0;o<r.length;o++){var a=r[o];t.lineNumber=o+1;var i=new CodeMirror.StringStream(a,4);do{if(n.token(i,t),errorCount>MAX_ERRORS)return void consolePrint("too many errors, aborting compilation")}while(!1===i.eol())}return isObjectDefined(t,"player")||logErrorNoLine("Error, didn't find any object called player, either in the objects section, or the legends section. There must be a player!"),isObjectDefined(t,"background")||logErrorNoLine("Error, didn't find any object called background, either in the objects section, or the legends section. There must be a background!"),0===t.collisionLayers.length?(logError("No collision layers defined. All objects need to be in collision layers."),null):(generateExtraMembers(t),generateMasks(t),levelsToArray(t),rulesToArray(t),t.invalid>0?null:(cacheAllRuleNames(t),removeDuplicateRules(t),rulesToMask(t),debugMode&&printRules(t),arrangeRulesByGroupNumber(t),collapseRules(t.rules),collapseRules(t.lateRules),generateRigidGroupList(t),processWinConditions(t),checkObjectsAreLayered(t),twiddleMetaData(t),generateLoopPoints(t),generateSoundData(t),formatHomePage(t),delete t.commentLevel,delete t.line_should_end,delete t.line_should_end_because,delete t.sol_after_comment,delete t.names,delete t.abbrevNames,delete t.objects_candname,delete t.objects_section,delete t.objects_spritematrix,delete t.section,delete t.subsection,delete t.tokenIndex,delete t.current_line_wip_array,delete t.visitedSections,delete t.loops,t))}function compile(e,n,t){(matchCache={},forceRegenImages=!0,void 0===e&&(e=["restart"]),void 0===t&&(t=null),lastDownTarget=canvas,void 0===n)&&(n=window.form1.code.editorreference.getValue()+"\n");!0===canDump&&(compiledText=n),errorCount=0,compiling=!0,errorStrings=[],consolePrint("=================================");try{var r=loadFile(n)}catch(e){consolePrint(e),console.log(e)}finally{compiling=!1}if(r&&r.levels&&0===r.levels.length&&logError("No levels found. Add some levels!",void 0,!0),errorCount>0){if(consoleError(!1===IDE?null==r?"<span class=\"systemMessage\">Errors detected during compilation; I can't salvage anything playable from it. If this is an older game, and you think it just broke because of recent changes in the puzzlescript engine, please consider dropping an email to analytic@gmail.com with a link to the game and I'll try make sure it's back working ASAP.</span>":"<span class=\"systemMessage\">Errors detected during compilation; the game may not work correctly. If this is an older game, and you think it just broke because of recent changes in the puzzlescript engine, please consider dropping an email to analytic@gmail.com with a link to the game and I'll try make sure it's back working ASAP.</span>":null==r?'<span class="systemMessage">Errors detected during compilation; I can\'t salvage anything playable from it.</span>':'<span class="systemMessage">Errors detected during compilation; the game may not work correctly.</span>'),errorCount>MAX_ERRORS)return}else{for(var o=0,a=0;a<r.rules.length;a++)o+=r.rules[a].length;for(a=0;a<r.lateRules.length;a++)o+=r.lateRules[a].length;"restart"==e[0]?consolePrint('<span class="systemMessage">Successful Compilation, generated '+o+" instructions.</span>"):consolePrint('<span class="systemMessage">Successful live recompilation, generated '+o+" instructions.</span>"),IDE&&void 0!==r.metadata.title&&(document.title="PuzzleScript - "+r.metadata.title)}null!==r&&setGameState(r,e,t),clearInputHistory(),consoleCacheDump()}function qualifyURL(e){var n=document.createElement("a");return n.href=e,n.href}var keyRepeatTimer=0,keyRepeatIndex=0,input_throttle_timer=0,lastinput=-100,dragging=!1,rightdragging=!1,columnAdded=!1;function selectText(e,n){n=n||window.event;var t=document.getElementById(e);if(n&&(n.ctrlKey||n.metaKey)){var r=["console"].concat(t.innerText.split("\n")),o=levelFromString(state,r);loadLevelFromLevelDat(state,o,null),canvasResize()}else{if(document.selection)(a=document.body.createTextRange()).moveToElementText(t),a.select();else if(window.getSelection){var a;(a=document.createRange()).selectNode(t);var i=window.getSelection();i.removeAllRanges(),i.addRange(a)}}}function recalcLevelBounds(){}function arrCopy(e,n,t,r,o){for(;o--;)t[r++]=e[n]++}function adjustLevel(e,n,t){backups.push(backupLevel());var r=e.clone();e.width+=n,e.height+=t,e.n_tiles=e.width*e.height,e.objects=new Int32Array(e.n_tiles*STRIDE_OBJ);var o=new BitVec(STRIDE_OBJ);o.ibitset(state.backgroundid);for(var a=0;a<e.n_tiles;++a)e.setCell(a,o);return e.movements=new Int32Array(e.objects.length),columnAdded=!0,RebuildLevelArrays(),r}function addLeftColumn(){for(var e=adjustLevel(level,1,0),n=1;n<level.width;++n)for(var t=0;t<level.height;++t){var r=n*level.height+t;level.setCell(r,e.getCell(r-level.height))}}function addRightColumn(){for(var e=adjustLevel(level,1,0),n=0;n<level.width-1;++n)for(var t=0;t<level.height;++t){var r=n*level.height+t;level.setCell(r,e.getCell(r))}}function addTopRow(){for(var e=adjustLevel(level,0,1),n=0;n<level.width;++n)for(var t=1;t<level.height;++t){var r=n*level.height+t;level.setCell(r,e.getCell(r-n-1))}}function addBottomRow(){for(var e=adjustLevel(level,0,1),n=0;n<level.width;++n)for(var t=0;t<level.height-1;++t){var r=n*level.height+t;level.setCell(r,e.getCell(r-n))}}function removeLeftColumn(){if(!(level.width<=1))for(var e=adjustLevel(level,-1,0),n=0;n<level.width;++n)for(var t=0;t<level.height;++t){var r=n*level.height+t;level.setCell(r,e.getCell(r+level.height))}}function removeRightColumn(){if(!(level.width<=1))for(var e=adjustLevel(level,-1,0),n=0;n<level.width;++n)for(var t=0;t<level.height;++t){var r=n*level.height+t;level.setCell(r,e.getCell(r))}}function removeTopRow(){if(!(level.height<=1))for(var e=adjustLevel(level,0,-1),n=0;n<level.width;++n)for(var t=0;t<level.height;++t){var r=n*level.height+t;level.setCell(r,e.getCell(r+n+1))}}function removeBottomRow(){if(!(level.height<=1))for(var e=adjustLevel(level,0,-1),n=0;n<level.width;++n)for(var t=0;t<level.height;++t){var r=n*level.height+t;level.setCell(r,e.getCell(r+n))}}function matchGlyph(e,n){for(var t,r=-1,o=0;o<n.length;++o){var a=n[o][0],i=n[o][1],l=n[o][2];if(i.bitsSetInArray(e.data)){for(var s=0,c=0;c<32*STRIDE_OBJ;++c)l.get(c)&&e.get(c)&&s++,i.get(c)&&e.get(c)&&s++;s>r&&(r=s,t=a)}}return r>0?t:(compiling=!0,logWarningNoLine("Wasn't able to approximate glyph values for some tiles, using '.' as a placeholder.",!1),compiling=!1,".")}var htmlEntityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},selectableint=0;function printLevel(){try{errorCount=0,errorStrings=[];var e=[];for(var n in state.glyphDict)if(state.glyphDict.hasOwnProperty(n)&&1===n.length){for(var t=state.glyphDict[n],r=new BitVec(STRIDE_OBJ),o=0;o<t.length;o++){var a=t[o];a>=0&&r.ibitset(a)}var i=r.clone(),l=state.layerMasks[state.backgroundlayer];r.iclear(l),e.push([n,r,i])}for(var s="selectable"+ ++selectableint,c='Printing level contents:<br><br><span id="'+s+'" onclick="selectText(\''+s+"',event)\">",d=0;d<level.height;d++){for(o=0;o<level.width;o++){var u=d+o*level.height;(t=matchGlyph(level.getCell(u),e))in htmlEntityMap&&(t=htmlEntityMap[t]),c+=t}d<level.height-1&&(c+="<br>")}consolePrint(c+="</span><br><br>",!0)}catch(e){consolePrint("unable to print level contents because of errors",!0)}}function levelEditorClick(e,n){if(mouseCoordY<=-2){var t=mouseCoordX+(screenwidth-1)*(editorRowCount-(-mouseCoordY-2)-1);-1===mouseCoordX?printLevel():mouseCoordX>=0&&t<glyphImages.length&&(glyphSelectedIndex=t,redraw())}else if(mouseCoordX>-1&&mouseCoordY>-1&&mouseCoordX<screenwidth-2&&mouseCoordY<screenheight-2-editorRowCount){for(var r=glyphImagesCorrespondance[glyphSelectedIndex],o=state.glyphDict[r],a=new BitVec(STRIDE_OBJ),i=0;i<o.length;i++){var l=o[i];l>=0&&a.ibitset(l)}var s=state.layerMasks[state.backgroundlayer];a.bitsClearInArray(s.data)&&a.ibitset(state.backgroundid);var c=mouseCoordY+mouseCoordX*level.height;if(level.getCell(c).equals(a))return;!1===anyEditsSinceMouseDown&&(anyEditsSinceMouseDown=!0,backups.push(backupLevel())),level.setCell(c,a),redraw()}else n&&(-1===mouseCoordX?(addLeftColumn(),canvasResize()):mouseCoordX===screenwidth-2&&(addRightColumn(),canvasResize()),-1===mouseCoordY?(addTopRow(),canvasResize()):mouseCoordY===screenheight-2-editorRowCount&&(addBottomRow(),canvasResize()))}function levelEditorRightClick(e,n){if(-2===mouseCoordY)mouseCoordX<=glyphImages.length&&(glyphSelectedIndex=mouseCoordX,redraw());else if(mouseCoordX>-1&&mouseCoordY>-1&&mouseCoordX<screenwidth-2&&mouseCoordY<screenheight-2-editorRowCount){var t=mouseCoordY+mouseCoordX*level.height,r=new BitVec(STRIDE_OBJ);r.ibitset(state.backgroundid),level.setCell(t,r),redraw()}else n&&(-1===mouseCoordX?(removeLeftColumn(),canvasResize()):mouseCoordX===screenwidth-2&&(removeRightColumn(),canvasResize()),-1===mouseCoordY?(removeTopRow(),canvasResize()):mouseCoordY===screenheight-2-editorRowCount&&(removeBottomRow(),canvasResize()))}var anyEditsSinceMouseDown=!1;function onMouseDown(e){if(!e.handled){ULBS();var n=0===e.button,t=2===e.button;if("touchstart"==e.type&&(n=!0),n&&(e.ctrlKey||e.metaKey)&&(n=!1,t=!0),n){if(lastDownTarget=e.target,keybuffer=[],(e.target===canvas||"tapFocusIndicator"===e.target.className)&&(setMouseCoord(e),dragging=!0,rightdragging=!1,levelEditorOpened))return anyEditsSinceMouseDown=!1,levelEditorClick(e,!0);dragging=!1,rightdragging=!1}else if(t&&(e.target===canvas||"tapFocusIndicator"===e.target.className)&&(setMouseCoord(e),dragging=!1,rightdragging=!0,levelEditorOpened))return levelEditorRightClick(e,!0);e.handled=!0}}function rightClickCanvas(e){return prevent(e)}function onMouseUp(e){e.handled||(dragging=!1,rightdragging=!1,e.handled=!0)}function onKeyDown(e){ULBS(),e=e||window.event,!IDE&&[32,37,38,39,40].indexOf(e.keyCode)>-1&&(e&&(e.ctrlKey||e.metaKey)||prevent(e)),IDE||77!==e.keyCode||toggleMute(),keybuffer.indexOf(e.keyCode)>=0||((lastDownTarget===canvas||window.Mobile&&lastDownTarget===window.Mobile.focusIndicator)&&-1===keybuffer.indexOf(e.keyCode)&&(e&&(e.ctrlKey||e.metaKey)||(keybuffer.splice(keyRepeatIndex,0,e.keyCode),keyRepeatTimer=0,checkKey(e,!e.repeat))),!0===canDump&&(74===e.keyCode&&(e.ctrlKey||e.metaKey)?(dumpTestCase(),prevent(e)):75===e.keyCode&&(e.ctrlKey||e.metaKey)?(makeGIF(),prevent(e)):83===e.keyCode&&(e.ctrlKey||e.metaKey)?(saveClick(),prevent(e)):13===e.keyCode&&(e.ctrlKey||e.metaKey)&&(canvas.focus(),editor.display.input.blur(),e.shiftKey?runClick():rebuildClick(),prevent(e))))}function relMouseCoords(e){var n=0,t=0,r=0,o=0,a=this;do{n+=a.offsetLeft-a.scrollLeft,t+=a.offsetTop-a.scrollTop}while(a=a.offsetParent);return null==e.touches?(r=e.pageX-n,o=e.pageY-t):(r=e.touches[0].pageX-n,o=e.touches[0].pageY-t),{x:r,y:o}}function onKeyUp(e){e=e||window.event;var n=keybuffer.indexOf(e.keyCode);n>=0&&(keybuffer.splice(n,1),keyRepeatIndex>=n&&keyRepeatIndex--)}function onMyFocus(e){keybuffer=[],keyRepeatIndex=0,keyRepeatTimer=0}function onMyBlur(e){keybuffer=[],keyRepeatIndex=0,keyRepeatTimer=0}HTMLCanvasElement.prototype.relMouseCoords=relMouseCoords;var prevTimestamp,mouseCoordX=0,mouseCoordY=0;function setMouseCoord(e){var n=canvas.relMouseCoords(e);mouseCoordX=n.x-xoffset,mouseCoordY=n.y-yoffset,mouseCoordX=Math.floor(mouseCoordX/cellwidth),mouseCoordY=Math.floor(mouseCoordY/cellheight)}function mouseMove(e){e.handled||(levelEditorOpened&&(setMouseCoord(e),dragging?levelEditorClick(e,!1):rightdragging&&levelEditorRightClick(e,!1),redraw()),e.handled=!0)}function mouseOut(){}function prevent(e){return e.preventDefault&&e.preventDefault(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),e.stopPropagation&&e.stopPropagation(),e.returnValue=!1,!1}function checkKey(e,n){if(ULBS(),!(winning||e&&(e.ctrlKey||e.metaKey||e.altKey))){var t=-1;switch(e.keyCode){case 65:case 37:t=1;break;case 38:case 87:t=0;break;case 68:case 39:t=3;break;case 83:case 40:t=2;break;case 80:printLevel();break;case 13:case 32:case 67:case 88:if(n&&ignoreNotJustPressedAction&&(ignoreNotJustPressedAction=!1),!1===n&&ignoreNotJustPressedAction)return;if(!1!==norepeat_action&&!n)return;t=4;break;case 85:case 90:if(!1===textMode)return pushInput("undo"),DoUndo(!1,!0),canvasResize(),prevent(e);break;case 82:if(!1===textMode&&n)return pushInput("restart"),DoRestart(),canvasResize(),prevent(e);break;case 27:if(!1===titleScreen)return goToTitleScreen(),tryPlayTitleSound(),canvasResize(),prevent(e);break;case 69:if(canOpenEditor)return n&&(titleScreen&&("EMPTY GAME"===state.title?compile(["loadFirstNonMessageLevel"]):nextLevel()),!1===(levelEditorOpened=!levelEditorOpened)&&printLevel(),restartTarget=backupLevel(),canvasResize()),prevent(e);break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:if(levelEditorOpened&&n){var r=9;return e.keyCode>=49&&(r=e.keyCode-49),r<glyphImages.length?glyphSelectedIndex=r:consolePrint("Trying to select tile outside of range in level editor.",!0),canvasResize(),prevent(e)}break;case 189:case 109:if(levelEditorOpened&&n&&glyphSelectedIndex>0)return glyphSelectedIndex--,canvasResize(),prevent(e);break;case 187:case 107:if(levelEditorOpened&&n&&glyphSelectedIndex+1<glyphImages.length)return glyphSelectedIndex++,canvasResize(),prevent(e)}if(throttle_movement&&t>=0&&t<=3){if(lastinput==t&&input_throttle_timer<repeatinterval)return;lastinput=t,input_throttle_timer=0}if(textMode){if(0===state.levels.length);else if(titleScreen)!1===quittingTitleScreen&&(0===titleMode?4===t&&n&&!1===titleSelected&&(tryPlayStartGameSound(),titleSelected=!0,messageselected=!1,timer=0,quittingTitleScreen=!0,generateTitleScreen(),canvasResize(),clearInputHistory()):4==t&&n?!1===titleSelected&&(tryPlayStartGameSound(),titleSelected=!0,messageselected=!1,timer=0,quittingTitleScreen=!0,generateTitleScreen(),redraw()):0!==t&&2!==t||(titleSelection=0===t?0:1,generateTitleScreen(),redraw()));else if(4==t&&n){if(unitTesting)return void nextLevel();!1===messageselected&&(messageselected=!0,timer=0,quittingMessageScreen=!0,tryPlayCloseMessageSound(),titleScreen=!1,drawMessageScreen())}}else if(!againing&&t>=0)return 4===t&&"noaction"in state.metadata||(pushInput(t),processInput(t)&&redraw()),prevent(e)}}function update(){if(timer+=deltatime,input_throttle_timer+=deltatime,quittingTitleScreen&&timer/1e3>.3&&(quittingTitleScreen=!1,nextLevel()),againing&&timer>againinterval&&0==messagetext.length&&processInput(-1)&&(redraw(),keyRepeatTimer=0,autotick=0),quittingMessageScreen&&timer/1e3>.15&&(quittingMessageScreen=!1,""===messagetext?nextLevel():(messagetext="",textMode=!1,titleScreen=!1,titleMode=curlevel>0||null!==curlevelTarget?1:0,titleSelected=!1,ignoreNotJustPressedAction=!0,titleSelection=0,canvasResize(),checkWin())),winning&&timer/1e3>.5&&(winning=!1,nextLevel()),keybuffer.length>0){keyRepeatTimer+=deltatime;var e=throttle_movement?repeatinterval:repeatinterval/Math.sqrt(keybuffer.length);if(keyRepeatTimer>e)keyRepeatTimer=0,keyRepeatIndex=(keyRepeatIndex+1)%keybuffer.length,checkKey({keyCode:keybuffer[keyRepeatIndex]},!1)}!(autotickinterval>0)||textMode||levelEditorOpened||againing||winning||(autotick+=deltatime)>autotickinterval&&(autotick=0,pushInput("tick"),processInput(-1)&&redraw())}document.addEventListener("touchstart",onMouseDown,!1),document.addEventListener("touchmove",mouseMove,!1),document.addEventListener("touchend",onMouseUp,!1),document.addEventListener("mousedown",onMouseDown,!1),document.addEventListener("mouseup",onMouseUp,!1),document.addEventListener("keydown",onKeyDown,!1),document.addEventListener("keyup",onKeyUp,!1),window.addEventListener("focus",onMyFocus,!1),window.addEventListener("blur",onMyBlur,!1);var loop=function(e){void 0!==prevTimestamp&&(deltatime=e-prevTimestamp),prevTimestamp=e,update(),window.requestAnimationFrame(loop)};function Animatable(e,n,t){var r;function o(){var e;return(r+=n)>=1&&(e=!0,r=1),t(r),e}function a(){var e;return(r-=n)<=0&&(e=!0,r=0),t(r),e}return r=0,{animateUp:function(){Animator.getInstance().animate(e,o)},animateDown:function(){Animator.getInstance().animate(e,a)}}}window.requestAnimationFrame(loop),window.Mobile={},Mobile.hasTouch=function(){var e;return("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)&&(e=!0),e},Mobile.enable=function(e){return(e||Mobile.hasTouch()&&!Mobile._instance)&&(Mobile._instance=new Mobile.GestureHandler,Mobile._instance.bindEvents(),Mobile._instance.bootstrap()),Mobile._instance},window.Mobile.GestureHandler=function(){this.initialize.apply(this,arguments)},Mobile.log=function(e){document.getElementsByTagName("h1")[0].innerHTML=Math.random().toString().substring(4,1)+"-"+e},Mobile.debugDot=function(e){var n,t;t="border-radius: 50px;width: 5px;height: 5px;background: red;position: absolute;left: "+e.touches[0].clientX+"px;top: "+e.touches[0].clientY+"px;",(n=document.createElement("div")).setAttribute("style",t),document.getElementsByTagName("body")[0].appendChild(n)},function(e){var n={action:88,left:37,right:39,up:38,down:40,undo:85,restart:82,quit:27},t=['<div class="tab">',' <div class="tab-affordance"></div>',' <div class="tab-icon">',' <div class="slice"></div>',' <div class="slice"></div>'," </div>","</div>"].join("\n");e.initialize=function(){this.firstPos={x:0,y:0},this.setTabAnimationRatio=this.setTabAnimationRatio.bind(this),this.setMenuAnimationRatio=this.setMenuAnimationRatio.bind(this),this.repeatTick=this.repeatTick.bind(this),this.isFocused=!0},e.setFocusElement=function(e){this.focusElement=e,this.isFocused=!1,this.buildFocusIndicator()},e.bindEvents=function(){window.addEventListener("touchstart",this.onTouchStart.bind(this)),window.addEventListener("touchend",this.onTouchEnd.bind(this)),window.addEventListener("touchmove",this.onTouchMove.bind(this))},e.bootstrap=function(){this.showTab(),this.disableScrolling(),this.isAudioSupported()||this.disableAudio(),this.disableSelection()},e.onTouchStart=function(e){this.isTouching||(this.handleFocusChange(e),this.isFocused&&"A"!==e.target.tagName.toUpperCase()&&(this.isTouching=!0,this.mayBeSwiping=!0,this.gestured=!1,this.swipeDirection=void 0,this.swipeDistance=0,this.startTime=(new Date).getTime(),this.firstPos.x=e.touches[0].clientX,this.firstPos.y=e.touches[0].clientY))},e.onTouchEnd=function(e){this.isFocused&&this.isTouching&&(this.gestured||0===e.touches.length&&"unMuteButton"!==e.target.id&&"muteButton"!==e.target.id&&this.handleTap(),0===e.touches.length&&(this.isTouching=!1,this.endRepeatWatcher()))},e.onTouchMove=function(e){if(this.isFocused&&!levelEditorOpened)return this.isSuccessfulSwipe()?(this.handleSwipe(this.swipeDirection,this.touchCount),this.gestured=!0,this.mayBeSwiping=!1,this.beginRepeatWatcher(e)):this.mayBeSwiping?this.swipeStep(e):this.isRepeating&&this.repeatStep(e),prevent(e),!1},e.handleFocusChange=function(e){this.focusElement&&(this.isFocused=this.isTouchInsideFocusElement(e),this.setFocusIndicatorVisibility(this.isFocused),canvas.focus(),editor.display.input.blur())},e.isTouchInsideFocusElement=function(e){var n;return!(!e.touches||!e.touches[0])&&(n=this.absoluteElementPosition(this.focusElement),!(e.touches[0].clientX<n.left||e.touches[0].clientY<n.top)&&!(e.touches[0].clientX>n.left+this.focusElement.clientWidth||e.touches[0].clientY>n.top+this.focusElement.clientHeight))},e.setFocusIndicatorVisibility=function(e){},e.absoluteElementPosition=function(e){var n,t;for(n={top:e.offsetTop||0,left:e.offsetLeft||0},t=document.getElementsByTagName("body")[0],n.top-=t.scrollTop||0;e=e.offsetParent;)n.top+=e.offsetTop||0,n.left+=e.offsetLeft||0;return n},e.beginRepeatWatcher=function(e){var n;this.repeatInterval||(this.isRepeating=!0,n=1e3*state.metadata.key_repeat_interval,!isNaN(n)&&n||(n=150),this.repeatInterval=setInterval(this.repeatTick,n),this.recenter(e))},e.endRepeatWatcher=function(){this.repeatInterval&&(clearInterval(this.repeatInterval),delete this.repeatInterval,this.isRepeating=!1)},e.repeatTick=function(){this.isTouching&&this.handleSwipe(this.direction,this.touchCount)},e.recenter=function(e){this.firstPos.x=e.touches[0].clientX,this.firstPos.y=e.touches[0].clientY},e.isSuccessfulSwipe=function(){var e;return this.mayBeSwiping&&void 0!==this.swipeDirection&&this.swipeDistance>=50&&(e=!0),e},e.swipeStep=function(e){var n,t,r;this.mayBeSwiping&&(n={x:e.touches[0].clientX,y:e.touches[0].clientY},t=(new Date).getTime(),r=e.touches.length,this.swipeDistance=this.cardinalDistance(this.firstPos,n),this.swipeDirection?t-this.startTime>1e3&&(this.mayBeSwiping=!1):this.swipeDistance>10&&(this.swipeDirection=this.dominantDirection(this.firstPos,n),this.touchCount=r))},e.repeatStep=function(e){var n;n={x:e.touches[0].clientX,y:e.touches[0].clientY},this.cardinalDistance(this.firstPos,n)>=50&&(this.swipeDirection=this.dominantDirection(this.firstPos,n),this.recenter(e))},e.cardinalDistance=function(e,n){var t,r;return t=Math.abs(e.x-n.x),r=Math.abs(e.y-n.y),Math.max(t,r)},e.dominantDirection=function(e,n){var t,r,o;return t=n.x-e.x,r=n.y-e.y,o="x",Math.abs(r)>Math.abs(t)&&(o="y"),"x"===o?t>0?"right":"left":r>0?"down":"up"},e.handleSwipe=function(e,n){1===n?this.emitKeydown(this.swipeDirection):n>1&&this.toggleMenu()},e.handleTap=function(){this.emitKeydown("action")},e.emitKeydown=function(e){var t;t={keyCode:n[e]},this.fakeCanvasFocus(),onKeyDown(t),onKeyUp(t)},e.fakeCanvasFocus=function(){onMouseDown({button:0,target:document.getElementById("gameCanvas")})},e.toggleMenu=function(){this.isMenuVisible?this.hideMenu():this.showMenu()},e.showMenu=function(){this.menuElem||this.buildMenu(),this.getAnimatables().menu.animateUp(),this.isMenuVisible=!0,this.hideTab()},e.hideMenu=function(){this.menuElem&&this.getAnimatables().menu.animateDown(),this.isMenuVisible=!1,this.showTab()},e.getAnimatables=function(){return this._animatables||(this._animatables={tab:Animatable("tab",.1,this.setTabAnimationRatio),menu:Animatable("menu",.1,this.setMenuAnimationRatio)}),this._animatables},e.showTab=function(){this.tabElem||this.buildTab(),this.getAnimatables().tab.animateDown()},e.hideTab=function(){this.tabElem&&this.tabElem.setAttribute("style","display: none;"),this.getAnimatables().tab.animateUp()},e.buildTab=function(){var e,n,r,o=this;(e=document.createElement("div")).innerHTML=t,r=e.children[0],n=function(e){e.stopPropagation(),o.showMenu()},this.tabAffordance=r.getElementsByClassName("tab-affordance")[0],this.tabElem=r.getElementsByClassName("tab-icon")[0],this.tabAffordance.addEventListener("touchstart",n),this.tabAffordance.addEventListener("click",(e=>{})),this.tabElem.addEventListener("touchstart",n),this.tabElem.addEventListener("click",(e=>{})),document.getElementsByTagName("body")[0].appendChild(r)},e.buildMenu=function(){var e,n,t,r,o,a,i=this;(e=document.createElement("div")).innerHTML=this.buildMenuString(state),this.menuElem=e.children[0],this.closeElem=this.menuElem.getElementsByClassName("close")[0],a=function(e){e.stopPropagation(),i.hideMenu()},this.closeAffordance=this.menuElem.getElementsByClassName("close-affordance")[0],o=this.menuElem.getElementsByClassName("close")[0],this.closeAffordance.addEventListener("touchstart",a),this.closeAffordance.addEventListener("click",(e=>{})),o.addEventListener("touchstart",a),o.addEventListener("click",(e=>{})),(n=this.menuElem.getElementsByClassName("undo")[0])&&(n.addEventListener("touchstart",(function(e){e.stopPropagation(),i.emitKeydown("undo")})),n.addEventListener("click",(e=>{}))),(t=this.menuElem.getElementsByClassName("restart")[0])&&(t.addEventListener("touchstart",(function(e){e.stopPropagation(),i.emitKeydown("restart")})),t.addEventListener("click",(e=>{}))),(r=this.menuElem.getElementsByClassName("quit")[0]).addEventListener("touchstart",(function(e){e.stopPropagation(),i.emitKeydown("quit")})),r.addEventListener("click",(e=>{})),document.getElementsByTagName("body")[0].appendChild(this.menuElem)},e.buildMenuString=function(e){var n,t,r,o;return n=3,(r=e.metadata.noundo)&&(n-=1),(o=e.metadata.norestart)&&(n-=1),t=['<div class="mobile-menu item-count-'+n+'">',' <div class="close-affordance"></div>',' <div class="close">',' <div class="slice"></div>',' <div class="slice"></div>'," </div>"],r||t.push(' <div class="undo button">Undo</div>'),o||t.push(' <div class="restart button">Restart</div>'),(t=t.concat([' <div class="quit button">Quit to Menu</div>',' <div class="clear"></div>',"</div>"])).join("\n")},e.buildFocusIndicator=function(){this.focusIndicator=document.createElement("DIV"),this.focusIndicator.setAttribute("class","tapFocusIndicator"),this.focusIndicator.setAttribute("style","visibility: hidden;"),this.focusElement.parentNode.appendChild(this.focusIndicator)},e.setTabAnimationRatio=function(e){var n;(e=Math.round(1e3*e)/1e3)>=.999?this.tabAffordance.setAttribute("style","display: none;"):this.tabAffordance.setAttribute("style","display: block;"),n="opacity: "+(1-e)+";"+" width: "+(66*e+18*(1-e))+"px;",this.tabElem.setAttribute("style",n)},e.setMenuAnimationRatio=function(e){var n,t,r;r="left: "+((n=-18*(e=Math.round(1e3*e)/1e3)+-66*(1-e))-4)+"px; "+(t="opacity: "+e+";")+" width: "+-n+"px;",(e=Math.round(1e3*e)/1e3)<=.001?(this.closeAffordance.setAttribute("style","display: none;"),t="display:none;"):this.closeAffordance.setAttribute("style","display: block;"),this.closeElem.setAttribute("style",r),this.menuElem.setAttribute("style",t)},e.disableScrolling=function(){var e={height:"100%",overflow:"hidden",position:"fixed",width:"100%",margin:0},n="";for(var t in e)n+=t+": "+e[t]+"; ";document.body.setAttribute("style",n)},e.disableAudio=function(){window.playSeed=function(){}},e.isAudioSupported=function(){var e=!0;return"undefined"!=typeof webkitAudioContext&&(e=!1),e},e.disableSelection=function(){var e;(e=document.getElementsByTagName("body")[0]).setAttribute("class",e.getAttribute("class")+" disable-select")}}(window.Mobile.GestureHandler.prototype),window.Animator=function(){this.initialize.apply(this,arguments)},function(e){e.initialize=function(){this._animations={},this.tick=this.tick.bind(this)},e.animate=function(e,n){this._animations[e]=n,this.wakeup()},e.wakeup=function(){this._isAnimating||(this._isAnimating=!0,this.tick())},e.tick=function(){var e,n,t;for(e in t=[],n=!0,this._animations){if(!this._animations.hasOwnProperty(e))return;this._animations[e]()?t.push(e):n=!1}if(n){for(0;0<t.length;t++)delete this._isAnimating[t[0]];this._isAnimating=!1}else requestAnimationFrame(this.tick)}}(window.Animator.prototype),window.Animator.getInstance=function(){return window.Animator._instance||(window.Animator._instance=new window.Animator),window.Animator._instance},function(){var e,n,t=["ms","moz","webkit","o"];for(e=0;e<t.length&&!window.requestAnimationFrame;e++)window.requestAnimationFrame=window[t[e]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[e]+"CancelAnimationFrame"],window.cancelAnimationFrame||(window.cancelAnimationFrame=window[t[e]+"CancelRequestAnimationFrame"]);window.requestAnimationFrame||(n=0,window.requestAnimationFrame=function(e,t){var r,o,a;return r=(new Date).getTime(),o=Math.max(0,16-(r-n)),a=window.setTimeout((function(){e(r+o)}),o),n=r+o,a}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)}),Mobile.enable()}();
//# sourceMappingURL=scripts_play_compiled.js.map</script><div style="z-index:2;background:0 0;position:absolute;top:.5em;right:1em"><img alt="mute" id="muteButton" width="32px" height="32px" onclick="muteAudio()" style="display:none" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xOdTWsmQAAAIGSURBVFhH3ZchcsJAGIURiApEBbIH6BEqOQASWYHoESoQFcwgOAaiEsEBKip6BERlBQJRwQEqtu/tvj+TLMnAJpntTL+ZP/De7p/9k102YUCcc0tEbpbx4MHIAMcKQ2LM4ktmOCYH9gXIawXzQasLYGKnAphryErC53VJLiPvhNgjtog54tZ3bgDt7QpgTkyD/42Y+aQa2CG5APYvMdGnFTBC3COeEG8IY4M4uxtsSCqAfQ1ZhSdZATangdNCvhCVImheVQC6FFdKZHtkeQ8fB8QOsUCM5N0hPhBkQ8+gEQ5BXLUb+swSsu0cZXjFE/kswu7ElB6hCAeJS/isCDXZOcaIKeKdHvhBPKiN00F4l+zu1BaQtKkop1Ic5BCx8g3OfSJu5Fthj9LnBfB7Ckqzc/Dq1oihtA34LP0SpHuV7r0AYyXN6SC7SO+ley9gFpQ7SHNNkFifpP9fAcZaOvsUNC3ChbQtwq30eQGg88+QwLKNjRuS/e6toLl0bQGNsF+MmuwcdRuR7Ya2EfEJ6Z8JFOEQRK6tuHg8U4TDBdClr4eRn3uDRjhcCfsasgpPsgLs8uP4iBiryUMzqQDC/iXiFxJbA1zttg4IX9EqgxM2JBdAmBPT4Pf/SmYwr4y8PC+lBnMNWUn4vLbJBvNBtz8m4E//mtkGlK0IjhWG1Jj8EnRWMPhg8AvjeqPLyfe3igAAAABJRU5ErkJggg=="> <img alt="unmute" id="unMuteButton" width="32px" height="32px" onclick="unMuteAudio()" style="display:none" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTnU1rJkAAABqElEQVRYR72XW3LDMAwDc7QerTdPRWjBoW1aedXZGUYUAIlqP9LpLbjf77+jvs3vfvgUvkDMmiPHzGxg9HTXEjNjsB6A0Nar+MxYg+UPFoH5ccLCauE+3Wmqvke+Pk5YWAl3sJuXGiSx3wfSOsMsrKRm4i6DJJAEktB+L1YW1oG4xyAJJIGUSOsMs7A2xB0GSSAJpA3Sz8xgYYnh/8R5g+ZKFG6Q9yAQ9dS3JEcEkkBqkb8K2X8EcYEkkE5RxkH6rkz7VT10uu3wwcbrcOipB+hEg62ZmlR9hbL1wEkJndgRMpVgif1+j3yH6LsSOtGALZAE0rUPwBJICfJ1D0A2ylamfDxXke8QfVfCGdak6pXpNkZBvkP0XeUl3hvkFiKfP8CwT5BPIfavD0iQBNJhEPJnDzCjr6Q31sMfI4P0/gPM6BP20ivTnSClxrZFvkP0WQ4YCQuImfzNYLfId4i+VqL0ExDfgNUi3yF6V6LkC3AsQW6R7xB9rZeHmzhrkFrkO0R/qHcZZ4Plv3sROARHv1mvImbG4GxixbucmDVHMjOauf8qY/jt9gdOODPsYZA1BAAAAABJRU5ErkJggg=="></div><script>const sourceCode="title Dinosaur Egg: Growing Pet\nauthor Bartłomiej \"bOngO\" Kawa\nhomepage www.puzzlescript.net\n\n( verbose_logging )\n\n========\nOBJECTS\n========\n\nBackground\nbrown\n\nWall\ndarkbrown\n\nPlayer\nGREEN\n...00\n...0.\n...0.\n0000.\n.0.0.\n\nEgg\nwhite\n\nWater\nblue\n\nExit\nyellow\n\nBlockade\ndarkblue\n\n=======\nLEGEND\n=======\n\n. = Background\n# = Wall\nP = Player\nE = Egg\nW = Water\nB = Blockade\nX = Exit\n& = Blockade and Exit\n\n=======\nSOUNDS\n=======\n\n================\nCOLLISIONLAYERS\n================\n\nBackground\nExit\nPlayer, Egg, Wall, Water, Blockade\n\n======\nRULES\n======\n\n==============\nWINCONDITIONS\n==============\n\n( No Egg )\nAll Player on Exit\n\n=======\nLEVELS\n=======\n\n############\n#..........#\n#..........#\n#..........#\n#P........X#\n#..........#\n#..........#\n#..........#\n############\n\nmessage THE END\nmessage Thanks for hatching :>\n\n(v2 2024.12.19)";compile(["restart"],sourceCode);</script></body></html>