From 76833ea52cb5e518ae2d405d5db77532ee6bd73c Mon Sep 17 00:00:00 2001 From: Marak Date: Mon, 5 Feb 2024 19:12:59 -0500 Subject: [PATCH] Bump `v1.1.2` Updates dist --- dist/labyrinthos.js | 28 ++++++++++++++++++++++------ dist/labyrinthos.min.js | 2 +- dist/labyrinthos.min.js.map | 2 +- examples/browser/labyrinthos.js | 28 ++++++++++++++++++++++------ package.json | 2 +- 5 files changed, 47 insertions(+), 15 deletions(-) diff --git a/dist/labyrinthos.js b/dist/labyrinthos.js index 1c3d433..2363c40 100644 --- a/dist/labyrinthos.js +++ b/dist/labyrinthos.js @@ -263,7 +263,7 @@ var TileMap = exports["default"] = /*#__PURE__*/function () { this.data = this.initializeDataArray(); // ASCII representations for tiles 0-10 // TODO: Is there a better default set of ASCII characters we can use? - this.defaultRogueLike = ['-', '#', '+', '0', '<', '>', '$', '#', '@', '&', '?']; + this.defaultRogueLike = ['-', '#', '+', '0', '<', '>', '$', '⌂', '@', '&', '?']; this.seedRandom(); } _createClass(TileMap, [{ @@ -585,6 +585,22 @@ function init3DArray(width, height, depth) { return arr; } +/* default roguelike `TileSet` mappings +{ + "void": 0, + "wall": 1, + "floor": 2, + "door": 3, + "special_door": 4, + "enter": 5, + "exit": 6, + "entity": 7, + "block": 8, + "bush": 9, + "grass": 10 +} +*/ + },{"./util/generateTiledJSON.js":25,"./util/mersenne.js":26,"./util/noise.js":27}],6:[function(require,module,exports){ "use strict"; @@ -1435,8 +1451,8 @@ var BeattieSchoberth = exports.BeattieSchoberth = /*#__PURE__*/function () { }(); var TILE = { VOID: 0, - FLOOR: 1, - WALL: 2, + WALL: 1, + FLOOR: 2, DOOR: 3, SPECIAL_DOOR: 4, ENTER: 5, @@ -1904,8 +1920,8 @@ var EXIT = 'exit'; var DIRECTIONS = ['n', 'e', 's', 'w']; var TILE = { VOID: 0, - FLOOR: 1, - WALL: 2, + WALL: 1, + FLOOR: 2, DOOR: 3, SPECIAL_DOOR: 4, ENTER: 5, @@ -2500,7 +2516,7 @@ function ALGORITHM_METROIDVANIA(tileMap, options) { var generator = new Metroidvania({ roomWidth: roomSizeWidth, roomHeight: roomSizeHeight, - maxFails: 8000, + maxFails: 25000, width: numRoomsWide, // Max number of zones wide height: numRoomsWide, diff --git a/dist/labyrinthos.min.js b/dist/labyrinthos.min.js index 411eb71..2c9864a 100644 --- a/dist/labyrinthos.min.js +++ b/dist/labyrinthos.min.js @@ -1,2 +1,2 @@ -!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).LABY=t()}(function(){return function o(i,n,a){function s(e,t){if(!n[e]){if(!i[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(h)return h(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}r=n[e]={exports:{}},i[e][0].call(r.exports,function(t){return s(i[e][1][t]||t)},r,r.exports,o,i,n,a)}return n[e].exports}for(var h="function"==typeof require&&require,t=0;tt.length)&&(e=t.length);for(var r=0,o=new Array(e);r","$","#","@","&","?"],this.seedRandom()}var t,e,r;return t=d,(e=[{key:"initializeDataArray",value:function(){var t=1=this.width||u>=this.height?a.push(void 0):(u=u*this.width+l,this.is3D?void 0!==n&&this.data[n]&&void 0!==this.data[n][u]?a.push(this.data[n][u]):a.push(void 0):void 0!==this.data[u]?a.push(this.data[u]):a.push(void 0))}t=new d({width:o,height:i,is3D:this.is3D});return t.data=a,t}},{key:"query3D",value:function(){var e,t=0=this.width||c>=this.height||m>=this.depth)&&(m=m*this.width*this.height+c*this.width+f,void 0!==this.data[m])?h.push(this.data[m]):h.push(void 0)}return void 0!==t&&(e=this.getTileIdByName(t),h=h.filter(function(t){return t===e})),h}},{key:"findTilesById",value:function(t){for(var e=[],r=this.is3D?this.data.length:1,o=0;o=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:e};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);rthis.maxRooms-2&&(console.error("Key count ".concat(this.maxKeys," is greater than rooms ").concat(this.maxRooms," minus two (entrance and exit). Reducing keys by two.")),this.maxKeys=this.maxRooms-2),this.build=this.generate,this.reset()}return a(r,[{key:"render",value:function(){for(var t="",e={0:"",1:"",2:"",3:"",4:"",5:""},r=(1e)&&this.furthest.n.set(t,r),this.furthest.e.get(e)),o=((void 0===o||this.rooms[o].xt)&&this.furthest.w.set(e,r)}},{key:"stretch",value:function(t,e){ethis.bounds.e&&(this.bounds.e=t),e>this.bounds.s&&(this.bounds.s=e),tthis.maxDistance&&(this.maxDistance=e)}},{key:"removeFromLockPool",value:function(t){var e=t.distance,r=this.lockPool.get(e);r?r.delete(t):console.error("no pool of depth ".concat(e))}},{key:"getHighestDistanceRoom",value:function(){for(var t=this.maxDistance;0e)return t;t=r}return t}},{key:"decrementChildrenCountAllParents",value:function(t){for(var e=t.childrenCount+1;t;)t.childrenCount-=e,t=t.parent}},{key:"removeRoomAndChildrenFromLockPool",value:function(t){this.removeFromLockPool(t);var e,r=s(t.children);try{for(r.s();!(e=r.n()).done;){var o=e.value;this.removeFromLockPool(o),this.removeRoomAndChildrenFromLockPool(o)}}catch(t){r.e(t)}finally{r.f()}}},{key:"lock",value:function(t,e){var r=this.doors[t],o=this.rooms[e],i=this.keys.length;if(!r)throw new Error("Invalid door ".concat(t));if(o)return this.keys.push({id:i,location:o.id,door:t}),this.doors[t].key=i,o.keyInRoom=i;throw new Error("Invalid room ".concat(e))}},{key:"generateGrid",value:function(t,e){for(var i=[],r=0;rt.length)&&(e=t.length);for(var r=0,o=new Array(e);rt.length)&&(e=t.length);for(var r=0,o=new Array(e);r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:e};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r=o.e.x&&(o.e=r),r.y<=o.n.y&&(o.n=r),r.y>=o.s.y&&(o.s=r),!(r=I(t,r,S))){if(C++,_.maxFails&&C>_.maxFails)throw new Error("Failed too many times to generate this configuration");return!1}}for(var d=0,f=h;d=k-1||!t[e.y][e.x+1].open||t[e.y][e.x+1].room!=r?t[e.y][e.x].edges.e=N:t[e.y][e.x].edges.e=W);t[e.y][e.x].edges.s!=F&&(e.y>=P-1||!t[e.y+1][e.x].open||t[e.y+1][e.x].room!=r?t[e.y][e.x].edges.s=N:t[e.y][e.x].edges.s=W);t[e.y][e.x].edges.w!=F&&(0!==e.x&&t[e.y][e.x-1].open&&t[e.y][e.x-1].room==r?t[e.y][e.x].edges.w=W:t[e.y][e.x].edges.w=N)}(t,f[d]);n[a]=h,a!=e-1&&(r=function(t,e,r){var o,i=B(e=U(e,r));try{for(i.s();!(o=i.n()).done;){var n=o.value,a=I(t,n,r);if(a)return q(t,n,a),a}}catch(t){i.e(t)}finally{i.f()}return!1}(t,h,S))}for(var c=0,m=0,y=n;m=k-1||b.y>=P-1||(p=t[b.y][b.x].room,w=null,(w=t[b.y+1][b.x]).open&&Math.abs(w.room-p)>z&&Math.random()<=E&&(q(t,b,{x:b.x,y:b.y+1}),c++),(w=t[b.y-1][b.x]).open&&Math.abs(w.room-p)>z&&Math.random()<=E&&(q(t,b,{x:b.x,y:b.y-1}),c++),(w=t[b.y][b.x-1]).open&&Math.abs(w.room-p)>z&&Math.random()<=E&&(q(t,b,{x:b.x-1,y:b.y}),c++),(w=t[b.y][b.x+1]).open&&Math.abs(w.room-p)>z&&Math.random()<=E&&(q(t,b,{x:b.x+1,y:b.y}),c++))}}catch(t){g.e(t)}finally{g.f()}}if(c_.maxFails)throw new Error("Failed too many times to generate this configuration");return!1}for(var x=0,M=H;x_.maxFails)throw new Error("Failed too many times to generate this configuration");return null}if(!t[o.y][o.x].open)return o}return!1}};function L(t,e,r){return Math.floor(r()*(e+1-t)+t)}function q(t,e,r){var o=t[e.y][e.x],t=t[r.y][r.x];e.x==r.x&&e.y>r.y?(o.edges.n=F,t.edges.s=F):e.x==r.x&&e.yr.x?(o.edges.w=F,t.edges.e=F):e.y==r.y&&e.xt.length)&&(e=t.length);for(var r=0,o=new Array(e);r":t[r][i]}e+=o+"\n"}return e}},{key:"build",value:function(t){return this.random=t||function(){return Math.random()},this.world=null,this.rooms={},this.doors={},this.walls=[],this.enter=null,this.exit=null,this.special=null,this.deadends=[],this.room_id=0,this.door_id=0,this.createVoid(),this.addStarterRoom(),this.generateRooms(),this.addSpecialRooms(),this.buildWalls(),{width:this.max_width,height:this.max_height,enter:this.enter,exit:this.exit,deadends:this.deadends,special:this.special,door_count:this.door_id,doors:this.doors,room_count:this.room_id,rooms:this.rooms,walls:this.walls,world:this.world}}},{key:"createVoid",value:function(){for(var t=[],e=0;el.left+l.width||n+al.top+l.height||i+s=this.max_height-1||e+r>=this.max_width-1}},{key:"buildWalls",value:function(){for(var t=this.rooms,e=0;et.length)&&(e=t.length);for(var r=0,o=new Array(e);r>>o&1&&(r=u(r,l(e<>>30)),i),h[i]=l(4294967295&h[i])},this.init_by_array=function(t,e){var r,o,i,n,a;for(this.init_genrand(19650218),r=1,o=0,i=e>>30),1664525)),t[o]),o),h[r]=l(4294967295&h[r]),o++,s<=++r&&(h[0]=h[623],r=1),e<=o&&(o=0);for(i=623;i;i--)h[r]=(n=l((dbg=h[r])^d(l(h[r-1]^h[r-1]>>>30),1566083941)))<(a=r)?l(4294967296-(a-n)&4294967295):n-a,h[r]=l(4294967295&h[r]),s<=++r&&(h[0]=h[623],r=1);h[0]=2147483648};var n=[0,2567483615];this.genrand_int32=function(){var t,e;if(s<=i){for(625==i&&this.init_genrand(5489),e=0;e<227;e++)t=l(h[e]&r|h[e+1]&o),h[e]=l(h[e+397]^t>>>1^n[1&t]);for(;e<623;e++)t=l(h[e]&r|h[e+1]&o),h[e]=l(h[e+-227]^t>>>1^n[1&t]);t=l(h[623]&r|h[0]&o),h[623]=l(h[396]^t>>>1^n[1&t]),i=0}return t=l((t=h[i++])^t>>>11),t=l(t^t<<7&2636928640),t=l(t^t<<15&4022730752),t=l(t^t>>>18)},this.genrand_int31=function(){return this.genrand_int32()>>>1},this.genrand_real1=function(){return this.genrand_int32()*(1/4294967295)},this.genrand_real2=function(){return this.genrand_int32()*(1/4294967296)},this.genrand_real3=function(){return(this.genrand_int32()+.5)*(1/4294967296)},this.genrand_res53=function(){return 1/9007199254740992*(67108864*(this.genrand_int32()>>>5)+(this.genrand_int32()>>>6))}}},{}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){var e=[];if(void 0!==t.data[0][0])for(var r=t.data.length,o=0;o>>0},getSeed:function(){return e},rand:function(){return(r=(1664525*r+1013904223)%o)/o}};i.setSeed(t),b=new Array(4096);for(var n=0;n<4096;n++)b[n]=i.rand()},r.default=o},{}]},{},[1])(1)}); +!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).LABY=t()}(function(){return function o(i,n,a){function s(e,t){if(!n[e]){if(!i[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(h)return h(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}r=n[e]={exports:{}},i[e][0].call(r.exports,function(t){return s(i[e][1][t]||t)},r,r.exports,o,i,n,a)}return n[e].exports}for(var h="function"==typeof require&&require,t=0;tt.length)&&(e=t.length);for(var r=0,o=new Array(e);r","$","⌂","@","&","?"],this.seedRandom()}var t,e,r;return t=d,(e=[{key:"initializeDataArray",value:function(){var t=1=this.width||u>=this.height?a.push(void 0):(u=u*this.width+l,this.is3D?void 0!==n&&this.data[n]&&void 0!==this.data[n][u]?a.push(this.data[n][u]):a.push(void 0):void 0!==this.data[u]?a.push(this.data[u]):a.push(void 0))}t=new d({width:o,height:i,is3D:this.is3D});return t.data=a,t}},{key:"query3D",value:function(){var e,t=0=this.width||c>=this.height||m>=this.depth)&&(m=m*this.width*this.height+c*this.width+f,void 0!==this.data[m])?h.push(this.data[m]):h.push(void 0)}return void 0!==t&&(e=this.getTileIdByName(t),h=h.filter(function(t){return t===e})),h}},{key:"findTilesById",value:function(t){for(var e=[],r=this.is3D?this.data.length:1,o=0;o=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:e};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);rthis.maxRooms-2&&(console.error("Key count ".concat(this.maxKeys," is greater than rooms ").concat(this.maxRooms," minus two (entrance and exit). Reducing keys by two.")),this.maxKeys=this.maxRooms-2),this.build=this.generate,this.reset()}return a(r,[{key:"render",value:function(){for(var t="",e={0:"",1:"",2:"",3:"",4:"",5:""},r=(1e)&&this.furthest.n.set(t,r),this.furthest.e.get(e)),o=((void 0===o||this.rooms[o].xt)&&this.furthest.w.set(e,r)}},{key:"stretch",value:function(t,e){ethis.bounds.e&&(this.bounds.e=t),e>this.bounds.s&&(this.bounds.s=e),tthis.maxDistance&&(this.maxDistance=e)}},{key:"removeFromLockPool",value:function(t){var e=t.distance,r=this.lockPool.get(e);r?r.delete(t):console.error("no pool of depth ".concat(e))}},{key:"getHighestDistanceRoom",value:function(){for(var t=this.maxDistance;0e)return t;t=r}return t}},{key:"decrementChildrenCountAllParents",value:function(t){for(var e=t.childrenCount+1;t;)t.childrenCount-=e,t=t.parent}},{key:"removeRoomAndChildrenFromLockPool",value:function(t){this.removeFromLockPool(t);var e,r=s(t.children);try{for(r.s();!(e=r.n()).done;){var o=e.value;this.removeFromLockPool(o),this.removeRoomAndChildrenFromLockPool(o)}}catch(t){r.e(t)}finally{r.f()}}},{key:"lock",value:function(t,e){var r=this.doors[t],o=this.rooms[e],i=this.keys.length;if(!r)throw new Error("Invalid door ".concat(t));if(o)return this.keys.push({id:i,location:o.id,door:t}),this.doors[t].key=i,o.keyInRoom=i;throw new Error("Invalid room ".concat(e))}},{key:"generateGrid",value:function(t,e){for(var i=[],r=0;rt.length)&&(e=t.length);for(var r=0,o=new Array(e);rt.length)&&(e=t.length);for(var r=0,o=new Array(e);r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:e};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r=o.e.x&&(o.e=r),r.y<=o.n.y&&(o.n=r),r.y>=o.s.y&&(o.s=r),!(r=I(t,r,S))){if(C++,_.maxFails&&C>_.maxFails)throw new Error("Failed too many times to generate this configuration");return!1}}for(var d=0,f=h;d=k-1||!t[e.y][e.x+1].open||t[e.y][e.x+1].room!=r?t[e.y][e.x].edges.e=N:t[e.y][e.x].edges.e=W);t[e.y][e.x].edges.s!=F&&(e.y>=P-1||!t[e.y+1][e.x].open||t[e.y+1][e.x].room!=r?t[e.y][e.x].edges.s=N:t[e.y][e.x].edges.s=W);t[e.y][e.x].edges.w!=F&&(0!==e.x&&t[e.y][e.x-1].open&&t[e.y][e.x-1].room==r?t[e.y][e.x].edges.w=W:t[e.y][e.x].edges.w=N)}(t,f[d]);n[a]=h,a!=e-1&&(r=function(t,e,r){var o,i=B(e=U(e,r));try{for(i.s();!(o=i.n()).done;){var n=o.value,a=I(t,n,r);if(a)return q(t,n,a),a}}catch(t){i.e(t)}finally{i.f()}return!1}(t,h,S))}for(var c=0,m=0,y=n;m=k-1||b.y>=P-1||(p=t[b.y][b.x].room,w=null,(w=t[b.y+1][b.x]).open&&Math.abs(w.room-p)>z&&Math.random()<=E&&(q(t,b,{x:b.x,y:b.y+1}),c++),(w=t[b.y-1][b.x]).open&&Math.abs(w.room-p)>z&&Math.random()<=E&&(q(t,b,{x:b.x,y:b.y-1}),c++),(w=t[b.y][b.x-1]).open&&Math.abs(w.room-p)>z&&Math.random()<=E&&(q(t,b,{x:b.x-1,y:b.y}),c++),(w=t[b.y][b.x+1]).open&&Math.abs(w.room-p)>z&&Math.random()<=E&&(q(t,b,{x:b.x+1,y:b.y}),c++))}}catch(t){g.e(t)}finally{g.f()}}if(c_.maxFails)throw new Error("Failed too many times to generate this configuration");return!1}for(var x=0,M=H;x_.maxFails)throw new Error("Failed too many times to generate this configuration");return null}if(!t[o.y][o.x].open)return o}return!1}};function L(t,e,r){return Math.floor(r()*(e+1-t)+t)}function q(t,e,r){var o=t[e.y][e.x],t=t[r.y][r.x];e.x==r.x&&e.y>r.y?(o.edges.n=F,t.edges.s=F):e.x==r.x&&e.yr.x?(o.edges.w=F,t.edges.e=F):e.y==r.y&&e.xt.length)&&(e=t.length);for(var r=0,o=new Array(e);r":t[r][i]}e+=o+"\n"}return e}},{key:"build",value:function(t){return this.random=t||function(){return Math.random()},this.world=null,this.rooms={},this.doors={},this.walls=[],this.enter=null,this.exit=null,this.special=null,this.deadends=[],this.room_id=0,this.door_id=0,this.createVoid(),this.addStarterRoom(),this.generateRooms(),this.addSpecialRooms(),this.buildWalls(),{width:this.max_width,height:this.max_height,enter:this.enter,exit:this.exit,deadends:this.deadends,special:this.special,door_count:this.door_id,doors:this.doors,room_count:this.room_id,rooms:this.rooms,walls:this.walls,world:this.world}}},{key:"createVoid",value:function(){for(var t=[],e=0;el.left+l.width||n+al.top+l.height||i+s=this.max_height-1||e+r>=this.max_width-1}},{key:"buildWalls",value:function(){for(var t=this.rooms,e=0;et.length)&&(e=t.length);for(var r=0,o=new Array(e);r>>o&1&&(r=u(r,l(e<>>30)),i),h[i]=l(4294967295&h[i])},this.init_by_array=function(t,e){var r,o,i,n,a;for(this.init_genrand(19650218),r=1,o=0,i=e>>30),1664525)),t[o]),o),h[r]=l(4294967295&h[r]),o++,s<=++r&&(h[0]=h[623],r=1),e<=o&&(o=0);for(i=623;i;i--)h[r]=(n=l((dbg=h[r])^d(l(h[r-1]^h[r-1]>>>30),1566083941)))<(a=r)?l(4294967296-(a-n)&4294967295):n-a,h[r]=l(4294967295&h[r]),s<=++r&&(h[0]=h[623],r=1);h[0]=2147483648};var n=[0,2567483615];this.genrand_int32=function(){var t,e;if(s<=i){for(625==i&&this.init_genrand(5489),e=0;e<227;e++)t=l(h[e]&r|h[e+1]&o),h[e]=l(h[e+397]^t>>>1^n[1&t]);for(;e<623;e++)t=l(h[e]&r|h[e+1]&o),h[e]=l(h[e+-227]^t>>>1^n[1&t]);t=l(h[623]&r|h[0]&o),h[623]=l(h[396]^t>>>1^n[1&t]),i=0}return t=l((t=h[i++])^t>>>11),t=l(t^t<<7&2636928640),t=l(t^t<<15&4022730752),t=l(t^t>>>18)},this.genrand_int31=function(){return this.genrand_int32()>>>1},this.genrand_real1=function(){return this.genrand_int32()*(1/4294967295)},this.genrand_real2=function(){return this.genrand_int32()*(1/4294967296)},this.genrand_real3=function(){return(this.genrand_int32()+.5)*(1/4294967296)},this.genrand_res53=function(){return 1/9007199254740992*(67108864*(this.genrand_int32()>>>5)+(this.genrand_int32()>>>6))}}},{}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){var e=[];if(void 0!==t.data[0][0])for(var r=t.data.length,o=0;o>>0},getSeed:function(){return e},rand:function(){return(r=(1664525*r+1013904223)%o)/o}};i.setSeed(t),b=new Array(4096);for(var n=0;n<4096;n++)b[n]=i.rand()},r.default=o},{}]},{},[1])(1)}); //# sourceMappingURL=labyrinthos.min.js.map \ No newline at end of file diff --git a/dist/labyrinthos.min.js.map b/dist/labyrinthos.min.js.map index 8ec7d01..8f612d0 100644 --- a/dist/labyrinthos.min.js.map +++ b/dist/labyrinthos.min.js.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"../","sources":["./dist/labyrinthos.js"],"sourcesContent":["(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.LABY = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i 0 && arguments[0] !== undefined ? arguments[0] : {},\n name = _ref.name,\n tileset = _ref.tileset,\n _ref$distribution = _ref.distribution,\n distribution = _ref$distribution === void 0 ? {} : _ref$distribution;\n _classCallCheck(this, Biome);\n this.name = name;\n this.tileset = tileset; // An instance of TileSet\n this.distribution = distribution; // Key: tile ID, Value: weight\n }\n\n // Method to set weighted distribution for tiles\n _createClass(Biome, [{\n key: \"setDistribution\",\n value: function setDistribution(distribution) {\n this.distribution = distribution;\n }\n }]);\n return Biome;\n}();\n\n},{}],3:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar LSystem = exports[\"default\"] = /*#__PURE__*/function () {\n function LSystem(_ref) {\n var tileset = _ref.tileset,\n axiom = _ref.axiom,\n rules = _ref.rules,\n generations = _ref.generations;\n _classCallCheck(this, LSystem);\n this.tileset = tileset; // TileSet instance\n this.axiom = axiom; // Initial state (as a tile name)\n this.rules = rules; // Transformation rules (using tile names)\n this.generations = generations; // Number of iterations\n }\n\n // Helper function to resolve a tile name to its ID using the TileSet\n _createClass(LSystem, [{\n key: \"getTileId\",\n value: function getTileId(tileName) {\n var tile = this.tileset.getTileByName(tileName);\n return tile ? tile.id : null; // Return null if tile name not found in TileSet\n }\n }, {\n key: \"applyRule\",\n value: function applyRule(tileId, tileMap) {\n var _this$tileset$getTile;\n // Resolve the tile ID to its name\n var tileName = (_this$tileset$getTile = this.tileset.getTile(tileId)) === null || _this$tileset$getTile === void 0 ? void 0 : _this$tileset$getTile.name;\n\n // If there's a rule for this tile, apply it\n if (tileName && this.rules[tileName]) {\n var resultTiles;\n\n // Create a context object to pass to the rule function\n var context = {\n // Current tile's properties\n tileId: tileId,\n tileName: tileName,\n // Function to get the ID of a tile by name\n getTileId: this.getTileId.bind(this),\n // Random function utility\n random: function random(max) {\n var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n return tileMap.random(max, min);\n },\n // Information about the tile map\n tileMap: {\n width: tileMap.width,\n height: tileMap.height,\n depth: tileMap.depth || 0 // Assuming depth property exists for 3D maps\n },\n // Function to get neighboring tiles (example for 2D, extend for 3D if needed)\n getNeighbors: function getNeighbors(x, y) {\n return [tileMap.getTileAt(x + 1, y),\n // Right\n tileMap.getTileAt(x - 1, y),\n // Left\n tileMap.getTileAt(x, y + 1),\n // Bottom\n tileMap.getTileAt(x, y - 1) // Top\n // Add more directions as needed, e.g., diagonal neighbors\n ];\n },\n // Current position (assuming you can derive x, y, z from tileId)\n position: {\n x: tileId % tileMap.width,\n y: Math.floor(tileId / tileMap.width),\n z: tileMap.depth ? Math.floor(tileId / (tileMap.width * tileMap.height)) : 0 // For 3D maps\n }\n };\n if (typeof this.rules[tileName] === 'function') {\n resultTiles = [this.rules[tileName](context)]; // returns string\n }\n if (typeof this.rules[tileName] === 'string') {\n resultTiles = this.rules[tileName].split(' ');\n }\n\n // For simplicity, let's just use the first tile specified in the rule\n // More complex logic could be added here to handle multiple tiles\n return this.getTileId(resultTiles[0]);\n }\n\n // Default to no change if no rule exists for this tile\n return tileId;\n }\n }, {\n key: \"applyTo\",\n value: function applyTo(tileMap) {\n var _this = this;\n for (var gen = 0; gen < this.generations; gen++) {\n // Apply rules to each tile in the map for each generation\n tileMap.data = tileMap.data.map(function (tileId) {\n return _this.applyRule(tileId, tileMap);\n });\n }\n }\n }]);\n return LSystem;\n}();\n\n},{}],4:[function(require,module,exports){\n\"use strict\";\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n// Not actually used anywhere\n// Tiles are currently just a data structure, so they don't need to be instantiated\nvar Tile = exports[\"default\"] = /*#__PURE__*/_createClass(function Tile() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n id = _ref.id,\n name = _ref.name;\n _classCallCheck(this, Tile);\n this.id = id;\n this.name = name;\n});\n\n},{}],5:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _generateTiledJSON = _interopRequireDefault(require(\"./util/generateTiledJSON.js\"));\nvar _mersenne = _interopRequireDefault(require(\"./util/mersenne.js\"));\nvar _noise = _interopRequireDefault(require(\"./util/noise.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); } // Exports to Tiled Editor JSON format\n// Randomness\n// Perlin Noise\nvar TileMap = exports[\"default\"] = /*#__PURE__*/function () {\n function TileMap() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref$x = _ref.x,\n x = _ref$x === void 0 ? 0 : _ref$x,\n _ref$y = _ref.y,\n y = _ref$y === void 0 ? 0 : _ref$y,\n _ref$width = _ref.width,\n width = _ref$width === void 0 ? 16 : _ref$width,\n _ref$height = _ref.height,\n height = _ref$height === void 0 ? 16 : _ref$height,\n _ref$depth = _ref.depth,\n depth = _ref$depth === void 0 ? 1 : _ref$depth,\n _ref$tileWidth = _ref.tileWidth,\n tileWidth = _ref$tileWidth === void 0 ? 16 : _ref$tileWidth,\n _ref$tileHeight = _ref.tileHeight,\n tileHeight = _ref$tileHeight === void 0 ? 16 : _ref$tileHeight,\n _ref$is3D = _ref.is3D,\n is3D = _ref$is3D === void 0 ? false : _ref$is3D;\n _classCallCheck(this, TileMap);\n this.x = x;\n this.y = y;\n // this.z = 0;\n this.width = width;\n this.height = height;\n this.depth = depth;\n this.tileWidth = tileWidth;\n this.tileHeight = tileHeight;\n this.mersenneTwister = new _mersenne[\"default\"]();\n this.Noise = new _noise[\"default\"]();\n this.noise = this.Noise.noise;\n this.seedNoise = this.Noise.noiseSeed;\n this.data = this.initializeDataArray();\n // ASCII representations for tiles 0-10\n // TODO: Is there a better default set of ASCII characters we can use?\n this.defaultRogueLike = ['-', '#', '+', '0', '<', '>', '$', '#', '@', '&', '?'];\n this.seedRandom();\n }\n _createClass(TileMap, [{\n key: \"initializeDataArray\",\n value: function initializeDataArray() {\n // Create a single-dimensional array\n var data;\n if (this.depth > 1) {\n data = init3DArray(this.width, this.height, this.depth);\n } else {\n data = init2DArray(this.width, this.height);\n }\n return data;\n }\n }, {\n key: \"fill\",\n value: function fill(value) {\n if (this.depth > 1) {\n for (var z = 0; z < this.depth; z++) {\n this.fill3D(value, z);\n }\n } else {\n this.fill2D(value);\n }\n }\n }, {\n key: \"fill2D\",\n value: function fill2D(value) {\n for (var i = 0; i < this.height * this.width; i++) {\n this.data[i] = value;\n }\n }\n }, {\n key: \"fill3D\",\n value: function fill3D(value, z) {\n for (var i = 0; i < this.height * this.width; i++) {\n this.data[z][i] = value;\n }\n }\n }, {\n key: \"random\",\n value: function random(max) {\n return this.mersenneTwister.rand(max);\n }\n }, {\n key: \"seed\",\n value: function seed(value) {\n if (typeof value === 'undefined') {\n value = this.random(6400000000);\n }\n this.mersenneTwister.seed(value);\n this.seedNoise(value);\n // this.mersenneTwister.seed_array([value]); // also can seed from arrays\n }\n }, {\n key: \"seedRandom\",\n value: function seedRandom() {\n this.seed(this.random(6400000000));\n }\n }, {\n key: \"use\",\n value: function use(subMap, offsetX, offsetY) {\n // TODO: add support for if(this.is3D) support\n for (var y = 0; y < subMap.height; y++) {\n for (var x = 0; x < subMap.width; x++) {\n var targetX = x + offsetX;\n var targetY = y + offsetY;\n if (targetX < this.width && targetY < this.height) {\n this.data[targetY * this.width + targetX] = subMap.data[y * subMap.width + x];\n }\n }\n }\n }\n }, {\n key: \"scaleToTileRange\",\n value: function scaleToTileRange(tileSetRange) {\n var heightMap = this.data;\n var max = Math.max.apply(Math, _toConsumableArray(heightMap));\n var min = Math.min.apply(Math, _toConsumableArray(heightMap));\n var range = tileSetRange - 1; // Adjust for zero index\n\n for (var i = 0; i < heightMap.length; i++) {\n var normalizedHeight = (heightMap[i] - min) / (max - min);\n this.data[i] = Math.round(normalizedHeight * range) + 1; // +1 to adjust range\n }\n }\n }, {\n key: \"mask\",\n value: function mask(format) {\n var asciiMasks = []; // Initialize an array to hold ASCII masks for each layer\n\n if (this.depth > 1) {\n var asciiLookup = format || this.defaultRogueLike;\n\n // Iterate through each layer of depth\n for (var z = 0; z < this.depth; z++) {\n var asciiMap = \"\";\n for (var y = 0; y < this.height; y++) {\n for (var x = 0; x < this.width; x++) {\n var tile = this.data[z][y * this.width + x]; // Access the correct layer in the 3D array\n asciiMap += asciiLookup[tile % asciiLookup.length]; // Use modulo to wrap around if tile index exceeds lookup table\n }\n asciiMap += '\\n'; // New line at the end of each row\n }\n asciiMasks.push(asciiMap); // Add the ASCII map of the current layer to the array\n }\n return asciiMasks; // Return the array of ASCII masks\n } else {\n // Handle the 2D case as before\n var _asciiMap = '';\n var _asciiLookup = format || this.defaultRogueLike;\n for (var _y = 0; _y < this.height; _y++) {\n for (var _x = 0; _x < this.width; _x++) {\n var _tile = this.data[_y * this.width + _x];\n _asciiMap += _asciiLookup[_tile % _asciiLookup.length];\n }\n _asciiMap += '\\n';\n }\n // For consistency, wrap the 2D mask in an array as well\n return [_asciiMap];\n }\n }\n }, {\n key: \"applyBiome\",\n value: function applyBiome(biome) {\n var tileMap = this;\n var noiseValues = tileMap.data; // Array of noise values\n var weights = biome.distribution; // Object with tile names as keys and weights as values\n var tileNames = Object.keys(weights); // Array of tile names\n var totalWeight = tileNames.reduce(function (total, name) {\n return total + weights[name];\n }, 0);\n var weightedRanges = tileNames.map(function (name, index) {\n return {\n name: name,\n end: tileNames.slice(0, index + 1).reduce(function (sum, name) {\n return sum + weights[name];\n }, 0) / totalWeight\n };\n });\n var _loop = function _loop() {\n var noiseValue = noiseValues[i];\n var selectedTileName = weightedRanges.find(function (range) {\n return noiseValue <= range.end;\n }).name;\n var tileId = biome.tileset.getTileByName(selectedTileName).id;\n tileMap.data[i] = tileId;\n };\n for (var i = 0; i < noiseValues.length; i++) {\n _loop();\n }\n }\n }, {\n key: \"getTileAt\",\n value: function getTileAt(x, y, z) {\n if (this.is3D) {\n return this.data[z][y * this.width + x];\n } else {\n return this.data[y * this.width + x];\n }\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n return JSON.stringify({\n width: this.width,\n height: this.height,\n tileWidth: this.tileWidth,\n tileHeight: this.tileHeight,\n data: this.data\n }, null, 2);\n }\n }, {\n key: \"toTiledJSON\",\n value: function toTiledJSON() {\n return (0, _generateTiledJSON[\"default\"])(this);\n }\n }, {\n key: \"query\",\n value: function query() {\n var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n x = _ref2.x,\n y = _ref2.y,\n width = _ref2.width,\n height = _ref2.height,\n z = _ref2.z,\n tileName = _ref2.tileName;\n var results = [];\n if (x !== undefined && y !== undefined && width !== undefined && height !== undefined) {\n for (var offsetY = 0; offsetY < height; offsetY++) {\n for (var offsetX = 0; offsetX < width; offsetX++) {\n var queryX = x + offsetX;\n var queryY = y + offsetY;\n if (queryX >= this.width || queryY >= this.height) {\n results.push(undefined); // Add undefined for out-of-bounds indices\n } else {\n var index = queryY * this.width + queryX; // Calculate the correct index in the 1D array\n if (this.is3D) {\n if (z !== undefined && this.data[z] && this.data[z][index] !== undefined) {\n results.push(this.data[z][index]);\n } else {\n results.push(undefined);\n }\n } else {\n if (this.data[index] !== undefined) {\n results.push(this.data[index]);\n } else {\n results.push(undefined);\n }\n }\n }\n }\n }\n }\n\n // create a new TileMap instance from the results\n var subsection = new TileMap({\n width: width,\n height: height,\n is3D: this.is3D\n });\n subsection.data = results;\n return subsection;\n }\n }, {\n key: \"query3D\",\n value:\n // query3D is WIP - not fully implemented yet, see: ./test/tilemap-query-test.js \n function query3D() {\n var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n x = _ref3.x,\n y = _ref3.y,\n z = _ref3.z,\n width = _ref3.width,\n height = _ref3.height,\n depth = _ref3.depth,\n tileName = _ref3.tileName;\n var results = [];\n if (x !== undefined && y !== undefined && z !== undefined && width !== undefined && height !== undefined && depth !== undefined) {\n for (var offsetZ = 0; offsetZ < depth; offsetZ++) {\n for (var offsetY = 0; offsetY < height; offsetY++) {\n for (var offsetX = 0; offsetX < width; offsetX++) {\n var queryX = x + offsetX;\n var queryY = y + offsetY;\n var queryZ = z + offsetZ;\n if (queryX >= this.width || queryY >= this.height || queryZ >= this.depth) {\n results.push(undefined); // Add undefined for out-of-bounds indices\n } else {\n // Calculate the correct index in the 3D array\n var index = queryZ * this.width * this.height + queryY * this.width + queryX;\n if (this.data[index] !== undefined) {\n results.push(this.data[index]);\n } else {\n results.push(undefined);\n }\n }\n }\n }\n }\n }\n\n // Additional logic to filter results by tileName, if provided\n if (tileName !== undefined) {\n var tileId = this.getTileIdByName(tileName); // Assuming a getTileIdByName function exists to map tile names to IDs\n results = results.filter(function (tile) {\n return tile === tileId;\n });\n }\n return results;\n }\n\n // Helper function to find tiles by ID\n }, {\n key: \"findTilesById\",\n value: function findTilesById(tileId) {\n var positions = [];\n var depth = this.is3D ? this.data.length : 1;\n for (var z = 0; z < depth; z++) {\n var layer = this.is3D ? this.data[z] : this.data;\n for (var i = 0; i < layer.length; i++) {\n if (layer[i] === tileId) {\n var x = i % this.width;\n var y = Math.floor(i / this.width);\n positions.push(this.is3D ? {\n x: x,\n y: y,\n z: z\n } : {\n x: x,\n y: y\n });\n }\n }\n }\n return positions;\n }\n }, {\n key: \"getTileIdByName\",\n value:\n // Example method to get tile ID by name (you'll need to implement this based on your tileset)\n function getTileIdByName(tileName) {\n // This is a placeholder function. You should implement it based on how your tileset is structured.\n // For example, if you have a mapping of tile names to tile IDs, you would use that here.\n // Return an example tile ID for demonstration\n return 1; // Assume tile ID 1 corresponds to the given tile name\n }\n }]);\n return TileMap;\n}();\nfunction init2DArray(width, height) {\n // Create a single-dimensional array\n return new Array(width * height).fill(0); // Fill with default tile type, e.g., 0\n}\nfunction init3DArray(width, height, depth) {\n var arr = [];\n for (var z = 0; z < depth; z++) {\n arr.push(init2DArray(width, height));\n }\n return arr;\n}\n\n},{\"./util/generateTiledJSON.js\":25,\"./util/mersenne.js\":26,\"./util/noise.js\":27}],6:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar TileSet = exports[\"default\"] = /*#__PURE__*/function () {\n function TileSet() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref$tiles = _ref.tiles,\n tiles = _ref$tiles === void 0 ? [] : _ref$tiles;\n _classCallCheck(this, TileSet);\n // tiles is array of tile objects with id, name, and properties, etc.\n this.tiles = tiles;\n }\n _createClass(TileSet, [{\n key: \"addTile\",\n value: function addTile(tile) {\n this.tiles.push(tile);\n }\n }, {\n key: \"getTile\",\n value: function getTile(id) {\n // search through array of tile objects for tile with matching id\n var tile = this.tiles.find(function (tile) {\n return tile.id === id;\n });\n return tile;\n }\n }, {\n key: \"getTileByName\",\n value: function getTileByName(name) {\n // search through array of tile objects for tile with matching name\n var tile = this.tiles.find(function (tile) {\n return tile.name === name;\n });\n return tile;\n }\n }]);\n return TileSet;\n}();\n\n},{}],7:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _Tile = _interopRequireDefault(require(\"./Tile.js\"));\nvar _TileMap = _interopRequireDefault(require(\"./TileMap.js\"));\nvar _TileSet = _interopRequireDefault(require(\"./TileSet.js\"));\nvar _Biome = _interopRequireDefault(require(\"./Biome.js\"));\nvar _AldousBroder = _interopRequireDefault(require(\"./mazes/AldousBroder.js\"));\nvar _AldousBroder3D = _interopRequireDefault(require(\"./mazes/AldousBroder3D.js\"));\nvar _BinaryTree = _interopRequireDefault(require(\"./mazes/BinaryTree.js\"));\nvar _CellularAutomata = _interopRequireDefault(require(\"./mazes/CellularAutomata.js\"));\nvar _EllersAlgorithm = _interopRequireDefault(require(\"./mazes/EllersAlgorithm.js\"));\nvar _GrowingTree = _interopRequireDefault(require(\"./mazes/GrowingTree.js\"));\nvar _RecursiveBacktrack = _interopRequireDefault(require(\"./mazes/RecursiveBacktrack.js\"));\nvar _RecursiveDivision = _interopRequireDefault(require(\"./mazes/RecursiveDivision.js\"));\nvar _ThomasHunter = _interopRequireDefault(require(\"./mazes/ThomasHunter.js\"));\nvar _BeattieSchoberth = _interopRequireDefault(require(\"./mazes/BeattieSchoberth.js\"));\nvar _Metroidvania = _interopRequireDefault(require(\"./mazes/Metroidvania.js\"));\nvar _Circle = _interopRequireDefault(require(\"./shapes/Circle.js\"));\nvar _Square = _interopRequireDefault(require(\"./shapes/Square.js\"));\nvar _Triangle = _interopRequireDefault(require(\"./shapes/Triangle.js\"));\nvar _LSystem = _interopRequireDefault(require(\"./LSystem.js\"));\nvar _FaultLine = _interopRequireDefault(require(\"./terrains/FaultLine.js\"));\nvar _PerlinNoise = _interopRequireDefault(require(\"./terrains/PerlinNoise.js\"));\nvar _noise = _interopRequireDefault(require(\"./util/noise.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n// Mazes\n\n// import HuntAndKill from './mazes/HuntAndKill.js';\n\n// import SpiralBacktrack from './mazes/SpiralBacktrack.js';\n\n// import TremauxsAlgorithm from './mazes/TremauxsAlgorithm.js';\n// import VoronoiDiagram from './mazes/VoronoiDiagram.js';\n\n// Shapes\n\n// import Hexagon from './shapes/Hexagon.js';\n\n// L-Systems\n\n// Biomes\n// TODO: Add biomes\n// Forest, Swamp, Plains, Mountain, Island\n\n// Terrains\n// https://en.wikipedia.org/wiki/Diamond-square_algorithm\n// import DiamondSquare from './terrains/DiamondSquare.js';\n\n// Utilities / Various\n\n// import mapImageToTileMap from './util/mapImageToTileMap.js';\n\nvar labyrinthos = {};\nlabyrinthos.mazes = {};\nlabyrinthos.mazes.AldousBroder = _AldousBroder[\"default\"];\nlabyrinthos.mazes.AldousBroder3D = _AldousBroder3D[\"default\"];\nlabyrinthos.mazes.BinaryTree = _BinaryTree[\"default\"];\nlabyrinthos.mazes.CellularAutomata = _CellularAutomata[\"default\"];\nlabyrinthos.mazes.EllersAlgorithm = _EllersAlgorithm[\"default\"];\nlabyrinthos.mazes.GrowingTree = _GrowingTree[\"default\"];\n// labyrinthos.mazes.HuntAndKill = HuntAndKill;\nlabyrinthos.mazes.RecursiveBacktrack = _RecursiveBacktrack[\"default\"];\nlabyrinthos.mazes.RecursiveDivision = _RecursiveDivision[\"default\"];\n// labyrinthos.mazes.SpiralBacktrack = SpiralBacktrack;\nlabyrinthos.mazes.BeattieSchoberth = _BeattieSchoberth[\"default\"];\nlabyrinthos.mazes.ThomasHunter = _ThomasHunter[\"default\"];\nlabyrinthos.mazes.Metroidvania = _Metroidvania[\"default\"];\nlabyrinthos.mazes.PlatformZones = _Metroidvania[\"default\"]; // legacy API support\n// labyrinthos.mazes.TremauxsAlgorithm = TremauxsAlgorithm;\n// labyrinthos.mazes.VoronoiDiagram = VoronoiDiagram;\n\nlabyrinthos.shapes = {};\nlabyrinthos.shapes.Circle = _Circle[\"default\"];\nlabyrinthos.shapes.Square = _Square[\"default\"];\n// labyrinthos.shapes.Hexagon = Hexagon;\nlabyrinthos.shapes.Triangle = _Triangle[\"default\"];\nlabyrinthos.terrains = {};\n// labyrinthos.terrains.DiamondSquare = DiamondSquare;\nlabyrinthos.terrains.FaultLine = _FaultLine[\"default\"];\nlabyrinthos.terrains.PerlinNoise = _PerlinNoise[\"default\"];\nlabyrinthos.utils = {};\nlabyrinthos.utils.noise = _noise[\"default\"];\n// labyrinthos.utils.mapImageToTileMap = mapImageToTileMap;\n\nlabyrinthos.Biome = _Biome[\"default\"];\nlabyrinthos.LSystem = _LSystem[\"default\"];\nlabyrinthos.Tile = _Tile[\"default\"];\nlabyrinthos.TileMap = _TileMap[\"default\"];\nlabyrinthos.TileSet = _TileSet[\"default\"];\nvar _default = exports[\"default\"] = labyrinthos;\n\n},{\"./Biome.js\":2,\"./LSystem.js\":3,\"./Tile.js\":4,\"./TileMap.js\":5,\"./TileSet.js\":6,\"./mazes/AldousBroder.js\":8,\"./mazes/AldousBroder3D.js\":9,\"./mazes/BeattieSchoberth.js\":10,\"./mazes/BinaryTree.js\":11,\"./mazes/CellularAutomata.js\":12,\"./mazes/EllersAlgorithm.js\":13,\"./mazes/GrowingTree.js\":14,\"./mazes/Metroidvania.js\":15,\"./mazes/RecursiveBacktrack.js\":16,\"./mazes/RecursiveDivision.js\":17,\"./mazes/ThomasHunter.js\":18,\"./shapes/Circle.js\":19,\"./shapes/Square.js\":20,\"./shapes/Triangle.js\":21,\"./terrains/FaultLine.js\":22,\"./terrains/PerlinNoise.js\":23,\"./util/noise.js\":27}],8:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = ALGORITHM_ALDOUS_BRODER;\n// AldousBroder.js - Marak Squires 2024\n// \"Aldous-Broder algorithm\" - https://en.wikipedia.org/wiki/Maze_generation_algorithm#Aldous-Broder_algorithm\nfunction ALGORITHM_ALDOUS_BRODER(tileMap, options) {\n tileMap.fill(1); // Fill with walls\n var visitedCells = 0;\n var totalCells = tileMap.width * tileMap.height / 4; // Assumes a grid where every other cell is open\n var currentX = 2 * Math.floor(tileMap.random() * Math.floor(tileMap.width / 2));\n var currentY = 2 * Math.floor(tileMap.random() * Math.floor(tileMap.height / 2));\n tileMap.data[currentY * tileMap.width + currentX] = 0; // Open starting cell\n visitedCells++;\n while (visitedCells < totalCells) {\n var directions = [[2, 0], [-2, 0], [0, 2], [0, -2]];\n var randomDirection = directions[Math.floor(tileMap.random() * directions.length)];\n var newX = currentX + randomDirection[0];\n var newY = currentY + randomDirection[1];\n if (newX >= 0 && newX < tileMap.width && newY >= 0 && newY < tileMap.height) {\n if (tileMap.data[newY * tileMap.width + newX] === 1) {\n // Open path between current cell and new cell\n tileMap.data[(currentY + randomDirection[1] / 2) * tileMap.width + (currentX + randomDirection[0] / 2)] = 0;\n tileMap.data[newY * tileMap.width + newX] = 0; // Open new cell\n visitedCells++;\n }\n currentX = newX;\n currentY = newY;\n }\n }\n}\n\n},{}],9:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = ALGORITHM_ALDOUS_BRODER_3D;\n// AldousBroder3D.js - Marak Squires 2024\n// \"Aldous-Broder algorithm\" - https://en.wikipedia.org/wiki/Maze_generation_algorithm#Aldous-Broder_algorithm\nfunction ALGORITHM_ALDOUS_BRODER_3D(tileMap, options) {\n tileMap.fill(1); // Fill with walls\n var visitedCells = 0;\n var totalCells = tileMap.width * tileMap.height * tileMap.depth / 8; // Assumes a grid where every other cell is open in 3D\n var currentX = 2 * Math.floor(Math.random() * Math.floor(tileMap.width / 2));\n var currentY = 2 * Math.floor(Math.random() * Math.floor(tileMap.height / 2));\n var currentZ = 2 * Math.floor(Math.random() * Math.floor(tileMap.depth / 2));\n tileMap.data[currentZ][currentY * tileMap.width + currentX] = 0; // Open starting cell\n visitedCells++;\n while (visitedCells < totalCells) {\n var directions = [[2, 0, 0], [-2, 0, 0], [0, 2, 0], [0, -2, 0], [0, 0, 2], [0, 0, -2]];\n var randomDirection = directions[Math.floor(Math.random() * directions.length)];\n var newX = currentX + randomDirection[0];\n var newY = currentY + randomDirection[1];\n var newZ = currentZ + randomDirection[2];\n if (newX >= 0 && newX < tileMap.width && newY >= 0 && newY < tileMap.height && newZ >= 0 && newZ < tileMap.depth) {\n if (tileMap.data[newZ][newY * tileMap.width + newX] === 1) {\n // Open path between current cell and new cell\n tileMap.data[currentZ + randomDirection[2] / 2][(currentY + randomDirection[1] / 2) * tileMap.width + (currentX + randomDirection[0] / 2)] = 0;\n tileMap.data[newZ][newY * tileMap.width + newX] = 0; // Open new cell\n visitedCells++;\n }\n currentX = newX;\n currentY = newY;\n currentZ = newZ;\n }\n }\n}\n\n},{}],10:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.BeattieSchoberthBuilder = exports.BeattieSchoberth = void 0;\nexports[\"default\"] = ALGORITHM_BEATTIE_SCHOBERTH;\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * Originally written for a game called \"Isolated\" in collaboration with Andrew Beattie and Greg Schoberth\n *\n * Originally written on June 12, 2013\n * Originally hosted at https://github.com/PhobosRising/javascript-roguelike-map-generator\n */\n\nvar MAX_X = 201;\nvar MAX_Y = 201;\nvar DIR = ['n', 'e', 's', 'w'];\n\n//const rand = require('../../utility/random/index.js');\nvar BeattieSchoberth = exports.BeattieSchoberth = /*#__PURE__*/function () {\n function BeattieSchoberth(_ref) {\n var rooms = _ref.rooms,\n keys = _ref.keys;\n _classCallCheck(this, BeattieSchoberth);\n this.maxRooms = rooms;\n this.maxKeys = keys;\n if (this.maxRooms < 2) {\n console.error(\"Room count \".concat(this.maxRooms, \" needs to be at least two (entrance and exit).\"));\n this.maxRooms = 2;\n }\n if (this.maxKeys > this.maxRooms - 2) {\n console.error(\"Key count \".concat(this.maxKeys, \" is greater than rooms \").concat(this.maxRooms, \" minus two (entrance and exit). Reducing keys by two.\"));\n this.maxKeys = this.maxRooms - 2;\n }\n this.build = this.generate;\n this.reset();\n }\n _createClass(BeattieSchoberth, [{\n key: \"render\",\n value: function render() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var bld = arguments.length > 1 ? arguments[1] : undefined;\n var NULL_KEY = '\\x1b[1;37m';\n var ENTER_EXIT = '\\x1b[7m';\n var KEY_COLORS = {\n 0: '\\x1b[1;31m' || options['0'],\n 1: '\\x1b[1;32m' || options['1'],\n 2: '\\x1b[1;34m' || options['2'],\n 3: '\\x1b[1;33m' || options['3'],\n 4: '\\x1b[1;35m' || options['4'],\n 5: '\\x1b[1;36m' || options['5']\n };\n var generated = bld || this.generate();\n var grid = generated.grid;\n var result = '';\n for (var y = 0; y < generated.size.height; y++) {\n var row1 = ''; // room numbers and hyphens\n var row2 = ''; // pipes\n for (var x = 0; x < generated.size.width; x++) {\n var roomId = grid[y][x];\n var room = generated.rooms[roomId];\n if (!room) {\n row1 += ' ';\n row2 += ' ';\n continue;\n }\n var color = KEY_COLORS[room.keyInRoom] || NULL_KEY;\n if (room.entrance || room.exit) {\n color = ENTER_EXIT;\n }\n row1 += color + String(roomId).padStart(3, '0') + '\\x1b[0m';\n //row1 += colors[color](String(roomId).padStart(3, '0'));\n\n if (room.doors.e !== null) {\n var door = generated.doors[room.doors.e];\n var _color = KEY_COLORS[door.key] || NULL_KEY;\n //row1 += colors[color]('-');\n row1 += _color + '-' + '\\x1b[0m';\n } else {\n row1 += ' ';\n }\n if (room.doors.s !== null) {\n var _door = generated.doors[room.doors.s];\n var _color2 = KEY_COLORS[_door.key] || NULL_KEY;\n //row2 += colors[color](' | ');\n row2 += _color2 + ' | ' + '\\x1b[0m';\n } else {\n row2 += ' ';\n }\n }\n result += row1 + '\\n';\n result += row2 + '\\n';\n }\n return result;\n }\n }, {\n key: \"reset\",\n value: function reset() {\n this.rooms = [];\n this.doors = [];\n this.keys = [];\n\n // Room IDs\n this.entrance = 0;\n this.exit = null;\n this.seed = {\n x: Math.floor(MAX_X / 2),\n y: Math.floor(MAX_Y / 2)\n };\n\n // Keeps track of the edges of the map\n // Useful to shrink map when done\n this.bounds = {\n n: this.seed.y,\n e: this.seed.x,\n s: this.seed.y,\n w: this.seed.x\n };\n\n // Keeps track of the room which is the furthest in any direction\n // Rooms are tracked based on their coordinate tangential to that direction\n // This lets us add rooms without iteratively 'sliding' them in from the outside\n this.furthest = {\n n: new Map(),\n // X => roomId\n e: new Map(),\n // Y => roomId\n s: new Map(),\n // X => roomId\n w: new Map() // Y => roomId\n };\n this.lockPool = new Map();\n this.maxDistance = 0;\n }\n }, {\n key: \"generate\",\n value: function generate(random) {\n this.random = random ? random : function () {\n return Math.random();\n };\n this.reset();\n\n /*const root = */\n this.addRoom(this.seed.x, this.seed.y);\n for (var i = 0; i < this.maxRooms - 1; i++) {\n var dir = DIR[Math.floor(random() * DIR.length)]; // Which direction are we adding a room from\n\n var x = void 0,\n y = void 0,\n parentRoom = void 0;\n if (dir === 'n') {\n // Sliding southward from north\n x = Math.floor(random() * (this.bounds.e - this.bounds.w)) + this.bounds.w;\n var parentRoomId = this.furthest.n.get(x);\n parentRoom = this.rooms[parentRoomId];\n y = parentRoom.y - 1;\n } else if (dir === 'e') {\n // Sliding westward from east\n y = Math.floor(random() * (this.bounds.s - this.bounds.n)) + this.bounds.n;\n var _parentRoomId = this.furthest.e.get(y);\n parentRoom = this.rooms[_parentRoomId];\n x = parentRoom.x + 1;\n } else if (dir === 's') {\n // Sliding northward from south\n x = Math.floor(random() * (this.bounds.e - this.bounds.w)) + this.bounds.w;\n var _parentRoomId2 = this.furthest.s.get(x);\n parentRoom = this.rooms[_parentRoomId2];\n y = parentRoom.y + 1;\n } else if (dir === 'w') {\n // Sliding eastward from west\n y = Math.floor(random() * (this.bounds.s - this.bounds.n)) + this.bounds.n;\n var _parentRoomId3 = this.furthest.w.get(y);\n parentRoom = this.rooms[_parentRoomId3];\n x = parentRoom.x - 1;\n }\n var newRoomId = this.addRoom(x, y);\n /*const d = */\n this.addDoor(parentRoom.id, newRoomId);\n }\n var CHILD_THRESHOLD = this.rooms.length / (this.maxKeys + 1);\n var lockedRoom = this.getHighestDistanceRoom();\n var roomToBeLocked = lockedRoom.id;\n this.setExit(roomToBeLocked);\n for (var _i = 0; _i < this.maxKeys; _i++) {\n var ascended = this.findRoomParentWithAtMostChildren(this.rooms[roomToBeLocked], CHILD_THRESHOLD);\n if (!ascended) {\n console.error('exhausted possible lockable rooms! giving up.');\n break;\n }\n this.removeRoomAndChildrenFromLockPool(ascended);\n this.decrementChildrenCountAllParents(ascended);\n var roomToPutKeyIn = this.getHighestDistanceRoom();\n if (!roomToPutKeyIn) {\n console.error('Cannot find a room to put a key in! Cancelling lock. Level should still be beatable.');\n break;\n }\n this.lock(ascended.id - 1, roomToPutKeyIn.id); // TODO: HACK: door between room and parent has ID of parentId - 1\n\n roomToBeLocked = roomToPutKeyIn.id;\n }\n var _this$squish = this.squish(),\n width = _this$squish.width,\n height = _this$squish.height;\n var grid = this.generateGrid(width, height);\n this.classifyRooms();\n return {\n size: {\n width: width,\n height: height\n },\n terminals: {\n entrance: this.entrance,\n exit: this.exit,\n deadends: this.deadends\n },\n //rooms: this.rooms,\n rooms: this.rooms.map(function (r) {\n // Hide internal data structures from outside world\n delete r.children;\n delete r.childrenCount;\n delete r.parent;\n return r;\n }),\n doors: this.doors.map(function (d) {\n d.rooms = d.rooms.map(function (r) {\n return r.id;\n });\n return d;\n }),\n keys: this.keys,\n grid: grid\n };\n }\n\n /**\n * Shrink the boundaries of the map\n * Set a new X/Y for every room\n * @return smallest {width,height} required to fit map\n */\n }, {\n key: \"squish\",\n value: function squish() {\n var width = this.bounds.e - this.bounds.w + 1;\n var height = this.bounds.s - this.bounds.n + 1;\n var xShift = this.bounds.w;\n var yShift = this.bounds.n;\n var _iterator = _createForOfIteratorHelper(this.rooms),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var room = _step.value;\n room.x -= xShift;\n room.y -= yShift;\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return {\n width: width,\n height: height\n };\n }\n }, {\n key: \"addRoom\",\n value: function addRoom(x, y) {\n var roomId = this.rooms.length;\n this.stretch(x, y);\n this.further(x, y, roomId);\n var room = {\n id: roomId,\n x: x,\n y: y,\n children: new Set(),\n childrenCount: 0,\n parent: null,\n keyInRoom: null,\n template: 'F1',\n distance: roomId === 0 ? 0 : null,\n // Distance from room[0] / spawn\n exit: false,\n entrance: roomId === 0,\n doors: {\n n: null,\n e: null,\n s: null,\n w: null\n }\n };\n this.rooms.push(room);\n return roomId;\n }\n }, {\n key: \"further\",\n value: function further(x, y, roomId) {\n var mostNorth = this.furthest.n.get(x);\n if (typeof mostNorth === 'undefined' || this.rooms[mostNorth].y > y) {\n this.furthest.n.set(x, roomId);\n }\n var mostEast = this.furthest.e.get(y);\n if (typeof mostEast === 'undefined' || this.rooms[mostEast].x < x) {\n this.furthest.e.set(y, roomId);\n }\n var mostSouth = this.furthest.s.get(x);\n if (typeof mostSouth === 'undefined' || this.rooms[mostSouth].y < y) {\n this.furthest.s.set(x, roomId);\n }\n var mostWest = this.furthest.w.get(y);\n if (typeof mostWest === 'undefined' || this.rooms[mostWest].x > x) {\n this.furthest.w.set(y, roomId);\n }\n }\n }, {\n key: \"stretch\",\n value: function stretch(x, y) {\n if (y < this.bounds.n) {\n this.bounds.n = y;\n }\n if (x > this.bounds.e) {\n this.bounds.e = x;\n }\n if (y > this.bounds.s) {\n this.bounds.s = y;\n }\n if (x < this.bounds.w) {\n this.bounds.w = x;\n }\n }\n }, {\n key: \"classifyRooms\",\n value: function classifyRooms() {\n this.deadends = [];\n var _iterator2 = _createForOfIteratorHelper(this.rooms),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var room = _step2.value;\n var doors = 0;\n if (room.doors.n !== null) doors++;\n if (room.doors.e !== null) doors++;\n if (room.doors.s !== null) doors++;\n if (room.doors.w !== null) doors++;\n if (doors === 1) {\n // D (Dead End)\n this.deadends.push(room.id);\n if (room.doors.n !== null) {\n room.template = 'D1';\n } else if (room.doors.e !== null) {\n room.template = 'D2';\n } else if (room.doors.s !== null) {\n room.template = 'D3';\n } else if (room.doors.w !== null) {\n room.template = 'D4';\n }\n } else if (doors === 2) {\n // B (Bend) or C (Corridoor)\n if (room.doors.n !== null && room.doors.s !== null) {\n room.template = 'C1';\n } else if (room.doors.e !== null && room.doors.w !== null) {\n room.template = 'C2';\n } else if (room.doors.n !== null && room.doors.e !== null) {\n room.template = 'B1';\n } else if (room.doors.e !== null && room.doors.s !== null) {\n room.template = 'B2';\n } else if (room.doors.s !== null && room.doors.w !== null) {\n room.template = 'B3';\n } else if (room.doors.w !== null && room.doors.n !== null) {\n room.template = 'B4';\n }\n } else if (doors === 3) {\n // E\n if (room.doors.s === null) {\n room.template = 'E1';\n } else if (room.doors.w === null) {\n room.template = 'E2';\n } else if (room.doors.n === null) {\n room.template = 'E3';\n } else if (room.doors.e === null) {\n room.template = 'E4';\n }\n } else if (doors === 4) {\n // A (All)\n room.template = 'A1';\n } else {\n // F (Fucked)\n room.template = 'F1';\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n\n /**\n * @param rooms Array of two door IDs\n *\n * @return doorId\n */\n }, {\n key: \"addDoor\",\n value: function addDoor(parentRoomId, childRoomId) {\n var parentRoom = this.rooms[parentRoomId];\n var childRoom = this.rooms[childRoomId];\n var doorId = this.doors.length;\n var orientation = null;\n if (parentRoom.x === childRoom.x && parentRoom.y === childRoom.y - 1) {\n // R1 north of R2\n orientation = 'v';\n parentRoom.doors.s = doorId;\n childRoom.doors.n = doorId;\n } else if (parentRoom.x === childRoom.x + 1 && parentRoom.y === childRoom.y) {\n // R1 east of R2\n orientation = 'h';\n parentRoom.doors.w = doorId;\n childRoom.doors.e = doorId;\n } else if (parentRoom.x === childRoom.x && parentRoom.y === childRoom.y + 1) {\n // R1 south of R2\n orientation = 'v';\n parentRoom.doors.n = doorId;\n childRoom.doors.s = doorId;\n } else if (parentRoom.x === childRoom.x - 1 && parentRoom.y === childRoom.y) {\n // R1 west of R2\n orientation = 'h';\n parentRoom.doors.e = doorId;\n childRoom.doors.w = doorId;\n } else {\n throw new Error('Rooms must be adjacent');\n }\n parentRoom.children.add(childRoom);\n childRoom.distance = parentRoom.distance + 1;\n childRoom.parent = parentRoom;\n this.increaseChildrenCountAllParents(childRoom);\n this.registerRoomDistanceLockPool(childRoom.id);\n this.doors.push({\n id: doorId,\n key: null,\n orientation: orientation,\n exit: false,\n rooms: [parentRoom, childRoom]\n });\n return doorId;\n }\n }, {\n key: \"increaseChildrenCountAllParents\",\n value: function increaseChildrenCountAllParents(room) {\n //eslint-disable-next-line no-cond-assign\n while (room = room.parent) {\n room.childrenCount++;\n }\n }\n }, {\n key: \"registerRoomDistanceLockPool\",\n value: function registerRoomDistanceLockPool(roomId) {\n var room = this.rooms[roomId];\n var distance = room.distance;\n if (!this.lockPool.get(distance)) {\n this.lockPool.set(distance, new Set());\n }\n this.lockPool.get(distance).add(room);\n if (distance > this.maxDistance) {\n this.maxDistance = distance;\n }\n }\n }, {\n key: \"removeFromLockPool\",\n value: function removeFromLockPool(room) {\n var distance = room.distance;\n var pool = this.lockPool.get(distance);\n if (!pool) {\n console.error(\"no pool of depth \".concat(distance));\n return;\n }\n pool[\"delete\"](room);\n\n //if (pool.size === 0) {\n //console.log('pool is now empty, removing pool');\n //console.log(`this should be deepest room total! my: ${distance}, max: ${this.maxDistance}`);\n //this.lockPool.delete(pool);\n ////this.maxDistance--; // get removed out of order\n //}\n }\n }, {\n key: \"getHighestDistanceRoom\",\n value: function getHighestDistanceRoom() {\n // TODO: This is slow, iterates every distance pool\n for (var i = this.maxDistance; i > 0; i--) {\n var collection = this.lockPool.get(i);\n if (!collection.size) {\n continue;\n }\n var item = collection.values().next().value;\n return item;\n }\n return null;\n }\n }, {\n key: \"findRoomParentWithAtMostChildren\",\n value: function findRoomParentWithAtMostChildren(room, count) {\n if (!room) {\n throw new Error('bad room');\n }\n var parent;\n //eslint-disable-next-line no-cond-assign\n while (parent = room.parent) {\n if (parent.childrenCount + 1 > count) {\n return room;\n }\n room = parent;\n }\n return room;\n }\n }, {\n key: \"decrementChildrenCountAllParents\",\n value: function decrementChildrenCountAllParents(room) {\n var decrementCount = room.childrenCount + 1;\n while (room) {\n room.childrenCount -= decrementCount;\n room = room.parent;\n }\n }\n }, {\n key: \"removeRoomAndChildrenFromLockPool\",\n value: function removeRoomAndChildrenFromLockPool(room) {\n this.removeFromLockPool(room);\n var _iterator3 = _createForOfIteratorHelper(room.children),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var child = _step3.value;\n this.removeFromLockPool(child);\n this.removeRoomAndChildrenFromLockPool(child);\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n }\n\n /**\n * Locks a door, putting the key in the specified room\n * @return keyId\n */\n }, {\n key: \"lock\",\n value: function lock(doorId, roomId) {\n var door = this.doors[doorId];\n var location = this.rooms[roomId];\n var keyId = this.keys.length;\n if (!door) {\n throw new Error(\"Invalid door \".concat(doorId));\n }\n if (!location) {\n throw new Error(\"Invalid room \".concat(roomId));\n }\n this.keys.push({\n id: keyId,\n location: location.id,\n door: doorId\n });\n this.doors[doorId].key = keyId;\n location.keyInRoom = keyId;\n return keyId;\n }\n\n /**\n * Generates a 2D array of Room IDs\n * Makes it easier for games to visualize the map\n */\n }, {\n key: \"generateGrid\",\n value: function generateGrid(width, height) {\n var grid = [];\n for (var y = 0; y < height; y++) {\n var row = [];\n for (var x = 0; x < width; x++) {\n row.push(null);\n }\n grid.push(row);\n }\n var self = this;\n function addRoomToGrid(roomId) {\n var room = self.rooms[roomId];\n grid[room.y][room.x] = room.id;\n var _iterator4 = _createForOfIteratorHelper(room.children),\n _step4;\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var child = _step4.value;\n addRoomToGrid(child.id);\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n }\n addRoomToGrid(0);\n return grid;\n }\n }, {\n key: \"setExit\",\n value: function setExit(roomId) {\n var room = this.rooms[roomId];\n if (!room) {\n throw new Error(\"invalid room id \".concat(roomId));\n }\n room.exit = true;\n if (room.doors.n !== null) this.doors[room.doors.n].exit = true;\n if (room.doors.e !== null) this.doors[room.doors.e].exit = true;\n if (room.doors.s !== null) this.doors[room.doors.s].exit = true;\n if (room.doors.w !== null) this.doors[room.doors.w].exit = true;\n this.exit = roomId;\n }\n }]);\n return BeattieSchoberth;\n}();\nvar TILE = {\n VOID: 0,\n FLOOR: 1,\n WALL: 2,\n DOOR: 3,\n SPECIAL_DOOR: 4,\n ENTER: 5,\n EXIT: 6\n};\nvar toCharGrid = function toCharGrid() {\n var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n return string.split('\\n').map(function (line) {\n return line.split('');\n });\n};\nvar Grid = /*#__PURE__*/function () {\n function Grid() {\n var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n _classCallCheck(this, Grid);\n this.grid = toCharGrid(str);\n }\n _createClass(Grid, [{\n key: \"overlay\",\n value: function overlay(subgrid, y, x) {\n var grid = Array.isArray(subgrid) ? subgrid : toCharGrid(subgrid);\n for (var row = 0; row < grid.length; row++) {\n for (var col = 0; col < grid[row].length; col++) {\n if (!this.grid[x + row]) this.grid[x + row] = [];\n this.grid[x + row][y + col] = grid[row][col];\n }\n }\n }\n }, {\n key: \"fill\",\n value: function fill(tile, max_width, max_height) {\n for (var y = 0; y < max_height; y++) {\n this.grid[y] = [];\n for (var x = 0; x < max_width; x++) {\n this.grid[y][x] = tile;\n }\n }\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return this.grid.map(function (chars) {\n return chars.join('');\n }).join('\\n');\n }\n }]);\n return Grid;\n}();\nvar BeattieSchoberthBuilder = exports.BeattieSchoberthBuilder = /*#__PURE__*/function () {\n function BeattieSchoberthBuilder() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, BeattieSchoberthBuilder);\n this.adventure = new BeattieSchoberth(config);\n this.options = config;\n this.max_height = config.maxHeight;\n this.max_width = config.maxWidth;\n }\n _createClass(BeattieSchoberthBuilder, [{\n key: \"renderWorld\",\n value: function renderWorld() {\n var _this = this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var blt = arguments.length > 1 ? arguments[1] : undefined;\n var opt = function opt(name) {\n return options[name] || _this.options[name];\n };\n var width = opt('width');\n var height = opt('height');\n var roomWidth = opt('roomWidth');\n var roomHeight = opt('roomHeight');\n var built = blt || this.build();\n var generated = built;\n var grid = generated.grid;\n var output = new Grid();\n var rendered = null;\n output.fill(TILE.VOID, width, height);\n for (var y = 0; y < generated.size.height; y++) {\n for (var x = 0; x < generated.size.width; x++) {\n var roomId = grid[y][x];\n var room = generated.rooms[roomId];\n if (room) {\n rendered = this.buildRoom({\n doors: room.doors\n });\n } else {\n rendered = this.emptyRoom({});\n }\n output.overlay(rendered, x * roomWidth, y * roomHeight);\n }\n }\n return output.grid;\n }\n }, {\n key: \"buildRoom\",\n value: function buildRoom() {\n var _this2 = this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var inDoorRange = function inDoorRange(n, max, range) {\n var half = Math.floor(max / 2);\n var odd = !!(max % 2);\n var halfRange = Math.floor(range / 2);\n if (odd) {\n if (n === half && range) {\n //in center\n return true;\n } else {\n if (n < half) {\n return n > half - halfRange;\n } else {\n return n < half + halfRange;\n }\n }\n } else {\n if (n <= half) {\n return n >= half - halfRange;\n } else {\n return n < half + halfRange;\n }\n }\n };\n var opt = function opt(name) {\n return options[name] || _this2.options[name];\n };\n var width = opt('roomWidth');\n var height = opt('roomHeight');\n var lines = [];\n for (var y = 0; y < height; y++) {\n var row = [];\n for (var x = 0; x < width; x++) {\n if (x === 0 || x === width - 1) {\n //TODO: doors\n if (x === 0) {\n if (options.doors.w && inDoorRange(y, height, 2)) {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.WALL);\n }\n } else {\n if (options.doors.e && inDoorRange(y, height, 2)) {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.WALL);\n }\n }\n } else {\n if (y === 0 || y === height - 1) {\n if (y === 0) {\n if (options.doors.n && inDoorRange(x, width, 2)) {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.WALL);\n }\n } else {\n if (options.doors.s && inDoorRange(x, width, 2)) {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.WALL);\n }\n }\n } else {\n row.push(TILE.FLOOR);\n }\n }\n }\n lines.push(row);\n }\n return lines;\n }\n }, {\n key: \"emptyRoom\",\n value: function emptyRoom() {\n var _this3 = this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var opt = function opt(name) {\n return options[name] || _this3.options[name];\n };\n var width = opt('roomWidth');\n var height = opt('roomHeight');\n var result = [];\n for (var y = 0; y < height; y++) {\n var row = [];\n for (var x = 0; x < width; x++) {\n row.push(TILE.VOID);\n }\n result.push(row);\n }\n return result;\n }\n }, {\n key: \"build\",\n value: function build(rand) {\n var adventureBuild = this.adventure.build(rand);\n adventureBuild.world = this.renderWorld({}, adventureBuild);\n return adventureBuild;\n }\n }]);\n return BeattieSchoberthBuilder;\n}();\nfunction ALGORITHM_BEATTIE_SCHOBERTH(tileMap, options) {\n var fractional = Math.floor(Math.sqrt(Math.max(tileMap.width, tileMap.height)));\n var builder = new BeattieSchoberthBuilder({\n rooms: fractional * 2,\n keys: 3,\n special: 2,\n width: tileMap.width,\n height: tileMap.height,\n roomHeight: options.roomHeight || fractional,\n roomWidth: options.roomWidth || fractional\n });\n var built = builder.build(function () {\n return tileMap.random();\n });\n var flattened = built.world.reduce(function (agg, line) {\n return agg.concat(line);\n }, []);\n built.world = null;\n for (var lcv = 0; lcv < tileMap.data.length; lcv++) {\n tileMap.data[lcv] = flattened[lcv];\n }\n tileMap.world = built;\n}\n\n},{}],11:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = ALGORITHM_BINARY_TREE;\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction ALGORITHM_BINARY_TREE(tileMap, options) {\n tileMap.fill(1); // Fill with walls\n\n for (var y = 0; y < tileMap.height; y += 2) {\n for (var x = 0; x < tileMap.width; x += 2) {\n tileMap.data[y * tileMap.width + x] = 0; // Open cell\n\n var neighbors = [];\n if (x + 2 < tileMap.width) neighbors.push([2, 0]); // East\n if (y + 2 < tileMap.height) neighbors.push([0, 2]); // South\n\n if (neighbors.length > 0) {\n var randomIndex = Math.floor(tileMap.random() * neighbors.length);\n var _neighbors$randomInde = _slicedToArray(neighbors[randomIndex], 2),\n dx = _neighbors$randomInde[0],\n dy = _neighbors$randomInde[1];\n tileMap.data[(y + dy) * tileMap.width + (x + dx)] = 0; // Open path to the selected neighbor\n tileMap.data[(y + dy / 2) * tileMap.width + (x + dx / 2)] = 0; // Open wall between current cell and selected neighbor\n }\n }\n }\n}\n\n},{}],12:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generateCellularAutomataMap;\n// CellularAutomata.js - Marak Squires 2024\nfunction generateCellularAutomataMap(tileMap, options) {\n var floorTileId = 1;\n var wallTileId = 0;\n var wallChance = options.wallChance || 0.45;\n var iterations = options.iterations || 4;\n var neighborThreshold = options.neighborThreshold || 4;\n\n // Randomly initialize map\n for (var y = 0; y < tileMap.height; y++) {\n for (var x = 0; x < tileMap.width; x++) {\n tileMap.data[y * tileMap.width + x] = tileMap.random() < wallChance ? wallTileId : floorTileId;\n }\n }\n\n // Cellular automata iteration\n for (var i = 0; i < iterations; i++) {\n var newData = new Array(tileMap.width * tileMap.height).fill(floorTileId);\n for (var _y = 0; _y < tileMap.height; _y++) {\n for (var _x = 0; _x < tileMap.width; _x++) {\n var wallNeighbors = 0;\n for (var dy = -1; dy <= 1; dy++) {\n for (var dx = -1; dx <= 1; dx++) {\n if (dx === 0 && dy === 0) continue;\n var nx = _x + dx;\n var ny = _y + dy;\n if (nx >= 0 && nx < tileMap.width && ny >= 0 && ny < tileMap.height) {\n wallNeighbors += tileMap.data[ny * tileMap.width + nx] === wallTileId ? 1 : 0;\n } else {\n wallNeighbors++;\n }\n }\n }\n newData[_y * tileMap.width + _x] = wallNeighbors >= neighborThreshold ? wallTileId : floorTileId;\n }\n }\n tileMap.data = newData;\n }\n}\n\n},{}],13:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generateEllersAlgorithmMap;\n// EllersAlgorithm.js - Marak Squires 2024\nfunction generateEllersAlgorithmMap(tileMap, options) {\n var floorTileId = 1;\n var wallTileId = 0;\n tileMap.data.fill(wallTileId);\n var sets = {};\n function makeSet(x, y) {\n var id = \"\".concat(x, \",\").concat(y);\n sets[id] = {\n id: id,\n cells: [id]\n };\n return sets[id];\n }\n function findSet(x, y) {\n var id = \"\".concat(x, \",\").concat(y);\n return sets[id] || makeSet(x, y);\n }\n function unionSets(x1, y1, x2, y2) {\n var set1 = findSet(x1, y1);\n var set2 = findSet(x2, y2);\n if (set1.id === set2.id) return;\n\n // Merge two sets\n set2.cells.forEach(function (cellId) {\n set1.cells.push(cellId);\n sets[cellId] = set1;\n });\n }\n for (var y = 0; y < tileMap.height; y += 2) {\n // Join cells horizontally\n for (var x = 0; x < tileMap.width - 2; x += 2) {\n if (tileMap.random() > 0.5) {\n unionSets(x, y, x + 2, y);\n tileMap.data[y * tileMap.width + x + 1] = floorTileId;\n }\n }\n\n // Join cells vertically\n if (y < tileMap.height - 2) {\n var setVisited = {};\n for (var _x = 0; _x < tileMap.width; _x += 2) {\n var currentSet = findSet(_x, y).id;\n if (!setVisited[currentSet] && tileMap.random() > 0.5) {\n unionSets(_x, y, _x, y + 2);\n tileMap.data[(y + 1) * tileMap.width + _x] = floorTileId;\n setVisited[currentSet] = true;\n }\n }\n }\n }\n\n // Ensure all paths are connected in the last row\n for (var _x2 = 0; _x2 < tileMap.width - 2; _x2 += 2) {\n if (findSet(_x2, tileMap.height - 1).id !== findSet(_x2 + 2, tileMap.height - 1).id) {\n unionSets(_x2, tileMap.height - 1, _x2 + 2, tileMap.height - 1);\n tileMap.data[(tileMap.height - 1) * tileMap.width + _x2 + 1] = floorTileId;\n }\n }\n}\n\n},{}],14:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generateGrowingTreeAlgorithmMap;\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction generateGrowingTreeAlgorithmMap(tileMap, options) {\n var floorTileId = 1; // Open cell\n var wallTileId = 0; // Wall\n\n tileMap.data.fill(wallTileId); // Initialize all tiles as walls\n\n // Function to carve a passage between two points\n function carvePassage(x1, y1, x2, y2) {\n tileMap.data[y1 * tileMap.width + x1] = floorTileId;\n // Carve passage to the next cell (midpoint for the wall and the cell itself)\n tileMap.data[Math.floor((y1 + y2) / 2) * tileMap.width + Math.floor((x1 + x2) / 2)] = floorTileId;\n tileMap.data[y2 * tileMap.width + x2] = floorTileId;\n }\n var currentX = Math.floor(tileMap.random() * tileMap.width);\n var currentY = Math.floor(tileMap.random() * tileMap.height);\n var cellsStack = [[currentX, currentY]]; // Start with a single cell in stack\n var _loop = function _loop() {\n var _cellsStack = _slicedToArray(cellsStack[cellsStack.length - 1], 2),\n cx = _cellsStack[0],\n cy = _cellsStack[1]; // Use the latest cell\n var neighbors = [];\n\n // Directions: N, S, E, W\n var directions = [[0, -2], [0, 2], [2, 0], [-2, 0]];\n directions.forEach(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n dx = _ref2[0],\n dy = _ref2[1];\n var nx = cx + dx,\n ny = cy + dy;\n if (nx >= 0 && nx < tileMap.width && ny >= 0 && ny < tileMap.height && tileMap.data[ny * tileMap.width + nx] === wallTileId) {\n neighbors.push([nx, ny]);\n }\n });\n if (neighbors.length > 0) {\n var randomIndex = Math.floor(tileMap.random() * neighbors.length);\n var _neighbors$randomInde = _slicedToArray(neighbors[randomIndex], 2),\n nextX = _neighbors$randomInde[0],\n nextY = _neighbors$randomInde[1];\n carvePassage(cx, cy, nextX, nextY);\n cellsStack.push([nextX, nextY]);\n } else {\n cellsStack.pop(); // No neighbors found, backtrack\n }\n };\n while (cellsStack.length > 0) {\n _loop();\n }\n}\n\n},{}],15:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = ALGORITHM_METROIDVANIA;\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * Metroidvania.js - Abbey Hawk Sparrow 2024\n * Originally written by Thomas Hunter II\n *\n * Originally written on June 12, 2013\n * Originally hosted at https://github.com/PhobosRising/javascript-roguelike-map-generator\n */\n\nvar WALL = 'wall';\nvar DOOR = 'door';\nvar OPEN = 'open';\nvar EXIT = 'exit';\nvar DIRECTIONS = ['n', 'e', 's', 'w'];\nvar TILE = {\n VOID: 0,\n FLOOR: 1,\n WALL: 2,\n DOOR: 3,\n SPECIAL_DOOR: 4,\n ENTER: 5,\n EXIT: 6\n};\nvar toCharGrid = function toCharGrid() {\n var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n return string.split('\\n').map(function (line) {\n return line.split('');\n });\n};\nvar Grid = /*#__PURE__*/function () {\n function Grid() {\n var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n _classCallCheck(this, Grid);\n this.grid = toCharGrid(str);\n }\n _createClass(Grid, [{\n key: \"overlay\",\n value: function overlay(subgrid, y, x) {\n var grid = Array.isArray(subgrid) ? subgrid : toCharGrid(subgrid);\n for (var row = 0; row < grid.length; row++) {\n for (var col = 0; col < grid[row].length; col++) {\n if (!this.grid[x + row]) this.grid[x + row] = [];\n this.grid[x + row][y + col] = grid[row][col];\n }\n }\n }\n }, {\n key: \"fill\",\n value: function fill(tile, max_width, max_height) {\n for (var y = 0; y < max_height; y++) {\n this.grid[y] = [];\n for (var x = 0; x < max_width; x++) {\n this.grid[y][x] = tile;\n }\n }\n }\n }, {\n key: \"toString\",\n value: function toString(incoming) {\n return (incoming || this.grid).map(function (chars) {\n return chars.join('');\n }).join('\\n');\n }\n }]);\n return Grid;\n}();\nvar Metroidvania = /*#__PURE__*/function () {\n function Metroidvania() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, Metroidvania);\n this.options = config;\n }\n _createClass(Metroidvania, [{\n key: \"render\",\n value: function render() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var blt = arguments.length > 1 ? arguments[1] : undefined;\n var built = blt || this.build();\n var world = built.map;\n var result = '';\n // Crude mechanism for drawing level\n for (var y = 0; y < world.length; y++) {\n var row = '';\n for (var x = 0; x < world[y].length; x++) {\n if (world[y][x].edges.e || world[y][x].edges.w || world[y][x].edges.n || world[y][x].edges.s) row += '#';else row += ' ';\n }\n result += row + '\\n';\n //console.log(row + '| ' + y);\n }\n return result;\n }\n }, {\n key: \"build\",\n value: function build(random) {\n this.random = random;\n var data = platformGenerator(this.options, random);\n var grid = new Grid();\n var roomWidth = this.options.roomWidth || 10;\n var roomHeight = this.options.roomHeight || 10;\n grid.fill(TILE.VOID, this.options.gridWidth, this.options.gridHeight);\n for (var col = 0; col < data.rooms.length; col++) {\n for (var row = 0; row < data.rooms[col].length; row++) {\n var location = data.rooms[col][row];\n var roomData = data.map[location.y][location.x];\n var room = buildRoom(roomData, this.options.roomHeight, this.options.roomWidth\n /*{\n room: roomData,\n roomWidth: this.options.roomWidth,\n roomHeight: this.options.roomHeight\n }*/);\n grid.overlay(room, location.x * this.options.roomHeight, location.y * this.options.roomWidth);\n }\n }\n data.world = grid.grid;\n return data;\n }\n }]);\n return Metroidvania;\n}();\nvar inDoorRange = function inDoorRange(n, max, range) {\n var half = Math.floor(max / 2);\n var odd = !!(max % 2);\n var halfRange = Math.floor(range / 2);\n if (odd) {\n if (n === half && range) {\n //in center\n return true;\n } else {\n if (n < half) {\n return n > half - halfRange;\n } else {\n return n < half + halfRange;\n }\n }\n } else {\n if (n <= half) {\n return n >= half - halfRange;\n } else {\n return n < half + halfRange;\n }\n }\n};\nvar buildRoom = function buildRoom() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var roomHeight = arguments.length > 1 ? arguments[1] : undefined;\n var roomWidth = arguments.length > 2 ? arguments[2] : undefined;\n var width = roomHeight;\n var height = roomWidth;\n var lines = [];\n for (var y = 0; y < height; y++) {\n var row = [];\n for (var x = 0; x < width; x++) {\n if (x === 0 || x === width - 1) {\n //TODO: doors\n if (x === 0) {\n if (options.edges.w === 'open') {\n if (y === 0 || y === height - 1) row.push(TILE.WALL);else row.push(TILE.FLOOR);\n } else {\n if ((options.edges.w === 'door' || options.edges.w === 'exit') && inDoorRange(y, height, 2)) {\n if (options.edges.w === 'door') {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.EXIT);\n }\n } else {\n row.push(TILE.WALL);\n }\n }\n } else {\n if (options.edges.e === 'open') {\n if (y === 0 || y === height - 1) row.push(TILE.WALL);else row.push(TILE.FLOOR);\n } else {\n if ((options.edges.e === 'door' || options.edges.e === 'exit') && inDoorRange(y, height, 2)) {\n if (options.edges.e === 'door') {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.EXIT);\n }\n } else {\n row.push(TILE.WALL);\n }\n }\n }\n } else {\n if (y === 0 || y === height - 1) {\n if (y === 0) {\n if (options.edges.n === 'open') {\n row.push(TILE.FLOOR);\n } else {\n if ((options.edges.n === 'door' || options.edges.n === 'exit') && inDoorRange(x, width, 2)) {\n if (options.edges.n === 'door') {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.EXIT);\n }\n } else {\n row.push(TILE.WALL);\n }\n }\n } else {\n if (options.edges.s === 'open') {\n row.push(TILE.FLOOR);\n } else {\n if ((options.edges.s === 'door' || options.edges.s === 'exit') && inDoorRange(x, width, 2)) {\n if (options.edges.s === 'door') {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.EXIT);\n }\n } else {\n row.push(TILE.WALL);\n }\n }\n }\n } else {\n row.push(TILE.FLOOR);\n }\n }\n }\n lines.push(row);\n }\n return lines;\n};\nvar platformGenerator = function platformGenerator() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var random = arguments.length > 1 ? arguments[1] : undefined;\n var MAP_WIDTH = config.width || 20;\n var MAP_HEIGHT = config.height || 20;\n var MIN_ZONES_PER_ROOM = config.minZonesPerRoom || 1;\n var MAX_ZONES_PER_ROOM = config.maxZonesPerRoom || 4;\n var MIN_ROOMS_PER_MAP = config.minRoomsPerMap || 10;\n var MAX_ROOMS_PER_MAP = config.maxRoomsPerMap || 20;\n\n // If we don't get at least this many random doors, start over\n var NEW_DOOR_MIN_THRESHOLD = config.newDoors || 3;\n\n // How this really should work is the odds of creating a door are higher as the room id's get farther apart\n var ROOM_ID_DIFF_RANDOM_DOOR_THRESHOLD = config.roomDiff || 3; // How different should two rooms be?\n var ROOM_ID_DIFF_RANDOM_DOOR_ODDS = config.roomDiffOdds || 1 / 5; // What are the odds we'll act upon this?\n\n var failCount = 0;\n var result = null;\n while (!result) {\n result = build(initialize(MAP_WIDTH, MAP_HEIGHT));\n }\n return result;\n function build(map) {\n // Determin the total number of rooms in the beginning\n var number_of_rooms = rangedRandom(MIN_ROOMS_PER_MAP, MAX_ROOMS_PER_MAP, random);\n\n // The cursor is this special little pointer for the next zone being built\n var cursor = {\n x: Math.floor(MAP_WIDTH / 2),\n y: Math.floor(MAP_WIDTH / 2)\n };\n var exits = {\n n: {\n // negative Y\n x: cursor.x,\n y: cursor.y\n },\n s: {\n // positive Y\n x: cursor.x,\n y: cursor.y\n },\n e: {\n // positive X\n x: cursor.x,\n y: cursor.y\n },\n w: {\n // negative X\n x: cursor.x,\n y: cursor.y\n }\n };\n\n // Each placed zone will have its own id\n var zone_id = 0;\n\n // An array of room id's, and the room locations within it\n var all_room_zones = [];\n\n // Run this loop once per room we're going to build\n for (var room = 0; room < number_of_rooms; room++) {\n // determine the number of zones in this room at the beginning\n var number_of_zones = rangedRandom(MIN_ZONES_PER_ROOM, MAX_ZONES_PER_ROOM, random);\n var zones_in_this_room = [];\n\n // Run this loop once per zone within this room\n for (var zone_number = 0; zone_number < number_of_zones; zone_number++) {\n if (!cursor) {\n return null;\n }\n var zone = map[cursor.y][cursor.x];\n zones_in_this_room.push({\n x: cursor.x,\n y: cursor.y\n });\n zone.open = true;\n zone.room = room;\n zone.zone = zone_id;\n zone_id++;\n if (cursor.x <= exits.w.x) exits.w = cursor;\n if (cursor.x >= exits.e.x) exits.e = cursor;\n if (cursor.y <= exits.n.y) exits.n = cursor;\n if (cursor.y >= exits.s.y) exits.s = cursor;\n cursor = moveCursor(map, cursor, random);\n if (!cursor) {\n // When this happens, we should just instead start building from somewhere else\n //console.log('CURSOR STUCK. Rebuild...');\n failCount++;\n if (config.maxFails && failCount > config.maxFails) throw new Error('Failed too many times to generate this configuration');\n return false;\n }\n }\n\n // Build walls between this room and other rooms / void\n for (var _i = 0, _zones_in_this_room = zones_in_this_room; _i < _zones_in_this_room.length; _i++) {\n var zone_location = _zones_in_this_room[_i];\n buildWallsForZone(map, zone_location);\n }\n all_room_zones[room] = zones_in_this_room;\n\n // Move cursor to an area outside but next to this room, and add door\n if (room != number_of_rooms - 1) {\n cursor = findNakedAdjacent(map, zones_in_this_room, random);\n }\n }\n\n // Lets add some random doors between rooms, otherwise it's too linear\n var new_door_count = 0;\n for (var _i2 = 0, _all_room_zones = all_room_zones; _i2 < _all_room_zones.length; _i2++) {\n var room_zones = _all_room_zones[_i2];\n var _iterator = _createForOfIteratorHelper(room_zones),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var coords = _step.value;\n if (coords.x === 0 || coords.y === 0 || coords.x >= MAP_WIDTH - 1 || coords.y >= MAP_HEIGHT - 1) {\n // Don't attempt to build random doors on extremes. Could be more specific though, doesn't always need to be avoided.\n continue;\n }\n var this_zone = map[coords.y][coords.x];\n var this_room_id = this_zone.room;\n var comparedZone = null;\n\n // South\n comparedZone = map[coords.y + 1][coords.x];\n if (comparedZone.open && Math.abs(comparedZone.room - this_room_id) > ROOM_ID_DIFF_RANDOM_DOOR_THRESHOLD && Math.random() <= ROOM_ID_DIFF_RANDOM_DOOR_ODDS) {\n buildDoorBetweenZones(map, coords, {\n x: coords.x,\n y: coords.y + 1\n });\n new_door_count++;\n }\n\n // North\n comparedZone = map[coords.y - 1][coords.x];\n if (comparedZone.open && Math.abs(comparedZone.room - this_room_id) > ROOM_ID_DIFF_RANDOM_DOOR_THRESHOLD && Math.random() <= ROOM_ID_DIFF_RANDOM_DOOR_ODDS) {\n buildDoorBetweenZones(map, coords, {\n x: coords.x,\n y: coords.y - 1\n });\n new_door_count++;\n }\n\n // West\n comparedZone = map[coords.y][coords.x - 1];\n if (comparedZone.open && Math.abs(comparedZone.room - this_room_id) > ROOM_ID_DIFF_RANDOM_DOOR_THRESHOLD && Math.random() <= ROOM_ID_DIFF_RANDOM_DOOR_ODDS) {\n buildDoorBetweenZones(map, coords, {\n x: coords.x - 1,\n y: coords.y\n });\n new_door_count++;\n }\n\n // East\n comparedZone = map[coords.y][coords.x + 1];\n if (comparedZone.open && Math.abs(comparedZone.room - this_room_id) > ROOM_ID_DIFF_RANDOM_DOOR_THRESHOLD && Math.random() <= ROOM_ID_DIFF_RANDOM_DOOR_ODDS) {\n buildDoorBetweenZones(map, coords, {\n x: coords.x + 1,\n y: coords.y\n });\n new_door_count++;\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n }\n if (new_door_count < NEW_DOOR_MIN_THRESHOLD) {\n failCount++;\n if (config.maxFails && failCount > config.maxFails) throw new Error('Failed too many times to generate this configuration');\n //console.log('UNMET DOOR THRESHOLD: ' + new_door_count + ' OF ' + //NEW_DOOR_MIN_THRESHOLD + '. Rebuild...');\n return false;\n }\n\n // Build our exits\n for (var _i3 = 0, _DIRECTIONS = DIRECTIONS; _i3 < _DIRECTIONS.length; _i3++) {\n var dir = _DIRECTIONS[_i3];\n map[exits[dir].y][exits[dir].x].edges[dir] = EXIT;\n map[exits[dir].y][exits[dir].x].exit = true;\n }\n return {\n map: map,\n exits: exits,\n failCount: failCount,\n rooms: all_room_zones\n };\n }\n\n // Finds an open zone which is adjacent to one of the supplied zones\n function findNakedAdjacent(map, zones, random) {\n zones = shuffle(zones, random);\n var _iterator2 = _createForOfIteratorHelper(zones),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var current_zone = _step2.value;\n var newZone = moveCursor(map, current_zone, random);\n if (newZone) {\n buildDoorBetweenZones(map, current_zone, newZone);\n return newZone;\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n return false;\n }\n\n // Move the cursor to an available adjacent zone\n function moveCursor(map, cursor, random) {\n var adjacents = shuffle([{\n d: 'n',\n x: 0,\n y: 1\n }, {\n d: 'e',\n x: 1,\n y: 0\n }, {\n d: 's',\n x: 0,\n y: -1\n }, {\n d: 'w',\n x: -1,\n y: 0\n }], random);\n var direction = null;\n var newCursor = null;\n //eslint-disable-next-line no-cond-assign\n while (direction = adjacents.pop()) {\n newCursor = {\n x: cursor.x + direction.x,\n y: cursor.y + direction.y\n };\n if (newCursor.x < 0 || newCursor.y < 0 || newCursor.x >= MAP_WIDTH || newCursor.y >= MAP_HEIGHT) {\n // When this happens, we should just move the cursor somewhere else\n //console.log('CURSOR OUT OF BOUNDS. Rebuild...');\n failCount++;\n if (config.maxFails && failCount > config.maxFails) throw new Error('Failed too many times to generate this configuration');\n return null;\n }\n if (!map[newCursor.y][newCursor.x].open) {\n return newCursor;\n }\n }\n return false;\n }\n\n // Takes the coordinates of a zone, and map info, and works on building\n // walls for that particular zone. Should also update this so that we make\n // sure we're not looking outside the bounds of our array (<0 | >MAX).\n // Also, don't want to blow away doors...\n function buildWallsForZone(map, loc) {\n var room = map[loc.y][loc.x].room;\n\n // NORTH\n if (map[loc.y][loc.x].edges.n != DOOR) {\n if (loc.y === 0 || !map[loc.y - 1][loc.x].open || map[loc.y - 1][loc.x].room != room) {\n map[loc.y][loc.x].edges.n = WALL;\n } else {\n map[loc.y][loc.x].edges.n = OPEN;\n }\n }\n\n // EAST\n if (map[loc.y][loc.x].edges.e != DOOR) {\n if (loc.x >= MAP_WIDTH - 1 || !map[loc.y][loc.x + 1].open || map[loc.y][loc.x + 1].room != room) {\n map[loc.y][loc.x].edges.e = WALL;\n } else {\n map[loc.y][loc.x].edges.e = OPEN;\n }\n }\n\n // SOUTH\n if (map[loc.y][loc.x].edges.s != DOOR) {\n if (loc.y >= MAP_HEIGHT - 1 || !map[loc.y + 1][loc.x].open || map[loc.y + 1][loc.x].room != room) {\n map[loc.y][loc.x].edges.s = WALL;\n } else {\n map[loc.y][loc.x].edges.s = OPEN;\n }\n }\n\n // WEST\n if (map[loc.y][loc.x].edges.w != DOOR) {\n if (loc.x === 0 || !map[loc.y][loc.x - 1].open || map[loc.y][loc.x - 1].room != room) {\n map[loc.y][loc.x].edges.w = WALL;\n } else {\n map[loc.y][loc.x].edges.w = OPEN;\n }\n }\n }\n};\n\n// Get a random integer between the supplied min and max\nfunction rangedRandom(min, max, random) {\n return Math.floor(random() * (max + 1 - min) + min);\n}\n\n// Builds a door between these two (hopefully) adjacent zones\nfunction buildDoorBetweenZones(map, zonePos1, zonePos2) {\n var zone1 = map[zonePos1.y][zonePos1.x];\n var zone2 = map[zonePos2.y][zonePos2.x];\n if (zonePos1.x == zonePos2.x && zonePos1.y > zonePos2.y) {\n // ZONE1 SOUTH OF ZONE2\n zone1.edges.n = DOOR;\n zone2.edges.s = DOOR;\n } else if (zonePos1.x == zonePos2.x && zonePos1.y < zonePos2.y) {\n // ZONE1 NORTH OF ZONE2\n zone1.edges.s = DOOR;\n zone2.edges.n = DOOR;\n } else if (zonePos1.y == zonePos2.y && zonePos1.x > zonePos2.x) {\n // ZONE1 EAST OF ZONE2\n zone1.edges.w = DOOR;\n zone2.edges.e = DOOR;\n } else if (zonePos1.y == zonePos2.y && zonePos1.x < zonePos2.x) {\n // ZONE1 WEST OF ZONE2\n zone1.edges.e = DOOR;\n zone2.edges.w = DOOR;\n } else {\n console.log('BUILD DOOR FAILURE', zone1, zone2);\n }\n}\n\n// Randomizes an array\nfunction shuffle(array, random) {\n var arr = array.slice(); // clone array\n var i = arr.length,\n j,\n tempi,\n tempj;\n if (i == 0) return false;\n while (--i) {\n j = Math.floor(random() * (i + 1));\n tempi = arr[i];\n tempj = arr[j];\n arr[i] = tempj;\n arr[j] = tempi;\n }\n return arr;\n}\n\n// Builds a big empty square array, an entire map\nfunction initialize(width, height) {\n var map = [];\n for (var y = 0; y < height; y++) {\n map[y] = [];\n for (var x = 0; x < width; x++) {\n map[y][x] = {\n open: false,\n room: null,\n exit: null,\n zone: null,\n edges: {\n n: null,\n e: null,\n s: null,\n w: null\n }\n };\n }\n }\n return map;\n}\nfunction ALGORITHM_METROIDVANIA(tileMap, options) {\n tileMap.fill(0); // Fill with walls\n var maxDimension = Math.max(tileMap.width, tileMap.height);\n if (maxDimension <= 5) {\n return;\n }\n var fractional = Math.sqrt(maxDimension);\n if (fractional % 2 !== 1) fractional++;\n var size = maxDimension < 10 ? Math.floor(maxDimension / 2) : 10;\n var doorDiff = maxDimension < 10 ? 1 : 2;\n var roomSizeHeight = Math.floor(tileMap.width / size);\n var roomSizeWidth = Math.floor(tileMap.height / size);\n var numRoomsWide = Math.floor(tileMap.width / roomSizeHeight);\n var numRoomsHigh = Math.floor(tileMap.height / roomSizeWidth);\n var maxCount = Math.floor(numRoomsWide * numRoomsHigh * 0.8);\n var minCount = Math.floor(maxCount / 4);\n var generator = new Metroidvania({\n roomWidth: roomSizeWidth,\n roomHeight: roomSizeHeight,\n maxFails: 8000,\n width: numRoomsWide,\n // Max number of zones wide\n height: numRoomsWide,\n // Max number of zones tall\n gridHeight: tileMap.height,\n gridWidth: tileMap.width,\n minZonesPerRoom: 1,\n // Minimum number of zones per room\n maxZonesPerRoom: 3,\n // Maximum number of zones per room\n minRoomsPerMap: minCount,\n // Minimum number of rooms per map\n maxRoomsPerMap: maxCount,\n // Maximum number of rooms per map\n newDoors: doorDiff,\n // # doors to add to prevent tedious linear mazes\n roomDiff: doorDiff,\n // When adding a new door, room ID distance\n roomDiffOdds: 1 / 2 // Odds of inserting a new door on opportunity\n });\n var built = generator.build(function () {\n return tileMap.random();\n });\n var flattened = built.world.reduce(function (agg, line) {\n return agg.concat(line);\n }, []);\n built.world = null;\n tileMap.world = built;\n for (var lcv = 0; lcv < tileMap.data.length; lcv++) {\n tileMap.data[lcv] = flattened[lcv];\n }\n}\n\n},{}],16:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generateMap;\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction generateMap(tileMap, options) {\n var stack = [];\n var visited = Array.from({\n length: tileMap.height\n }, function () {\n return Array(tileMap.width).fill(false);\n });\n var visitCell = function visitCell(x, y) {\n visited[y][x] = true;\n stack.push([x, y]);\n while (stack.length > 0) {\n var _stack = _slicedToArray(stack[stack.length - 1], 2),\n cx = _stack[0],\n cy = _stack[1];\n var neighbors = getNeighbors(cx, cy);\n if (neighbors.length > 0) {\n var _neighbors$Math$floor = _slicedToArray(neighbors[Math.floor(tileMap.random(neighbors.length))], 2),\n nx = _neighbors$Math$floor[0],\n ny = _neighbors$Math$floor[1];\n removeWall(cx, cy, nx, ny);\n visited[ny][nx] = true;\n stack.push([nx, ny]);\n } else {\n stack.pop();\n }\n }\n };\n var getNeighbors = function getNeighbors(x, y) {\n var neighbors = [];\n if (x > 0 && !visited[y][x - 1]) neighbors.push([x - 1, y]);\n if (y > 0 && !visited[y - 1][x]) neighbors.push([x, y - 1]);\n if (x < tileMap.width - 1 && !visited[y][x + 1]) neighbors.push([x + 1, y]);\n if (y < tileMap.height - 1 && !visited[y + 1][x]) neighbors.push([x, y + 1]);\n return neighbors;\n };\n var removeWall = function removeWall(x, y, nx, ny) {\n var index1 = y * tileMap.width + x;\n var index2 = ny * tileMap.width + nx;\n tileMap.data[Math.min(index1, index2)] = 0; // Assuming 1 is a wall and 0 is an open path\n };\n\n // Start from a random cell\n var startX = Math.floor(tileMap.random(tileMap.width));\n var startY = Math.floor(tileMap.random(tileMap.height));\n visitCell(startX, startY);\n}\n\n},{}],17:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generateRecursiveDivisionMap;\n// RecursiveDivision.js - Marak Squires 2024\nfunction generateRecursiveDivisionMap(tileMap, options) {\n var floorTileId = 1; // TODO: change to 0\n var wallTileId = 0; // TODO: change to 1\n\n tileMap.data.fill(floorTileId);\n var addWalls = function addWalls(x1, y1, x2, y2) {\n if (x2 - x1 < 2 || y2 - y1 < 2) return;\n var horizontal = x2 - x1 < y2 - y1;\n var wx = horizontal ? x1 : Math.floor(tileMap.random(x2 - x1 - 2)) + x1 + 1;\n var wy = horizontal ? Math.floor(tileMap.random(y2 - y1 - 2)) + y1 + 1 : y1;\n var px = horizontal ? Math.floor(tileMap.random(x2 - x1)) + x1 : wx;\n var py = horizontal ? wy : Math.floor(tileMap.random(y2 - y1)) + y1;\n for (var x = x1; x < x2; x++) {\n for (var y = y1; y < y2; y++) {\n if (horizontal && x === wx && y !== py || !horizontal && y === wy && x !== px) {\n tileMap.data[y * tileMap.width + x] = wallTileId;\n }\n }\n }\n if (horizontal) {\n addWalls(x1, y1, x2, wy);\n addWalls(x1, wy, x2, y2);\n } else {\n addWalls(x1, y1, wx, y2);\n addWalls(wx, y1, x2, y2);\n }\n };\n addWalls(0, 0, tileMap.width, tileMap.height);\n}\n\n},{}],18:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = ALGORITHM_THOMAS_HUNTER;\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * Originally written by Thomas Hunter II\n *\n * Originally written on June 12, 2013\n * Originally hosted at https://github.com/PhobosRising/javascript-roguelike-map-generator\n */\n\n//import { random } from './random.mjs';\n\n//const rand = require('../../utility/random/index.js');\n\nvar TILE = {\n VOID: 0,\n FLOOR: 1,\n WALL: 2,\n DOOR: 3,\n SPECIAL_DOOR: 4,\n ENTER: 5,\n EXIT: 6\n};\nvar DEFAULT = {\n WIDTH: 21,\n HEIGHT: 21,\n MIN_ROOM_WIDTH: 3,\n MAX_ROOM_WIDTH: 7,\n MIN_ROOM_HEIGHT: 3,\n MAX_ROOM_HEIGHT: 7,\n IDEAL_COUNT: 10,\n RETRY_COUNT: 100\n};\n\n//var WALL_X = 0;\n//var WALL_Y = 1;\n\nvar ROOM_GAP = 1;\nvar Roguelike = /*#__PURE__*/function () {\n function Roguelike() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, Roguelike);\n if (!config) {\n config = {};\n }\n if (!config.room) {\n config.room = {};\n }\n this.max_width = config.width || DEFAULT.WIDTH;\n this.max_height = config.height || DEFAULT.HEIGHT;\n this.room_min_width = config.room.min_width || DEFAULT.MIN_ROOM_WIDTH;\n this.room_max_width = config.room.max_width || DEFAULT.MAX_ROOM_WIDTH;\n this.room_min_height = config.room.min_height || DEFAULT.MIN_ROOM_HEIGHT;\n this.room_max_height = config.room.max_height || DEFAULT.MAX_ROOM_HEIGHT;\n this.room_ideal_count = config.room.ideal || DEFAULT.IDEAL_COUNT;\n this.retry_count = config.retry || DEFAULT.IDEAL_COUNT;\n this.want_special = !!config.special;\n }\n _createClass(Roguelike, [{\n key: \"render\",\n value: function render() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var blt = arguments.length > 1 ? arguments[1] : undefined;\n var built = blt || this.build();\n var world = built.world;\n\n //var end = new Date();\n\n var result = '';\n // Crude mechanism for drawing level\n for (var y = 0; y < world.length; y++) {\n var row = '';\n for (var x = 0; x < world[y].length; x++) {\n var tile = world[y][x];\n if (tile === 0) {\n row += ' ';\n } else if (tile === 1) {\n row += '.';\n } else if (tile === 2) {\n row += '#';\n } else if (tile === 3) {\n row += '/';\n } else if (tile === 4) {\n row += 'X';\n } else if (tile === 5) {\n row += '<';\n } else if (tile === 6) {\n row += '>';\n } else {\n row += world[y][x];\n }\n }\n result += row + '\\n';\n //console.log(row + '| ' + y);\n }\n return result;\n }\n }, {\n key: \"build\",\n value: function build(random) {\n this.random = random ? random : function () {\n return Math.random();\n };\n this.world = null; // 2D array representing the world\n this.rooms = {}; // Object containing rooms where the key is the Room ID\n this.doors = {}; // Object containing doors where the key is the Door ID\n this.walls = []; // Array of all walls, where each items is an [X,Y] pair\n this.enter = null; // {x, y, room_id} object pointing to level entrance\n this.exit = null; // {x, y, room_id} object pointing to level exit\n this.special = null; // {room_id, door_id} object pointing to special area\n this.deadends = [];\n this.room_id = 0;\n this.door_id = 0;\n this.createVoid();\n this.addStarterRoom();\n this.generateRooms();\n this.addSpecialRooms();\n this.buildWalls();\n return {\n width: this.max_width,\n height: this.max_height,\n enter: this.enter,\n exit: this.exit,\n deadends: this.deadends,\n special: this.special,\n door_count: this.door_id,\n doors: this.doors,\n room_count: this.room_id,\n rooms: this.rooms,\n walls: this.walls,\n world: this.world\n };\n }\n\n /**\n * Creates a 2D array of VOID tiles\n */\n }, {\n key: \"createVoid\",\n value: function createVoid() {\n var world = [];\n for (var y = 0; y < this.max_height; y++) {\n world[y] = [];\n for (var x = 0; x < this.max_width; x++) {\n world[y][x] = TILE.VOID;\n }\n }\n this.world = world;\n }\n }, {\n key: \"addStarterRoom\",\n value: function addStarterRoom() {\n var dimen = this.getRoomDimensions();\n var min_left = ROOM_GAP;\n var max_left = this.max_width - (dimen.width + ROOM_GAP * 2) + ROOM_GAP;\n var min_top = ROOM_GAP;\n var max_top = this.max_height - (dimen.height + ROOM_GAP * 2) + ROOM_GAP;\n var left = this.randomOdd(min_left, max_left);\n var top = this.randomOdd(min_top, max_top);\n //console.log('starter', left, top, dimen.width, dimen.height)\n this.addRoom(left, top, dimen.width, dimen.height);\n //console.log('W', this.world)\n }\n }, {\n key: \"getRoomDimensions\",\n value: function getRoomDimensions() {\n return {\n width: this.randomOdd(this.room_min_width, this.room_max_width),\n height: this.randomOdd(this.room_min_height, this.room_max_height)\n };\n }\n }, {\n key: \"addRoom\",\n value: function addRoom(left, top, width, height) {\n var room_id = this.room_id++;\n this.rooms[room_id] = {\n left: left,\n top: top,\n width: width,\n height: height,\n id: room_id,\n walls: [],\n neighbors: [],\n doors: []\n };\n for (var y = top; y < top + height; y++) {\n for (var x = left; x < left + width; x++) {\n //console.log('f');\n this.world[y][x] = TILE.FLOOR;\n }\n }\n return room_id;\n }\n\n /**\n * Adds one-off floors, e.g. for building hallways\n */\n }, {\n key: \"addFloor\",\n value: function addFloor(x, y) {\n this.world[y][x] = TILE.FLOOR;\n }\n }, {\n key: \"generateRooms\",\n value: function generateRooms() {\n var retries = this.retry_count;\n while (this.room_id < this.room_ideal_count) {\n //console.log('!')\n if (!this.generateRoom() && --retries <= 0) {\n break;\n }\n }\n }\n\n /**\n * Attempts to add a single room to our world\n *\n * Pick a random cardinal direction\n * Generate a room size\n * Slide that room in until it bumps into another room\n * Build a door that connects the two\n */\n }, {\n key: \"generateRoom\",\n value: function generateRoom() {\n var slide = this.randomFn(0, 3); // North, East, South, West\n\n var x_dir = slide === 1 ? +1 : slide === 3 ? -1 : 0;\n var y_dir = slide === 0 ? +1 : slide === 2 ? -1 : 0;\n var dimen = this.getRoomDimensions();\n var top, left, name;\n if (slide === 0) {\n // Slide South from Top\n name = 'south';\n top = ROOM_GAP;\n left = this.randomOdd(ROOM_GAP, this.max_width - dimen.width - ROOM_GAP * 2);\n } else if (slide === 1) {\n // Slide East from Left\n name = 'east';\n top = this.randomOdd(ROOM_GAP, this.max_height - dimen.height - ROOM_GAP * 2);\n left = ROOM_GAP;\n } else if (slide === 2) {\n // Slide North from Bottom\n name = 'north';\n top = this.max_height - dimen.height - ROOM_GAP;\n left = this.randomOdd(ROOM_GAP, this.max_width - dimen.width - ROOM_GAP * 2);\n } else if (slide === 3) {\n // Slide West from Right\n //eslint-disable-next-line no-unused-vars\n name = 'west';\n top = this.randomOdd(ROOM_GAP, this.max_height - dimen.height - ROOM_GAP * 2);\n left = this.max_width - dimen.width - ROOM_GAP;\n }\n\n //console.log(name, top, left)\n\n // Our start position for adding a room overlaps with an existing one :(\n if (false !== this.collides(top, left, dimen.width, dimen.height)) {\n return false;\n }\n var collide_room = null;\n while (false === (collide_room = this.collides(top + y_dir, left + x_dir, dimen.width, dimen.height))) {\n top += y_dir;\n left += x_dir;\n //console.log(name, top, left)\n // We slid the room out of bounds of the world\n if (this.invalid(top, left, dimen.width, dimen.height)) {\n //console.log('INVALID')\n return false;\n }\n }\n var new_room_id = this.addRoom(left, top, dimen.width, dimen.height);\n //console.log('world', this.world);\n this.addDoorBetweenRooms(x_dir, y_dir, collide_room, new_room_id);\n return true;\n }\n }, {\n key: \"collides\",\n value: function collides(top, left, width, height) {\n var target = {\n top: top,\n left: left,\n width: width,\n height: height\n };\n for (var i = 0; i < this.room_id; i++) {\n var room = this.rooms[i];\n /*console.log(target.left, room.left + room.width,\n target.left + target.width , room.left,\n target.top , room.top + room.height,\n target.top + target.height , room.top)*/\n if (!(target.left > room.left + room.width || target.left + target.width < room.left || target.top > room.top + room.height || target.top + target.height < room.top)) {\n return room.id; // truthy int\n }\n }\n return false;\n }\n }, {\n key: \"invalid\",\n value: function invalid(top, left, width, height) {\n if (top <= ROOM_GAP) {\n // Too far north\n return true;\n } else if (left <= ROOM_GAP) {\n // Too far west\n return true;\n } else if (top + height >= this.max_height - ROOM_GAP) {\n // Too far east\n return true;\n } else if (left + width >= this.max_width - ROOM_GAP) {\n // Too far south\n return true;\n }\n\n // A O.K.\n return false;\n }\n\n /**\n * Finds boundaries between floors and void, adding walls\n */\n }, {\n key: \"buildWalls\",\n value: function buildWalls() {\n var rooms = this.rooms;\n //var world = this.world;\n\n // Do this for halls and rooms\n for (var i = 0; i < this.room_id; i++) {\n var room = rooms[i];\n\n // Top Wall (Long)\n for (var tx = room.left - 1; tx < room.left + room.width + 1; tx++) {\n this.addWall(tx, room.top - 1, room);\n }\n\n // Right Wall (Short)\n for (var ry = room.top; ry < room.top + room.height; ry++) {\n this.addWall(room.left + room.width, ry, room);\n }\n\n // Bottom Wall (Long)\n for (var bx = room.left - 1; bx < room.left + room.width + 1; bx++) {\n this.addWall(bx, room.top + room.height, room);\n }\n\n // Left Wall (Short)\n for (var ly = room.top; ly < room.top + room.height; ly++) {\n this.addWall(room.left - 1, ly, room);\n }\n }\n }\n }, {\n key: \"addWall\",\n value: function addWall(x, y, room) {\n // Walls should only appear once in the global walls list and world grid\n if (this.world[y][x] === TILE.VOID) {\n this.world[y][x] = TILE.WALL;\n this.walls.push([x, y]);\n }\n if (this.world[y][x] === TILE.VOID || this.world[y][x] === TILE.WALL) {\n room.walls.push([x, y]);\n }\n }\n }, {\n key: \"addDoorBetweenRooms\",\n value: function addDoorBetweenRooms(x_dir, y_dir, existing_room_id, new_room_id) {\n var existing_room = this.rooms[existing_room_id];\n var new_room = this.rooms[new_room_id];\n var x, y, orientation;\n if (x_dir === 1) {\n // eastward\n x = existing_room.left - 1;\n y = this.randomFn(Math.max(existing_room.top, new_room.top) + 1, Math.min(existing_room.top + existing_room.height, new_room.top + new_room.height) - 2);\n orientation = 'h'; // horizontal\n } else if (x_dir === -1) {\n // stabbing westward\n x = new_room.left - 1;\n y = this.randomFn(Math.max(new_room.top, existing_room.top) + 1, Math.min(new_room.top + new_room.height, existing_room.top + existing_room.height) - 2);\n orientation = 'h'; // horizontal\n } else if (y_dir === -1) {\n // northward\n x = this.randomFn(Math.max(existing_room.left, new_room.left) + 1, Math.min(existing_room.left + existing_room.width, new_room.left + new_room.width) - 2);\n y = new_room.top - 1;\n orientation = 'v'; // vertical\n } else if (y_dir === 1) {\n // southward\n x = this.randomFn(Math.max(new_room.left, existing_room.left) + 1, Math.min(new_room.left + new_room.width, existing_room.left + existing_room.width) - 2);\n y = existing_room.top - 1;\n orientation = 'v'; // vertical\n }\n this.addDoor(x, y, existing_room_id, new_room_id, orientation);\n this.rooms[existing_room_id].neighbors.push(new_room_id);\n this.rooms[new_room_id].neighbors.push(existing_room_id);\n }\n\n /**\n * Add an entrance and exit to the level.\n *\n * Optionally adds a special room (could be hidden, a shop, etc.)\n *\n * We pick two random rooms with only a single attached neighbor.\n * This ensures two adjacent rooms aren't entrance and exit.\n */\n }, {\n key: \"addSpecialRooms\",\n value: function addSpecialRooms() {\n var deadends = [];\n var smallest = {\n id: null,\n area: Infinity\n };\n var room, area;\n for (var i = 0; i < this.room_id; i++) {\n room = this.rooms[i];\n if (room.neighbors.length === 1) {\n this.rooms[i].deadend = true;\n deadends.push(i);\n area = room.width * room.height;\n if (area < smallest.area) {\n smallest.id = i;\n }\n }\n }\n if (this.want_special && deadends.length >= 2) {\n // Enter + Exit + Special\n var index = deadends.indexOf(smallest.id);\n deadends.splice(index, 1);\n var door_id = this.rooms[smallest.id].doors[0];\n var room_id = smallest.id;\n this.special = {\n room_id: room_id,\n door_id: door_id\n };\n var door = this.doors[door_id];\n door.special = true;\n this.rooms[room_id].special = true;\n this.world[door.y][door.x] = TILE.SPECIAL_DOOR;\n }\n this.shuffle(deadends);\n var enter_room_id = deadends.pop();\n if (typeof enter_room_id === 'undefined') {\n //throw new Error('Unable to find a dead end room for Enter!');\n return;\n }\n var enter = this.randomNonEdgeInRoom(enter_room_id);\n this.world[enter.y][enter.x] = TILE.ENTER;\n this.enter = {\n x: enter.x,\n y: enter.y,\n room_id: enter_room_id\n };\n this.rooms[enter_room_id].enter = true;\n var enter_door = this.rooms[enter_room_id].doors[0];\n this.doors[enter_door].enter = true;\n var exit_room_id = deadends.pop();\n if (typeof exit_room_id === 'undefined') {\n //throw new Error('Unable to find a dead end room for Exit!');\n return;\n }\n var exit = this.randomNonEdgeInRoom(exit_room_id);\n this.world[exit.y][exit.x] = TILE.EXIT;\n this.exit = {\n x: exit.x,\n y: exit.y,\n room_id: exit_room_id\n };\n this.rooms[exit_room_id].exit = true;\n var exit_door = this.rooms[exit_room_id].doors[0];\n this.doors[exit_door].exit = true;\n this.deadends = deadends;\n }\n }, {\n key: \"randomNonEdgeInRoom\",\n value: function randomNonEdgeInRoom(room_id) {\n var room = this.rooms[room_id];\n return {\n x: this.randomFn(room.left + 1, room.left + room.width - 2),\n y: this.randomFn(room.top + 1, room.top + room.height - 2)\n };\n }\n }, {\n key: \"addDoor\",\n value: function addDoor(x, y, room1, room2, orientation) {\n this.world[y][x] = TILE.DOOR;\n var door_id = this.door_id++;\n this.doors[door_id] = {\n x: x,\n y: y,\n id: door_id,\n orientation: orientation,\n rooms: [room1, room2]\n };\n this.rooms[room1].doors.push(door_id);\n this.rooms[room2].doors.push(door_id);\n return door_id;\n }\n\n /**\n * Pick a number between min and max, inclusive\n * e.g. 1,7 => 1,2,3,4,5,6,7\n */\n }, {\n key: \"randomFn\",\n value: function randomFn(min_raw, max_raw) {\n var min = Math.floor(min_raw);\n var max = Math.floor(max_raw);\n return Math.floor(this.random() * (max + 1 - min) + min);\n }\n\n /**\n * Picks a random odd number between min and max, inclusive (if odd)\n * e.g. 2,9 => 3,5,7,9\n *\n * TODO: Make this a one-liner\n */\n }, {\n key: \"randomOdd\",\n value: function randomOdd(min_raw, max_raw) {\n // Convert them to integers\n var min = Math.floor(min_raw);\n var max = Math.floor(max_raw);\n\n // Make them both Odd\n if (min % 2 === 0) min++;\n if (max % 2 === 0) max--;\n\n // Shift down one, make them even\n min -= 1;\n max -= 1;\n\n // Cut them in half\n min /= 2;\n max /= 2;\n var r = this.random();\n //console.log('R', r);\n var result = Math.floor(r * (max + 1 - min) + min);\n result *= 2;\n result += 1;\n return result;\n }\n }, {\n key: \"shuffle\",\n value: function shuffle(o) {\n for (var j, x, i = o.length; i; j = Math.floor(this.random() * i), x = o[--i], o[i] = o[j], o[j] = x);\n }\n }]);\n return Roguelike;\n}();\nfunction ALGORITHM_THOMAS_HUNTER(tileMap, options) {\n tileMap.fill(1); // Fill with walls\n var maxDimension = Math.max(tileMap.width, tileMap.height);\n if (maxDimension <= 5) {\n return;\n }\n var fractional = Math.floor(Math.sqrt(Math.max(tileMap.width, tileMap.height)));\n if (fractional % 2 !== 1) fractional++;\n var roomNumber = Math.floor(tileMap.width / fractional * tileMap.width / fractional / 2);\n var rangius = Math.ceil(fractional / 2);\n var generator = new Roguelike({\n width: tileMap.width,\n // Max Width of the world\n height: tileMap.height,\n // Max Height of the world\n retry: 100,\n // How many times should we try to add a room?\n special: true,\n // Should we generate a \"special\" room?\n room: {\n // Give up once we get this number of rooms\n ideal: options.roomCount || roomNumber,\n min_width: options.roomMinWidth || fractional - rangius,\n max_width: options.roomMaxWidth || fractional + rangius,\n min_height: options.roomMinHeight || fractional - rangius,\n max_height: options.roomMinHeight || fractional + rangius\n }\n });\n var built = generator.build(function () {\n return tileMap.random();\n });\n\n //console.log(built.world.map((line)=>line.join('')).join('\\n'));\n var flattened = built.world.reduce(function (agg, line) {\n return agg.concat(line);\n }, []);\n built.world = null;\n tileMap.world = built;\n for (var lcv = 0; lcv < tileMap.data.length; lcv++) {\n tileMap.data[lcv] = flattened[lcv];\n }\n}\n\n},{}],19:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = SHAPE_CIRCLE;\nfunction SHAPE_CIRCLE(tileMap, options) {\n tileMap.fill(1);\n var radius = Math.min(tileMap.width, tileMap.height) / 2;\n var centerX = tileMap.width / 2;\n var centerY = tileMap.height / 2;\n for (var y = 0; y < tileMap.height; y++) {\n for (var x = 0; x < tileMap.width; x++) {\n if (Math.pow(x - centerX, 2) + Math.pow(y - centerY, 2) <= Math.pow(radius, 2)) {\n tileMap.data[y * tileMap.width + x] = 0;\n }\n }\n }\n}\n\n},{}],20:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = SHAPE_SQUARE;\nfunction SHAPE_SQUARE(tileMap, options) {\n tileMap.fill(0); // Filling the map with empty tiles\n var size = Math.min(tileMap.width, tileMap.height);\n var startX = Math.floor((tileMap.width - size) / 2);\n var startY = Math.floor((tileMap.height - size) / 2);\n for (var y = startY; y < startY + size; y++) {\n for (var x = startX; x < startX + size; x++) {\n tileMap.data[y * tileMap.width + x] = 1; // Fill with a different tile\n }\n }\n}\n\n},{}],21:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = SHAPE_TRIANGLE;\nfunction SHAPE_TRIANGLE(tileMap, options) {\n tileMap.fill(0);\n var height = tileMap.height;\n var width = tileMap.width;\n for (var y = 0; y < height; y++) {\n for (var x = 0; x <= y; x++) {\n tileMap.data[y * width + x] = 1;\n }\n }\n}\n\n},{}],22:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generateFaultLineMap;\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction generateFaultLineMap(tileMap, options) {\n var iterations = options.iterations || 100;\n var heightIncrease = options.heightIncrease || 0.01;\n\n // Initialize the height map\n var heightMap = new Array(tileMap.width * tileMap.height).fill(0);\n for (var i = 0; i < iterations; i++) {\n // Randomly create a fault line using tileMap.random()\n var a = tileMap.random() - 0.5;\n var b = tileMap.random() - 0.5;\n var d = tileMap.random();\n\n // Adjust the height on one side of the fault line\n for (var y = 0; y < tileMap.height; y++) {\n for (var x = 0; x < tileMap.width; x++) {\n if (a * x + b * y - d > 0) {\n heightMap[y * tileMap.width + x] += heightIncrease;\n }\n }\n }\n }\n\n // Normalize and apply to tileMap\n applyHeightToTileMap(tileMap, heightMap);\n}\nfunction applyHeightToTileMap(tileMap, heightMap) {\n var max = Math.max.apply(Math, _toConsumableArray(heightMap));\n var min = Math.min.apply(Math, _toConsumableArray(heightMap));\n for (var i = 0; i < heightMap.length; i++) {\n // Normalize the height values\n var normalizedHeight = (heightMap[i] - min) / (max - min);\n tileMap.data[i] = normalizedHeight;\n }\n}\n\n},{}],23:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generatePerlinNoiseMap;\nfunction generatePerlinNoiseMap(tileMap, options) {\n var scale = options.scale || 0.1; // Determines the \"zoom level\" of the noise\n\n for (var y = 0; y < tileMap.height; y++) {\n for (var x = 0; x < tileMap.width; x++) {\n // Generate Perlin noise value for each tile\n var noiseValue = tileMap.noise(x * scale, y * scale);\n\n // Optionally transform noiseValue here to suit your needs\n\n // Assign noise value to tileMap data\n tileMap.data[y * tileMap.width + x] = noiseValue;\n }\n }\n}\n\n},{}],24:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n// this program is a JavaScript version of Mersenne Twister, with concealment and encapsulation in class,\n// an almost straight conversion from the original program, mt19937ar.c,\n// translated by y. okada on July 17, 2006.\n// and modified a little at july 20, 2006, but there are not any substantial differences.\n// in this program, procedure descriptions and comments of original source code were not removed.\n// lines commented with //c// were originally descriptions of c procedure. and a few following lines are appropriate JavaScript descriptions.\n// lines commented with /* and */ are original comments.\n// lines commented with // are additional comments in this JavaScript version.\n// before using this version, create at least one instance of MersenneTwister19937 class, and initialize the each state, given below in c comments, of all the instances.\n/*\n A C-program for MT19937, with initialization improved 2002/1/26.\n Coded by Takuji Nishimura and Makoto Matsumoto.\n\n Before using, initialize the state by using init_genrand(seed)\n or init_by_array(init_key, key_length).\n\n Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions\n are met:\n\n 1. Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n 3. The names of its contributors may not be used to endorse or promote\n products derived from this software without specific prior written\n permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n Any feedback is very welcome.\n http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\n email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)\n*/\n\nfunction MersenneTwister19937() {\n /* constants should be scoped inside the class */\n var N, M, MATRIX_A, UPPER_MASK, LOWER_MASK;\n /* Period parameters */\n //c//#define N 624\n //c//#define M 397\n //c//#define MATRIX_A 0x9908b0dfUL /* constant vector a */\n //c//#define UPPER_MASK 0x80000000UL /* most significant w-r bits */\n //c//#define LOWER_MASK 0x7fffffffUL /* least significant r bits */\n N = 624;\n M = 397;\n MATRIX_A = 0x9908b0df; /* constant vector a */\n UPPER_MASK = 0x80000000; /* most significant w-r bits */\n LOWER_MASK = 0x7fffffff; /* least significant r bits */\n //c//static unsigned long mt[N]; /* the array for the state vector */\n //c//static int mti=N+1; /* mti==N+1 means mt[N] is not initialized */\n var mt = new Array(N); /* the array for the state vector */\n var mti = N + 1; /* mti==N+1 means mt[N] is not initialized */\n\n function unsigned32(n1)\n // returns a 32-bits unsiged integer from an operand to which applied a bit operator.\n {\n return n1 < 0 ? (n1 ^ UPPER_MASK) + UPPER_MASK : n1;\n }\n function subtraction32(n1, n2)\n // emulates lowerflow of a c 32-bits unsiged integer variable, instead of the operator -. these both arguments must be non-negative integers expressible using unsigned 32 bits.\n {\n return n1 < n2 ? unsigned32(0x100000000 - (n2 - n1) & 0xffffffff) : n1 - n2;\n }\n function addition32(n1, n2)\n // emulates overflow of a c 32-bits unsiged integer variable, instead of the operator +. these both arguments must be non-negative integers expressible using unsigned 32 bits.\n {\n return unsigned32(n1 + n2 & 0xffffffff);\n }\n function multiplication32(n1, n2)\n // emulates overflow of a c 32-bits unsiged integer variable, instead of the operator *. these both arguments must be non-negative integers expressible using unsigned 32 bits.\n {\n var sum = 0;\n for (var i = 0; i < 32; ++i) {\n if (n1 >>> i & 0x1) {\n sum = addition32(sum, unsigned32(n2 << i));\n }\n }\n return sum;\n }\n\n /* initializes mt[N] with a seed */\n //c//void init_genrand(unsigned long s)\n this.init_genrand = function (s) {\n //c//mt[0]= s & 0xffffffff;\n mt[0] = unsigned32(s & 0xffffffff);\n for (mti = 1; mti < N; mti++) {\n mt[mti] =\n //c//(1812433253 * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);\n addition32(multiplication32(1812433253, unsigned32(mt[mti - 1] ^ mt[mti - 1] >>> 30)), mti);\n /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */\n /* In the previous versions, MSBs of the seed affect */\n /* only MSBs of the array mt[]. */\n /* 2002/01/09 modified by Makoto Matsumoto */\n //c//mt[mti] &= 0xffffffff;\n mt[mti] = unsigned32(mt[mti] & 0xffffffff);\n /* for >32 bit machines */\n }\n };\n\n /* initialize by an array with array-length */\n /* init_key is the array for initializing keys */\n /* key_length is its length */\n /* slight change for C++, 2004/2/26 */\n //c//void init_by_array(unsigned long init_key[], int key_length)\n this.init_by_array = function (init_key, key_length) {\n //c//int i, j, k;\n var i, j, k;\n //c//init_genrand(19650218);\n this.init_genrand(19650218);\n i = 1;\n j = 0;\n k = N > key_length ? N : key_length;\n for (; k; k--) {\n //c//mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525))\n //c//\t+ init_key[j] + j; /* non linear */\n mt[i] = addition32(addition32(unsigned32(mt[i] ^ multiplication32(unsigned32(mt[i - 1] ^ mt[i - 1] >>> 30), 1664525)), init_key[j]), j);\n mt[i] =\n //c//mt[i] &= 0xffffffff; /* for WORDSIZE > 32 machines */\n unsigned32(mt[i] & 0xffffffff);\n i++;\n j++;\n if (i >= N) {\n mt[0] = mt[N - 1];\n i = 1;\n }\n if (j >= key_length) {\n j = 0;\n }\n }\n for (k = N - 1; k; k--) {\n //c//mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941))\n //c//- i; /* non linear */\n mt[i] = subtraction32(unsigned32((dbg = mt[i]) ^ multiplication32(unsigned32(mt[i - 1] ^ mt[i - 1] >>> 30), 1566083941)), i);\n //c//mt[i] &= 0xffffffff; /* for WORDSIZE > 32 machines */\n mt[i] = unsigned32(mt[i] & 0xffffffff);\n i++;\n if (i >= N) {\n mt[0] = mt[N - 1];\n i = 1;\n }\n }\n mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */\n };\n\n /* moved outside of genrand_int32() by jwatte 2010-11-17; generate less garbage */\n var mag01 = [0x0, MATRIX_A];\n\n /* generates a random number on [0,0xffffffff]-interval */\n //c//unsigned long genrand_int32(void)\n this.genrand_int32 = function () {\n //c//unsigned long y;\n //c//static unsigned long mag01[2]={0x0UL, MATRIX_A};\n var y;\n /* mag01[x] = x * MATRIX_A for x=0,1 */\n\n if (mti >= N) {\n /* generate N words at one time */\n //c//int kk;\n var kk;\n if (mti == N + 1) /* if init_genrand() has not been called, */\n //c//init_genrand(5489); /* a default initial seed is used */\n {\n this.init_genrand(5489);\n } /* a default initial seed is used */\n\n for (kk = 0; kk < N - M; kk++) {\n //c//y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);\n //c//mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1];\n y = unsigned32(mt[kk] & UPPER_MASK | mt[kk + 1] & LOWER_MASK);\n mt[kk] = unsigned32(mt[kk + M] ^ y >>> 1 ^ mag01[y & 0x1]);\n }\n for (; kk < N - 1; kk++) {\n //c//y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);\n //c//mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1];\n y = unsigned32(mt[kk] & UPPER_MASK | mt[kk + 1] & LOWER_MASK);\n mt[kk] = unsigned32(mt[kk + (M - N)] ^ y >>> 1 ^ mag01[y & 0x1]);\n }\n //c//y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);\n //c//mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1];\n y = unsigned32(mt[N - 1] & UPPER_MASK | mt[0] & LOWER_MASK);\n mt[N - 1] = unsigned32(mt[M - 1] ^ y >>> 1 ^ mag01[y & 0x1]);\n mti = 0;\n }\n y = mt[mti++];\n\n /* Tempering */\n //c//y ^= (y >> 11);\n //c//y ^= (y << 7) & 0x9d2c5680;\n //c//y ^= (y << 15) & 0xefc60000;\n //c//y ^= (y >> 18);\n y = unsigned32(y ^ y >>> 11);\n y = unsigned32(y ^ y << 7 & 0x9d2c5680);\n y = unsigned32(y ^ y << 15 & 0xefc60000);\n y = unsigned32(y ^ y >>> 18);\n return y;\n };\n\n /* generates a random number on [0,0x7fffffff]-interval */\n //c//long genrand_int31(void)\n this.genrand_int31 = function () {\n //c//return (genrand_int32()>>1);\n return this.genrand_int32() >>> 1;\n };\n\n /* generates a random number on [0,1]-real-interval */\n //c//double genrand_real1(void)\n this.genrand_real1 = function () {\n //c//return genrand_int32()*(1.0/4294967295.0);\n return this.genrand_int32() * (1.0 / 4294967295.0);\n /* divided by 2^32-1 */\n };\n\n /* generates a random number on [0,1)-real-interval */\n //c//double genrand_real2(void)\n this.genrand_real2 = function () {\n //c//return genrand_int32()*(1.0/4294967296.0);\n return this.genrand_int32() * (1.0 / 4294967296.0);\n /* divided by 2^32 */\n };\n\n /* generates a random number on (0,1)-real-interval */\n //c//double genrand_real3(void)\n this.genrand_real3 = function () {\n //c//return ((genrand_int32()) + 0.5)*(1.0/4294967296.0);\n return (this.genrand_int32() + 0.5) * (1.0 / 4294967296.0);\n /* divided by 2^32 */\n };\n\n /* generates a random number on [0,1) with 53-bit resolution*/\n //c//double genrand_res53(void)\n this.genrand_res53 = function () {\n //c//unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;\n var a = this.genrand_int32() >>> 5,\n b = this.genrand_int32() >>> 6;\n return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0);\n };\n /* These real versions are due to Isaku Wada, 2002/01/09 added */\n}\n\n// Exports: Public API\n\n// Export the twister class\n//exports.MersenneTwister19937 = MersenneTwister19937;\nvar _default = exports[\"default\"] = MersenneTwister19937;\n\n},{}],25:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generateTiledJSON;\nfunction generateTiledJSON(tileMap) {\n var layers = [];\n // Check if tileMap.data is a 3D array\n if (typeof tileMap.data[0][0] !== 'undefined') {\n var depth = tileMap.data.length; // Assuming the depth is the first dimension of the 3D array\n for (var z = 0; z < depth; z++) {\n layers.push({\n \"data\": tileMap.data[z].flat(),\n // Flatten the 2D array to 1D for the layer data\n \"height\": tileMap.height,\n \"id\": z + 1,\n // ID should be unique for each layer, hence z + 1\n \"name\": \"Tile Layer \".concat(z + 1),\n \"opacity\": 1,\n \"type\": \"tilelayer\",\n \"visible\": true,\n \"width\": tileMap.width,\n \"x\": 0,\n \"y\": 0,\n \"parallaxoriginy\": z / depth // Set the parallaxoriginy based on z-index\n });\n }\n } else {\n // If it's not a 3D array, just use the original layer\n layers.push({\n \"data\": tileMap.data,\n \"height\": tileMap.height,\n \"id\": 1,\n \"name\": \"Tile Layer 1\",\n \"opacity\": 1,\n \"type\": \"tilelayer\",\n \"visible\": true,\n \"width\": tileMap.width,\n \"x\": 0,\n \"y\": 0\n });\n }\n var tiledJSON = {\n \"compressionlevel\": -1,\n \"height\": tileMap.height,\n \"infinite\": false,\n \"layers\": layers,\n \"nextlayerid\": layers.length + 1,\n \"nextobjectid\": 1,\n \"orientation\": \"orthogonal\",\n \"renderorder\": \"right-down\",\n \"tiledversion\": \"1.10.2\",\n \"tileheight\": 16,\n \"tilesets\": [{\n \"columns\": 0,\n \"firstgid\": 1,\n \"grid\": {\n \"height\": 1,\n \"orientation\": \"orthogonal\",\n \"width\": 1\n },\n \"margin\": 0,\n \"name\": \"grass-land\",\n \"spacing\": 0,\n \"tilecount\": 2,\n \"tileheight\": 16,\n \"tiles\": [\n // Custom tile set mappings\n ],\n \"tilewidth\": 16\n }],\n \"tilewidth\": 16,\n \"type\": \"map\",\n \"version\": \"1.10\",\n \"width\": tileMap.width\n };\n tiledJSON.tilesets[0].tiles = [\n // TODO: custom tile set mappings\n {\n \"id\": 0,\n \"image\": \"tile-bush.png\",\n \"imageheight\": 16,\n \"imagewidth\": 16\n }, {\n \"id\": 1,\n \"image\": \"tile-grass.png\",\n \"imageheight\": 16,\n \"imagewidth\": 16\n }, {\n \"id\": 2,\n \"image\": \"tile-block.png\",\n \"imageheight\": 16,\n \"imagewidth\": 16\n }, {\n \"id\": 3,\n \"image\": \"tile-path-brown.png\",\n \"imageheight\": 16,\n \"imagewidth\": 16\n }, {\n \"id\": 4,\n \"image\": \"tile-path-green.png\",\n \"imageheight\": 16,\n \"imagewidth\": 16\n }];\n return tiledJSON;\n}\n\n/* infinite style map with chunks\n \"editorsettings\": {\n \"chunksize\": {\n \"height\": 8,\n \"width\": 8\n }\n },\n\n \"layers\": [{\n \"chunks\": [{\n \"data\": tileMap.data, // Your tileMap data\n \"height\": tileMap.height,\n \"width\": tileMap.width,\n \"x\": 0,\n \"y\": 0\n }],\n \"height\": tileMap.height,\n \"name\": \"Tile Layer 1\",\n \"opacity\": 1,\n \"startx\": 0,\n \"starty\": 0,\n \"type\": \"tilelayer\",\n \"visible\": true,\n \"width\": tileMap.width,\n \"x\": 0,\n \"y\": 0\n }],\n */\n\n},{}],26:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _MersenneTwister = _interopRequireDefault(require(\"./MersenneTwister19937.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); } // var Gen = require('../vendor/mersenne').MersenneTwister19937;\nfunction Mersenne() {\n var gen = new _MersenneTwister[\"default\"]();\n var seed = new Date().getTime() % 1000000000;\n this.currentSeed = seed;\n gen.init_genrand(seed);\n this.rand = function (max, min) {\n if (typeof max === 'undefined') {\n return gen.genrand_real2(); // Returns a floating-point number between 0 and 1\n }\n if (typeof min === 'undefined') {\n min = 0;\n }\n return Math.floor(gen.genrand_real2() * (max - min) + min);\n };\n this.seed = function (S) {\n // check incoming value of seed and coherce to number\n // try to convert seed to number, if not number, consider as string\n var _seed = Number(S);\n if (isNaN(_seed)) {\n // convert into hash\n _seed = this.stringToSeed(S);\n }\n if (typeof _seed != 'number') {\n throw new Error(\"seed(S) must take numeric argument; is \" + _typeof(S));\n }\n this.currentSeed = _seed;\n gen.init_genrand(_seed);\n };\n this.seed_array = function (A) {\n if (_typeof(A) != 'object') {\n throw new Error(\"seed_array(A) must take array of numbers; is \" + _typeof(A));\n }\n this.currentSeed = A;\n gen.init_by_array(A, A.length);\n };\n this.stringToSeed = function (str) {\n // Simple hash function to convert a string to a number\n var hash = 0;\n for (var i = 0; i < str.length; i++) {\n var _char = str.charCodeAt(i);\n hash = (hash << 5) - hash + _char;\n hash = hash & hash; // Convert to 32bit integer\n }\n return hash;\n };\n}\nvar _default = exports[\"default\"] = Mersenne;\n\n},{\"./MersenneTwister19937.js\":24}],27:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n//////////////////////////////////////////////////////////////\n// From p5.js - LGPL-2.1 license\n// https://github.com/processing/p5.js\n// https://github.com/processing/p5.js/blob/3d45ce9b130a007668bfac7768fbcdd6b8ff41ec/src/math/noise.js\n// http://mrl.nyu.edu/~perlin/noise/\n// Adapting from PApplet.java\n// which was adapted from toxi\n// which was adapted from the german demo group farbrausch\n// as used in their demo \"art\": http://www.farb-rausch.de/fr010src.zip\n\n// someday we might consider using \"improved noise\"\n// http://mrl.nyu.edu/~perlin/paper445.pdf\n// See: https://github.com/shiffman/The-Nature-of-Code-Examples-p5.js/\n// blob/main/introduction/Noise1D/noise.js\n\n/**\n * @module Math\n * @submodule Noise\n * @for p5\n * @requires core\n */\n\nvar p5 = function p5() {};\nvar PERLIN_YWRAPB = 4;\nvar PERLIN_YWRAP = 1 << PERLIN_YWRAPB;\nvar PERLIN_ZWRAPB = 8;\nvar PERLIN_ZWRAP = 1 << PERLIN_ZWRAPB;\nvar PERLIN_SIZE = 4095;\nvar perlin_octaves = 4; // default to medium smooth\nvar perlin_amp_falloff = 0.5; // 50% reduction/octave\n\nvar scaled_cosine = function scaled_cosine(i) {\n return 0.5 * (1.0 - Math.cos(i * Math.PI));\n};\nvar perlin; // will be initialized lazily by noise() or noiseSeed()\n\n/**\n * Returns random numbers that can be tuned to feel more organic. The values\n * returned will always be between 0 and 1.\n *\n * Values returned by random() and\n * randomGaussian() can change by large\n * amounts between function calls. By contrast, values returned by `noise()`\n * can be made \"smooth\". Calls to `noise()` with similar inputs will produce\n * similar outputs. `noise()` is used to create textures, motion, shapes,\n * terrains, and so on. Ken Perlin invented `noise()` while animating the\n * original Tron film in the 1980s.\n *\n * `noise()` returns the same value for a given input while a sketch is\n * running. It produces different results each time a sketch runs. The\n * noiseSeed() function can be used to generate\n * the same sequence of Perlin noise values each time a sketch runs.\n *\n * The character of the noise can be adjusted in two ways. The first way is to\n * scale the inputs. `noise()` interprets inputs as coordinates. The sequence\n * of noise values will be smoother when the input coordinates are closer. The\n * second way is to use the noiseDetail()\n * function.\n *\n * The version of `noise()` with one parameter computes noise values in one\n * dimension. This dimension can be thought of as space, as in `noise(x)`, or\n * time, as in `noise(t)`.\n *\n * The version of `noise()` with two parameters computes noise values in two\n * dimensions. These dimensions can be thought of as space, as in\n * `noise(x, y)`, or space and time, as in `noise(x, t)`.\n *\n * The version of `noise()` with three parameters computes noise values in\n * three dimensions. These dimensions can be thought of as space, as in\n * `noise(x, y, z)`, or space and time, as in `noise(x, y, t)`.\n *\n * @method noise\n * @param {Number} x x-coordinate in noise space.\n * @param {Number} [y] y-coordinate in noise space.\n * @param {Number} [z] z-coordinate in noise space.\n * @return {Number} Perlin noise value at specified coordinates.\n * @example\n *
\n * \n * function draw() {\n * background(200);\n *\n * let x = 100 * noise(0.005 * frameCount);\n * let y = 100 * noise(0.005 * frameCount + 10000);\n *\n * strokeWeight(5);\n * point(x, y);\n *\n * describe('A black dot moves randomly on a gray square.');\n * }\n * \n *
\n *\n *
\n * \n * function draw() {\n * background(200);\n *\n * let noiseLevel = 100;\n * let noiseScale = 0.005;\n * // Scale input coordinate.\n * let nt = noiseScale * frameCount;\n * // Compute noise value.\n * let x = noiseLevel * noise(nt);\n * let y = noiseLevel * noise(nt + 10000);\n * // Render.\n * strokeWeight(5);\n * point(x, y);\n *\n * describe('A black dot moves randomly on a gray square.');\n * }\n * \n *
\n *\n *
\n * \n * function draw() {\n * let noiseLevel = 100;\n * let noiseScale = 0.02;\n * // Scale input coordinate.\n * let x = frameCount;\n * let nx = noiseScale * x;\n * // Compute noise value.\n * let y = noiseLevel * noise(nx);\n * // Render.\n * line(x, 0, x, y);\n *\n * describe('A hilly terrain drawn in gray against a black sky.');\n * }\n * \n *
\n *\n *
\n * \n * function draw() {\n * background(200);\n *\n * let noiseLevel = 100;\n * let noiseScale = 0.002;\n * for (let x = 0; x < width; x += 1) {\n * // Scale input coordinates.\n * let nx = noiseScale * x;\n * let nt = noiseScale * frameCount;\n * // Compute noise value.\n * let y = noiseLevel * noise(nx, nt);\n * // Render.\n * line(x, 0, x, y);\n * }\n *\n * describe('A calm sea drawn in gray against a black sky.');\n * }\n * \n *
\n *\n *
\n * \n * let noiseLevel = 255;\n * let noiseScale = 0.01;\n * for (let y = 0; y < height; y += 1) {\n * for (let x = 0; x < width; x += 1) {\n * // Scale input coordinates.\n * let nx = noiseScale * x;\n * let ny = noiseScale * y;\n * // Compute noise value.\n * let c = noiseLevel * noise(nx, ny);\n * // Render.\n * stroke(c);\n * point(x, y);\n * }\n * }\n *\n * describe('A gray cloudy pattern.');\n * \n *
\n *\n *
\n * \n * function draw() {\n * let noiseLevel = 255;\n * let noiseScale = 0.009;\n * for (let y = 0; y < height; y += 1) {\n * for (let x = 0; x < width; x += 1) {\n * // Scale input coordinates.\n * let nx = noiseScale * x;\n * let ny = noiseScale * y;\n * let nt = noiseScale * frameCount;\n * // Compute noise value.\n * let c = noiseLevel * noise(nx, ny, nt);\n * // Render.\n * stroke(c);\n * point(x, y);\n * }\n * }\n *\n * describe('A gray cloudy pattern that changes.');\n * }\n * \n *
\n */\n\np5.prototype.noise = function () {\n var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n if (perlin == null) {\n perlin = new Array(PERLIN_SIZE + 1);\n for (var i = 0; i < PERLIN_SIZE + 1; i++) {\n perlin[i] = Math.random();\n }\n }\n if (x < 0) {\n x = -x;\n }\n if (y < 0) {\n y = -y;\n }\n if (z < 0) {\n z = -z;\n }\n var xi = Math.floor(x),\n yi = Math.floor(y),\n zi = Math.floor(z);\n var xf = x - xi;\n var yf = y - yi;\n var zf = z - zi;\n var rxf, ryf;\n var r = 0;\n var ampl = 0.5;\n var n1, n2, n3;\n for (var o = 0; o < perlin_octaves; o++) {\n var of = xi + (yi << PERLIN_YWRAPB) + (zi << PERLIN_ZWRAPB);\n rxf = scaled_cosine(xf);\n ryf = scaled_cosine(yf);\n n1 = perlin[of & PERLIN_SIZE];\n n1 += rxf * (perlin[of + 1 & PERLIN_SIZE] - n1);\n n2 = perlin[of + PERLIN_YWRAP & PERLIN_SIZE];\n n2 += rxf * (perlin[of + PERLIN_YWRAP + 1 & PERLIN_SIZE] - n2);\n n1 += ryf * (n2 - n1);\n of += PERLIN_ZWRAP;\n n2 = perlin[of & PERLIN_SIZE];\n n2 += rxf * (perlin[of + 1 & PERLIN_SIZE] - n2);\n n3 = perlin[of + PERLIN_YWRAP & PERLIN_SIZE];\n n3 += rxf * (perlin[of + PERLIN_YWRAP + 1 & PERLIN_SIZE] - n3);\n n2 += ryf * (n3 - n2);\n n1 += scaled_cosine(zf) * (n2 - n1);\n r += n1 * ampl;\n ampl *= perlin_amp_falloff;\n xi <<= 1;\n xf *= 2;\n yi <<= 1;\n yf *= 2;\n zi <<= 1;\n zf *= 2;\n if (xf >= 1.0) {\n xi++;\n xf--;\n }\n if (yf >= 1.0) {\n yi++;\n yf--;\n }\n if (zf >= 1.0) {\n zi++;\n zf--;\n }\n }\n return r;\n};\n\n/**\n * Adjusts the character of the noise produced by the\n * noise() function.\n *\n * Perlin noise values are created by adding layers of noise together. The\n * noise layers, called octaves, are similar to harmonics in music. Lower\n * octaves contribute more to the output signal. They define the overall\n * intensity of the noise. Higher octaves create finer-grained details.\n *\n * By default, noise values are created by combining four octaves. Each higher\n * octave contributes half as much (50% less) compared to its predecessor.\n * `noiseDetail()` changes the number of octaves and the falloff amount. For\n * example, calling `noiseDetail(6, 0.25)` ensures that\n * noise() will use six octaves. Each higher octave\n * will contribute 25% as much (75% less) compared to its predecessor. Falloff\n * values between 0 and 1 are valid. However, falloff values greater than 0.5\n * might result in noise values greater than 1.\n *\n * @method noiseDetail\n * @param {Number} lod number of octaves to be used by the noise.\n * @param {Number} falloff falloff factor for each octave.\n * @example\n *
\n * \n * let noiseLevel = 255;\n * let noiseScale = 0.02;\n * for (let y = 0; y < height; y += 1) {\n * for (let x = 0; x < width / 2; x += 1) {\n * // Scale input coordinates.\n * let nx = noiseScale * x;\n * let ny = noiseScale * y;\n *\n * // Compute noise value.\n * noiseDetail(6, 0.25);\n * let c = noiseLevel * noise(nx, ny);\n * // Render left side.\n * stroke(c);\n * point(x, y);\n *\n * // Compute noise value.\n * noiseDetail(4, 0.5);\n * c = noiseLevel * noise(nx, ny);\n * // Render right side.\n * stroke(c);\n * point(x + width / 2, y);\n * }\n * }\n *\n * describe('Two gray cloudy patterns. The pattern on the right is cloudier than the pattern on the left.');\n * \n *
\n */\np5.prototype.noiseDetail = function (lod, falloff) {\n if (lod > 0) {\n perlin_octaves = lod;\n }\n if (falloff > 0) {\n perlin_amp_falloff = falloff;\n }\n};\n\n/**\n * Sets the seed value for noise(). By default,\n * noise() produces different results each time\n * a sketch is run. Calling `noiseSeed()` with a constant\n * argument, such as `noiseSeed(99)`, makes noise()\n * produce the same results each time a sketch is run.\n *\n * @method noiseSeed\n * @param {Number} seed seed value.\n * @example\n *
\n * \n * function setup() {\n * noiseSeed(99);\n * background(255);\n * }\n *\n * function draw() {\n * let noiseLevel = 100;\n * let noiseScale = 0.005;\n * // Scale input coordinate.\n * let nt = noiseScale * frameCount;\n * // Compute noise value.\n * let x = noiseLevel * noise(nt);\n * // Render.\n * line(x, 0, x, height);\n *\n * describe('A black rectangle that grows randomly, first to the right and then to the left.');\n * }\n * \n *
\n */\np5.prototype.noiseSeed = function (seed) {\n // Linear Congruential Generator\n // Variant of a Lehman Generator\n var lcg = function () {\n // Set to values from http://en.wikipedia.org/wiki/Numerical_Recipes\n // m is basically chosen to be large (as it is the max period)\n // and for its relationships to a and c\n var m = 4294967296;\n // a - 1 should be divisible by m's prime factors\n var a = 1664525;\n // c and m should be co-prime\n var c = 1013904223;\n var seed, z;\n return {\n setSeed: function setSeed(val) {\n // pick a random seed if val is undefined or null\n // the >>> 0 casts the seed to an unsigned 32-bit integer\n z = seed = (val == null ? Math.random() * m : val) >>> 0;\n },\n getSeed: function getSeed() {\n return seed;\n },\n rand: function rand() {\n // define the recurrence relationship\n z = (a * z + c) % m;\n // return a float in [0, 1)\n // if z = m then z / m = 0 therefore (z % m) / m < 1 always\n return z / m;\n }\n };\n }();\n lcg.setSeed(seed);\n perlin = new Array(PERLIN_SIZE + 1);\n for (var i = 0; i < PERLIN_SIZE + 1; i++) {\n perlin[i] = lcg.rand();\n }\n};\nvar _default = exports[\"default\"] = p5;\n\n},{}]},{},[1])(1)\n});\n"],"names":["f","exports","module","define","amd","window","global","self","this","LABY","r","e","n","t","o","i","c","require","u","a","Error","code","p","call","length","1","Object","defineProperty","value","enumerable","get","_Tile","_TileMap","_labyrinthos","utils","terrains","shapes","mazes","_interopRequireDefault","obj","__esModule","default","./lib/Tile.js","./lib/TileMap.js","./lib/labyrinthos.js","2","_typeof","Symbol","iterator","constructor","prototype","_defineProperties","target","props","descriptor","configurable","writable","toPrimitive","String","Number","TypeError","key","Biome","_ref","arguments","undefined","name","tileset","_ref$distribution","distribution","instance","Constructor","protoProps","staticProps","3","LSystem","axiom","rules","generations","tileName","tile","getTileByName","id","tileId","tileMap","resultTiles","context","_this$tileset$getTile","getTile","getTileId","bind","random","max","width","height","depth","getNeighbors","x","y","getTileAt","position","Math","floor","z","split","_this","gen","data","map","applyRule","4","_createClass","Tile","5","_generateTiledJSON","_mersenne","_noise","_toConsumableArray","arr","Array","isArray","_arrayLikeToArray","iter","from","minLen","toString","slice","test","len","arr2","TileMap","_ref$x","_ref$y","_ref$width","_ref$height","_ref$depth","_ref$tileWidth","tileWidth","_ref$tileHeight","tileHeight","is3D","mersenneTwister","Noise","noise","seedNoise","noiseSeed","initializeDataArray","defaultRogueLike","seedRandom","push","init2DArray","fill3D","fill2D","rand","seed","subMap","offsetX","offsetY","targetX","targetY","tileSetRange","heightMap","apply","min","range","normalizedHeight","round","format","asciiMasks","asciiLookup","asciiMap","_asciiMap","_asciiLookup","_y","_x","biome","noiseValues","weights","tileNames","keys","totalWeight","reduce","total","weightedRanges","index","end","sum","_loop","noiseValue","selectedTileName","find","JSON","stringify","_ref2","results","queryX","queryY","subsection","_ref3","offsetZ","queryZ","getTileIdByName","filter","positions","layer","fill","./util/generateTiledJSON.js","./util/mersenne.js","./util/noise.js","6","TileSet","_ref$tiles","tiles","7","_TileSet","_Biome","_AldousBroder","_AldousBroder3D","_BinaryTree","_CellularAutomata","_EllersAlgorithm","_GrowingTree","_RecursiveBacktrack","_RecursiveDivision","_ThomasHunter","_BeattieSchoberth","_Metroidvania","_Circle","_Square","_Triangle","_LSystem","_FaultLine","_PerlinNoise","labyrinthos","AldousBroder","AldousBroder3D","BinaryTree","CellularAutomata","EllersAlgorithm","GrowingTree","RecursiveBacktrack","RecursiveDivision","BeattieSchoberth","ThomasHunter","Metroidvania","PlatformZones","Circle","Square","Triangle","FaultLine","PerlinNoise","./Biome.js","./LSystem.js","./Tile.js","./TileMap.js","./TileSet.js","./mazes/AldousBroder.js","./mazes/AldousBroder3D.js","./mazes/BeattieSchoberth.js","./mazes/BinaryTree.js","./mazes/CellularAutomata.js","./mazes/EllersAlgorithm.js","./mazes/GrowingTree.js","./mazes/Metroidvania.js","./mazes/RecursiveBacktrack.js","./mazes/RecursiveDivision.js","./mazes/ThomasHunter.js","./shapes/Circle.js","./shapes/Square.js","./shapes/Triangle.js","./terrains/FaultLine.js","./terrains/PerlinNoise.js","8","options","visitedCells","totalCells","currentX","currentY","directions","randomDirection","newX","newY","9","currentZ","newZ","10","_createForOfIteratorHelper","allowArrayLike","normalCompletion","didErr","err","it","s","step","next","done","_e2","F","_e","_classCallCheck","BeattieSchoberthBuilder","fractional","sqrt","built","rooms","special","roomHeight","roomWidth","build","flattened","world","agg","line","concat","lcv","toCharGrid","DIR","maxRooms","maxKeys","console","error","generate","reset","NULL_KEY","KEY_COLORS","0","generated","grid","result","size","row1","row2","color","roomId","room","keyInRoom","entrance","exit","padStart","doors","MAX_X","MAX_Y","bounds","w","furthest","Map","lockPool","maxDistance","addRoom","_parentRoomId","_parentRoomId3","dir","parentRoom","newRoomId","parentRoomId","_parentRoomId2","addDoor","CHILD_THRESHOLD","roomToBeLocked","getHighestDistanceRoom","setExit","_i","ascended","findRoomParentWithAtMostChildren","removeRoomAndChildrenFromLockPool","decrementChildrenCountAllParents","roomToPutKeyIn","lock","_this$squish","squish","generateGrid","classifyRooms","terminals","deadends","children","childrenCount","parent","d","_step","xShift","yShift","_iterator","stretch","further","Set","template","distance","mostNorth","mostEast","set","mostSouth","mostWest","_step2","_iterator2","childRoomId","childRoom","doorId","orientation","add","increaseChildrenCountAllParents","registerRoomDistanceLockPool","pool","collection","values","count","decrementCount","removeFromLockPool","_step3","_iterator3","child","door","location","keyId","row","addRoomToGrid","_step4","_iterator4","TILE","Grid","str","subgrid","col","max_width","max_height","chars","join","config","adventure","maxHeight","maxWidth","opt","output","rendered","buildRoom","emptyRoom","overlay","_this2","inDoorRange","half","odd","halfRange","lines","_this3","adventureBuild","renderWorld","11","dx","neighbors","randomIndex","_neighbors$randomInde","l","dy","12","wallChance","iterations","neighborThreshold","newData","wallNeighbors","nx","ny","13","sets","findSet","cells","unionSets","x1","y1","x2","y2","set1","set2","forEach","cellId","setVisited","currentSet","_x2","14","_slicedToArray","floorTileId","nextX","_cellsStack","cellsStack","cx","cy","nextY","pop","15","maxDimension","doorDiff","roomSizeHeight","roomSizeWidth","numRoomsWide","numRoomsHigh","maxCount","minCount","maxFails","gridHeight","gridWidth","minZonesPerRoom","maxZonesPerRoom","minRoomsPerMap","maxRoomsPerMap","newDoors","roomDiff","roomDiffOdds","WALL","DOOR","OPEN","DIRECTIONS","incoming","edges","platformGenerator","roomData","MAP_WIDTH","MAP_HEIGHT","MIN_ZONES_PER_ROOM","MAX_ZONES_PER_ROOM","MIN_ROOMS_PER_MAP","MAX_ROOMS_PER_MAP","NEW_DOOR_MIN_THRESHOLD","ROOM_ID_DIFF_RANDOM_DOOR_THRESHOLD","ROOM_ID_DIFF_RANDOM_DOOR_ODDS","failCount","number_of_rooms","rangedRandom","cursor","exits","zone_id","all_room_zones","number_of_zones","zones_in_this_room","zone_number","zone","open","moveCursor","_zones_in_this_room","buildWallsForZone","loc","zones","shuffle","current_zone","newZone","buildDoorBetweenZones","new_door_count","_i2","_all_room_zones","this_room_id","comparedZone","coords","abs","_i3","_DIRECTIONS","newCursor","adjacents","direction","zonePos1","zonePos2","zone1","zone2","log","array","j","tempi","tempj","16","visited","removeWall","index1","index2","stack","startX","startY","visitCell","_stack","_neighbors$Math$floor","17","addWalls","horizontal","wx","wy","px","py","18","roomNumber","rangius","ceil","Roguelike","retry","ideal","roomCount","min_width","roomMinWidth","roomMaxWidth","min_height","roomMinHeight","DEFAULT","room_min_width","room_max_width","room_min_height","room_max_height","room_ideal_count","retry_count","want_special","walls","enter","room_id","door_id","createVoid","addStarterRoom","generateRooms","addSpecialRooms","buildWalls","door_count","room_count","dimen","getRoomDimensions","max_left","ROOM_GAP","max_top","left","randomOdd","top","retries","generateRoom","slide","randomFn","x_dir","y_dir","collides","collide_room","invalid","new_room_id","addDoorBetweenRooms","tx","addWall","ry","bx","ly","existing_room_id","existing_room","new_room","smallest","area","Infinity","deadend","indexOf","splice","exit_door","enter_room_id","randomNonEdgeInRoom","enter_door","exit_room_id","room1","room2","min_raw","max_raw","19","radius","centerX","centerY","pow","20","21","22","heightIncrease","b","applyHeightToTileMap","23","scale","24","N","UPPER_MASK","LOWER_MASK","mt","mti","unsigned32","n1","addition32","n2","multiplication32","init_genrand","init_by_array","init_key","key_length","k","dbg","mag01","genrand_int32","kk","M","genrand_int31","genrand_real1","genrand_real2","genrand_real3","genrand_res53","25","layers","flat","opacity","type","visible","parallaxoriginy","tiledJSON","compressionlevel","infinite","nextlayerid","nextobjectid","renderorder","tiledversion","tileheight","tilesets","columns","firstgid","margin","spacing","tilecount","tilewidth","version","image","imageheight","imagewidth","26","_MersenneTwister","Date","getTime","currentSeed","S","_seed","isNaN","stringToSeed","seed_array","A","hash","charCodeAt","./MersenneTwister19937.js","27","p5","scaled_cosine","cos","PI","perlin","PERLIN_SIZE","perlin_octaves","perlin_amp_falloff","n3","xi","yi","zi","xf","yf","zf","ampl","of","rxf","ryf","noiseDetail","lod","falloff","m","lcg","setSeed","val","getSeed"],"mappings":"AAAA,CAAA,SAAUA,GAAuB,UAAjB,OAAOC,SAAoC,aAAhB,OAAOC,OAAsBA,OAAOD,QAAQD,EAAE,EAA0B,YAAhB,OAAOG,QAAqBA,OAAOC,IAAKD,OAAO,GAAGH,CAAC,GAAgC,aAAhB,OAAOK,OAAwBA,OAA+B,aAAhB,OAAOC,OAAwBA,OAA6B,aAAd,OAAOC,KAAsBA,KAAYC,MAAOC,KAAOT,EAAE,CAAG,EAAE,WAAqC,OAAmB,SAASU,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEf,GAAG,GAAG,CAACY,EAAEG,GAAG,CAAC,GAAG,CAACJ,EAAEI,GAAG,CAAC,IAAIC,EAAE,YAAY,OAAOC,SAASA,QAAQ,GAAG,CAACjB,GAAGgB,EAAE,OAAOA,EAAED,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AAMnD,EALN+oB,EAJFC,EAUK,CACLC,QAAS,SAAiBC,GAGxBlpB,EAAImD,GAAe,MAAP+lB,EAAcppB,KAAKV,OAAO,EAAI2pB,EAAIG,KAAS,CACzD,EACAC,QAAS,WACP,OAAOhmB,CACT,EACAD,KAAM,WAKJ,OAHAlD,GAfI,QAeKA,EAbL,YAac+oB,GAGPA,CACb,CACF,EAEFC,EAAIC,QAAQ9lB,CAAI,EAChB0kB,EAAS,IAAI7mB,MAAM8mB,IAAe,EAClC,IAAK,IAAIttB,EAAI,EAAGA,EAAIstB,KAAiBttB,CAAC,GACpCqtB,EAAOrtB,GAAKwuB,EAAI9lB,KAAK,CAEzB,EACexJ,EAAiB,QAAI+tB,CAEpC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAChB,CAAC"} \ No newline at end of file +{"version":3,"sourceRoot":"../","sources":["./dist/labyrinthos.js"],"sourcesContent":["(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.LABY = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i 0 && arguments[0] !== undefined ? arguments[0] : {},\n name = _ref.name,\n tileset = _ref.tileset,\n _ref$distribution = _ref.distribution,\n distribution = _ref$distribution === void 0 ? {} : _ref$distribution;\n _classCallCheck(this, Biome);\n this.name = name;\n this.tileset = tileset; // An instance of TileSet\n this.distribution = distribution; // Key: tile ID, Value: weight\n }\n\n // Method to set weighted distribution for tiles\n _createClass(Biome, [{\n key: \"setDistribution\",\n value: function setDistribution(distribution) {\n this.distribution = distribution;\n }\n }]);\n return Biome;\n}();\n\n},{}],3:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar LSystem = exports[\"default\"] = /*#__PURE__*/function () {\n function LSystem(_ref) {\n var tileset = _ref.tileset,\n axiom = _ref.axiom,\n rules = _ref.rules,\n generations = _ref.generations;\n _classCallCheck(this, LSystem);\n this.tileset = tileset; // TileSet instance\n this.axiom = axiom; // Initial state (as a tile name)\n this.rules = rules; // Transformation rules (using tile names)\n this.generations = generations; // Number of iterations\n }\n\n // Helper function to resolve a tile name to its ID using the TileSet\n _createClass(LSystem, [{\n key: \"getTileId\",\n value: function getTileId(tileName) {\n var tile = this.tileset.getTileByName(tileName);\n return tile ? tile.id : null; // Return null if tile name not found in TileSet\n }\n }, {\n key: \"applyRule\",\n value: function applyRule(tileId, tileMap) {\n var _this$tileset$getTile;\n // Resolve the tile ID to its name\n var tileName = (_this$tileset$getTile = this.tileset.getTile(tileId)) === null || _this$tileset$getTile === void 0 ? void 0 : _this$tileset$getTile.name;\n\n // If there's a rule for this tile, apply it\n if (tileName && this.rules[tileName]) {\n var resultTiles;\n\n // Create a context object to pass to the rule function\n var context = {\n // Current tile's properties\n tileId: tileId,\n tileName: tileName,\n // Function to get the ID of a tile by name\n getTileId: this.getTileId.bind(this),\n // Random function utility\n random: function random(max) {\n var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n return tileMap.random(max, min);\n },\n // Information about the tile map\n tileMap: {\n width: tileMap.width,\n height: tileMap.height,\n depth: tileMap.depth || 0 // Assuming depth property exists for 3D maps\n },\n // Function to get neighboring tiles (example for 2D, extend for 3D if needed)\n getNeighbors: function getNeighbors(x, y) {\n return [tileMap.getTileAt(x + 1, y),\n // Right\n tileMap.getTileAt(x - 1, y),\n // Left\n tileMap.getTileAt(x, y + 1),\n // Bottom\n tileMap.getTileAt(x, y - 1) // Top\n // Add more directions as needed, e.g., diagonal neighbors\n ];\n },\n // Current position (assuming you can derive x, y, z from tileId)\n position: {\n x: tileId % tileMap.width,\n y: Math.floor(tileId / tileMap.width),\n z: tileMap.depth ? Math.floor(tileId / (tileMap.width * tileMap.height)) : 0 // For 3D maps\n }\n };\n if (typeof this.rules[tileName] === 'function') {\n resultTiles = [this.rules[tileName](context)]; // returns string\n }\n if (typeof this.rules[tileName] === 'string') {\n resultTiles = this.rules[tileName].split(' ');\n }\n\n // For simplicity, let's just use the first tile specified in the rule\n // More complex logic could be added here to handle multiple tiles\n return this.getTileId(resultTiles[0]);\n }\n\n // Default to no change if no rule exists for this tile\n return tileId;\n }\n }, {\n key: \"applyTo\",\n value: function applyTo(tileMap) {\n var _this = this;\n for (var gen = 0; gen < this.generations; gen++) {\n // Apply rules to each tile in the map for each generation\n tileMap.data = tileMap.data.map(function (tileId) {\n return _this.applyRule(tileId, tileMap);\n });\n }\n }\n }]);\n return LSystem;\n}();\n\n},{}],4:[function(require,module,exports){\n\"use strict\";\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n// Not actually used anywhere\n// Tiles are currently just a data structure, so they don't need to be instantiated\nvar Tile = exports[\"default\"] = /*#__PURE__*/_createClass(function Tile() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n id = _ref.id,\n name = _ref.name;\n _classCallCheck(this, Tile);\n this.id = id;\n this.name = name;\n});\n\n},{}],5:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _generateTiledJSON = _interopRequireDefault(require(\"./util/generateTiledJSON.js\"));\nvar _mersenne = _interopRequireDefault(require(\"./util/mersenne.js\"));\nvar _noise = _interopRequireDefault(require(\"./util/noise.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); } // Exports to Tiled Editor JSON format\n// Randomness\n// Perlin Noise\nvar TileMap = exports[\"default\"] = /*#__PURE__*/function () {\n function TileMap() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref$x = _ref.x,\n x = _ref$x === void 0 ? 0 : _ref$x,\n _ref$y = _ref.y,\n y = _ref$y === void 0 ? 0 : _ref$y,\n _ref$width = _ref.width,\n width = _ref$width === void 0 ? 16 : _ref$width,\n _ref$height = _ref.height,\n height = _ref$height === void 0 ? 16 : _ref$height,\n _ref$depth = _ref.depth,\n depth = _ref$depth === void 0 ? 1 : _ref$depth,\n _ref$tileWidth = _ref.tileWidth,\n tileWidth = _ref$tileWidth === void 0 ? 16 : _ref$tileWidth,\n _ref$tileHeight = _ref.tileHeight,\n tileHeight = _ref$tileHeight === void 0 ? 16 : _ref$tileHeight,\n _ref$is3D = _ref.is3D,\n is3D = _ref$is3D === void 0 ? false : _ref$is3D;\n _classCallCheck(this, TileMap);\n this.x = x;\n this.y = y;\n // this.z = 0;\n this.width = width;\n this.height = height;\n this.depth = depth;\n this.tileWidth = tileWidth;\n this.tileHeight = tileHeight;\n this.mersenneTwister = new _mersenne[\"default\"]();\n this.Noise = new _noise[\"default\"]();\n this.noise = this.Noise.noise;\n this.seedNoise = this.Noise.noiseSeed;\n this.data = this.initializeDataArray();\n // ASCII representations for tiles 0-10\n // TODO: Is there a better default set of ASCII characters we can use?\n this.defaultRogueLike = ['-', '#', '+', '0', '<', '>', '$', '⌂', '@', '&', '?'];\n this.seedRandom();\n }\n _createClass(TileMap, [{\n key: \"initializeDataArray\",\n value: function initializeDataArray() {\n // Create a single-dimensional array\n var data;\n if (this.depth > 1) {\n data = init3DArray(this.width, this.height, this.depth);\n } else {\n data = init2DArray(this.width, this.height);\n }\n return data;\n }\n }, {\n key: \"fill\",\n value: function fill(value) {\n if (this.depth > 1) {\n for (var z = 0; z < this.depth; z++) {\n this.fill3D(value, z);\n }\n } else {\n this.fill2D(value);\n }\n }\n }, {\n key: \"fill2D\",\n value: function fill2D(value) {\n for (var i = 0; i < this.height * this.width; i++) {\n this.data[i] = value;\n }\n }\n }, {\n key: \"fill3D\",\n value: function fill3D(value, z) {\n for (var i = 0; i < this.height * this.width; i++) {\n this.data[z][i] = value;\n }\n }\n }, {\n key: \"random\",\n value: function random(max) {\n return this.mersenneTwister.rand(max);\n }\n }, {\n key: \"seed\",\n value: function seed(value) {\n if (typeof value === 'undefined') {\n value = this.random(6400000000);\n }\n this.mersenneTwister.seed(value);\n this.seedNoise(value);\n // this.mersenneTwister.seed_array([value]); // also can seed from arrays\n }\n }, {\n key: \"seedRandom\",\n value: function seedRandom() {\n this.seed(this.random(6400000000));\n }\n }, {\n key: \"use\",\n value: function use(subMap, offsetX, offsetY) {\n // TODO: add support for if(this.is3D) support\n for (var y = 0; y < subMap.height; y++) {\n for (var x = 0; x < subMap.width; x++) {\n var targetX = x + offsetX;\n var targetY = y + offsetY;\n if (targetX < this.width && targetY < this.height) {\n this.data[targetY * this.width + targetX] = subMap.data[y * subMap.width + x];\n }\n }\n }\n }\n }, {\n key: \"scaleToTileRange\",\n value: function scaleToTileRange(tileSetRange) {\n var heightMap = this.data;\n var max = Math.max.apply(Math, _toConsumableArray(heightMap));\n var min = Math.min.apply(Math, _toConsumableArray(heightMap));\n var range = tileSetRange - 1; // Adjust for zero index\n\n for (var i = 0; i < heightMap.length; i++) {\n var normalizedHeight = (heightMap[i] - min) / (max - min);\n this.data[i] = Math.round(normalizedHeight * range) + 1; // +1 to adjust range\n }\n }\n }, {\n key: \"mask\",\n value: function mask(format) {\n var asciiMasks = []; // Initialize an array to hold ASCII masks for each layer\n\n if (this.depth > 1) {\n var asciiLookup = format || this.defaultRogueLike;\n\n // Iterate through each layer of depth\n for (var z = 0; z < this.depth; z++) {\n var asciiMap = \"\";\n for (var y = 0; y < this.height; y++) {\n for (var x = 0; x < this.width; x++) {\n var tile = this.data[z][y * this.width + x]; // Access the correct layer in the 3D array\n asciiMap += asciiLookup[tile % asciiLookup.length]; // Use modulo to wrap around if tile index exceeds lookup table\n }\n asciiMap += '\\n'; // New line at the end of each row\n }\n asciiMasks.push(asciiMap); // Add the ASCII map of the current layer to the array\n }\n return asciiMasks; // Return the array of ASCII masks\n } else {\n // Handle the 2D case as before\n var _asciiMap = '';\n var _asciiLookup = format || this.defaultRogueLike;\n for (var _y = 0; _y < this.height; _y++) {\n for (var _x = 0; _x < this.width; _x++) {\n var _tile = this.data[_y * this.width + _x];\n _asciiMap += _asciiLookup[_tile % _asciiLookup.length];\n }\n _asciiMap += '\\n';\n }\n // For consistency, wrap the 2D mask in an array as well\n return [_asciiMap];\n }\n }\n }, {\n key: \"applyBiome\",\n value: function applyBiome(biome) {\n var tileMap = this;\n var noiseValues = tileMap.data; // Array of noise values\n var weights = biome.distribution; // Object with tile names as keys and weights as values\n var tileNames = Object.keys(weights); // Array of tile names\n var totalWeight = tileNames.reduce(function (total, name) {\n return total + weights[name];\n }, 0);\n var weightedRanges = tileNames.map(function (name, index) {\n return {\n name: name,\n end: tileNames.slice(0, index + 1).reduce(function (sum, name) {\n return sum + weights[name];\n }, 0) / totalWeight\n };\n });\n var _loop = function _loop() {\n var noiseValue = noiseValues[i];\n var selectedTileName = weightedRanges.find(function (range) {\n return noiseValue <= range.end;\n }).name;\n var tileId = biome.tileset.getTileByName(selectedTileName).id;\n tileMap.data[i] = tileId;\n };\n for (var i = 0; i < noiseValues.length; i++) {\n _loop();\n }\n }\n }, {\n key: \"getTileAt\",\n value: function getTileAt(x, y, z) {\n if (this.is3D) {\n return this.data[z][y * this.width + x];\n } else {\n return this.data[y * this.width + x];\n }\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n return JSON.stringify({\n width: this.width,\n height: this.height,\n tileWidth: this.tileWidth,\n tileHeight: this.tileHeight,\n data: this.data\n }, null, 2);\n }\n }, {\n key: \"toTiledJSON\",\n value: function toTiledJSON() {\n return (0, _generateTiledJSON[\"default\"])(this);\n }\n }, {\n key: \"query\",\n value: function query() {\n var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n x = _ref2.x,\n y = _ref2.y,\n width = _ref2.width,\n height = _ref2.height,\n z = _ref2.z,\n tileName = _ref2.tileName;\n var results = [];\n if (x !== undefined && y !== undefined && width !== undefined && height !== undefined) {\n for (var offsetY = 0; offsetY < height; offsetY++) {\n for (var offsetX = 0; offsetX < width; offsetX++) {\n var queryX = x + offsetX;\n var queryY = y + offsetY;\n if (queryX >= this.width || queryY >= this.height) {\n results.push(undefined); // Add undefined for out-of-bounds indices\n } else {\n var index = queryY * this.width + queryX; // Calculate the correct index in the 1D array\n if (this.is3D) {\n if (z !== undefined && this.data[z] && this.data[z][index] !== undefined) {\n results.push(this.data[z][index]);\n } else {\n results.push(undefined);\n }\n } else {\n if (this.data[index] !== undefined) {\n results.push(this.data[index]);\n } else {\n results.push(undefined);\n }\n }\n }\n }\n }\n }\n\n // create a new TileMap instance from the results\n var subsection = new TileMap({\n width: width,\n height: height,\n is3D: this.is3D\n });\n subsection.data = results;\n return subsection;\n }\n }, {\n key: \"query3D\",\n value:\n // query3D is WIP - not fully implemented yet, see: ./test/tilemap-query-test.js \n function query3D() {\n var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n x = _ref3.x,\n y = _ref3.y,\n z = _ref3.z,\n width = _ref3.width,\n height = _ref3.height,\n depth = _ref3.depth,\n tileName = _ref3.tileName;\n var results = [];\n if (x !== undefined && y !== undefined && z !== undefined && width !== undefined && height !== undefined && depth !== undefined) {\n for (var offsetZ = 0; offsetZ < depth; offsetZ++) {\n for (var offsetY = 0; offsetY < height; offsetY++) {\n for (var offsetX = 0; offsetX < width; offsetX++) {\n var queryX = x + offsetX;\n var queryY = y + offsetY;\n var queryZ = z + offsetZ;\n if (queryX >= this.width || queryY >= this.height || queryZ >= this.depth) {\n results.push(undefined); // Add undefined for out-of-bounds indices\n } else {\n // Calculate the correct index in the 3D array\n var index = queryZ * this.width * this.height + queryY * this.width + queryX;\n if (this.data[index] !== undefined) {\n results.push(this.data[index]);\n } else {\n results.push(undefined);\n }\n }\n }\n }\n }\n }\n\n // Additional logic to filter results by tileName, if provided\n if (tileName !== undefined) {\n var tileId = this.getTileIdByName(tileName); // Assuming a getTileIdByName function exists to map tile names to IDs\n results = results.filter(function (tile) {\n return tile === tileId;\n });\n }\n return results;\n }\n\n // Helper function to find tiles by ID\n }, {\n key: \"findTilesById\",\n value: function findTilesById(tileId) {\n var positions = [];\n var depth = this.is3D ? this.data.length : 1;\n for (var z = 0; z < depth; z++) {\n var layer = this.is3D ? this.data[z] : this.data;\n for (var i = 0; i < layer.length; i++) {\n if (layer[i] === tileId) {\n var x = i % this.width;\n var y = Math.floor(i / this.width);\n positions.push(this.is3D ? {\n x: x,\n y: y,\n z: z\n } : {\n x: x,\n y: y\n });\n }\n }\n }\n return positions;\n }\n }, {\n key: \"getTileIdByName\",\n value:\n // Example method to get tile ID by name (you'll need to implement this based on your tileset)\n function getTileIdByName(tileName) {\n // This is a placeholder function. You should implement it based on how your tileset is structured.\n // For example, if you have a mapping of tile names to tile IDs, you would use that here.\n // Return an example tile ID for demonstration\n return 1; // Assume tile ID 1 corresponds to the given tile name\n }\n }]);\n return TileMap;\n}();\nfunction init2DArray(width, height) {\n // Create a single-dimensional array\n return new Array(width * height).fill(0); // Fill with default tile type, e.g., 0\n}\nfunction init3DArray(width, height, depth) {\n var arr = [];\n for (var z = 0; z < depth; z++) {\n arr.push(init2DArray(width, height));\n }\n return arr;\n}\n\n/* default roguelike `TileSet` mappings\n{\n \"void\": 0,\n \"wall\": 1,\n \"floor\": 2,\n \"door\": 3,\n \"special_door\": 4,\n \"enter\": 5,\n \"exit\": 6,\n \"entity\": 7,\n \"block\": 8,\n \"bush\": 9,\n \"grass\": 10\n}\n*/\n\n},{\"./util/generateTiledJSON.js\":25,\"./util/mersenne.js\":26,\"./util/noise.js\":27}],6:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar TileSet = exports[\"default\"] = /*#__PURE__*/function () {\n function TileSet() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref$tiles = _ref.tiles,\n tiles = _ref$tiles === void 0 ? [] : _ref$tiles;\n _classCallCheck(this, TileSet);\n // tiles is array of tile objects with id, name, and properties, etc.\n this.tiles = tiles;\n }\n _createClass(TileSet, [{\n key: \"addTile\",\n value: function addTile(tile) {\n this.tiles.push(tile);\n }\n }, {\n key: \"getTile\",\n value: function getTile(id) {\n // search through array of tile objects for tile with matching id\n var tile = this.tiles.find(function (tile) {\n return tile.id === id;\n });\n return tile;\n }\n }, {\n key: \"getTileByName\",\n value: function getTileByName(name) {\n // search through array of tile objects for tile with matching name\n var tile = this.tiles.find(function (tile) {\n return tile.name === name;\n });\n return tile;\n }\n }]);\n return TileSet;\n}();\n\n},{}],7:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _Tile = _interopRequireDefault(require(\"./Tile.js\"));\nvar _TileMap = _interopRequireDefault(require(\"./TileMap.js\"));\nvar _TileSet = _interopRequireDefault(require(\"./TileSet.js\"));\nvar _Biome = _interopRequireDefault(require(\"./Biome.js\"));\nvar _AldousBroder = _interopRequireDefault(require(\"./mazes/AldousBroder.js\"));\nvar _AldousBroder3D = _interopRequireDefault(require(\"./mazes/AldousBroder3D.js\"));\nvar _BinaryTree = _interopRequireDefault(require(\"./mazes/BinaryTree.js\"));\nvar _CellularAutomata = _interopRequireDefault(require(\"./mazes/CellularAutomata.js\"));\nvar _EllersAlgorithm = _interopRequireDefault(require(\"./mazes/EllersAlgorithm.js\"));\nvar _GrowingTree = _interopRequireDefault(require(\"./mazes/GrowingTree.js\"));\nvar _RecursiveBacktrack = _interopRequireDefault(require(\"./mazes/RecursiveBacktrack.js\"));\nvar _RecursiveDivision = _interopRequireDefault(require(\"./mazes/RecursiveDivision.js\"));\nvar _ThomasHunter = _interopRequireDefault(require(\"./mazes/ThomasHunter.js\"));\nvar _BeattieSchoberth = _interopRequireDefault(require(\"./mazes/BeattieSchoberth.js\"));\nvar _Metroidvania = _interopRequireDefault(require(\"./mazes/Metroidvania.js\"));\nvar _Circle = _interopRequireDefault(require(\"./shapes/Circle.js\"));\nvar _Square = _interopRequireDefault(require(\"./shapes/Square.js\"));\nvar _Triangle = _interopRequireDefault(require(\"./shapes/Triangle.js\"));\nvar _LSystem = _interopRequireDefault(require(\"./LSystem.js\"));\nvar _FaultLine = _interopRequireDefault(require(\"./terrains/FaultLine.js\"));\nvar _PerlinNoise = _interopRequireDefault(require(\"./terrains/PerlinNoise.js\"));\nvar _noise = _interopRequireDefault(require(\"./util/noise.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n// Mazes\n\n// import HuntAndKill from './mazes/HuntAndKill.js';\n\n// import SpiralBacktrack from './mazes/SpiralBacktrack.js';\n\n// import TremauxsAlgorithm from './mazes/TremauxsAlgorithm.js';\n// import VoronoiDiagram from './mazes/VoronoiDiagram.js';\n\n// Shapes\n\n// import Hexagon from './shapes/Hexagon.js';\n\n// L-Systems\n\n// Biomes\n// TODO: Add biomes\n// Forest, Swamp, Plains, Mountain, Island\n\n// Terrains\n// https://en.wikipedia.org/wiki/Diamond-square_algorithm\n// import DiamondSquare from './terrains/DiamondSquare.js';\n\n// Utilities / Various\n\n// import mapImageToTileMap from './util/mapImageToTileMap.js';\n\nvar labyrinthos = {};\nlabyrinthos.mazes = {};\nlabyrinthos.mazes.AldousBroder = _AldousBroder[\"default\"];\nlabyrinthos.mazes.AldousBroder3D = _AldousBroder3D[\"default\"];\nlabyrinthos.mazes.BinaryTree = _BinaryTree[\"default\"];\nlabyrinthos.mazes.CellularAutomata = _CellularAutomata[\"default\"];\nlabyrinthos.mazes.EllersAlgorithm = _EllersAlgorithm[\"default\"];\nlabyrinthos.mazes.GrowingTree = _GrowingTree[\"default\"];\n// labyrinthos.mazes.HuntAndKill = HuntAndKill;\nlabyrinthos.mazes.RecursiveBacktrack = _RecursiveBacktrack[\"default\"];\nlabyrinthos.mazes.RecursiveDivision = _RecursiveDivision[\"default\"];\n// labyrinthos.mazes.SpiralBacktrack = SpiralBacktrack;\nlabyrinthos.mazes.BeattieSchoberth = _BeattieSchoberth[\"default\"];\nlabyrinthos.mazes.ThomasHunter = _ThomasHunter[\"default\"];\nlabyrinthos.mazes.Metroidvania = _Metroidvania[\"default\"];\nlabyrinthos.mazes.PlatformZones = _Metroidvania[\"default\"]; // legacy API support\n// labyrinthos.mazes.TremauxsAlgorithm = TremauxsAlgorithm;\n// labyrinthos.mazes.VoronoiDiagram = VoronoiDiagram;\n\nlabyrinthos.shapes = {};\nlabyrinthos.shapes.Circle = _Circle[\"default\"];\nlabyrinthos.shapes.Square = _Square[\"default\"];\n// labyrinthos.shapes.Hexagon = Hexagon;\nlabyrinthos.shapes.Triangle = _Triangle[\"default\"];\nlabyrinthos.terrains = {};\n// labyrinthos.terrains.DiamondSquare = DiamondSquare;\nlabyrinthos.terrains.FaultLine = _FaultLine[\"default\"];\nlabyrinthos.terrains.PerlinNoise = _PerlinNoise[\"default\"];\nlabyrinthos.utils = {};\nlabyrinthos.utils.noise = _noise[\"default\"];\n// labyrinthos.utils.mapImageToTileMap = mapImageToTileMap;\n\nlabyrinthos.Biome = _Biome[\"default\"];\nlabyrinthos.LSystem = _LSystem[\"default\"];\nlabyrinthos.Tile = _Tile[\"default\"];\nlabyrinthos.TileMap = _TileMap[\"default\"];\nlabyrinthos.TileSet = _TileSet[\"default\"];\nvar _default = exports[\"default\"] = labyrinthos;\n\n},{\"./Biome.js\":2,\"./LSystem.js\":3,\"./Tile.js\":4,\"./TileMap.js\":5,\"./TileSet.js\":6,\"./mazes/AldousBroder.js\":8,\"./mazes/AldousBroder3D.js\":9,\"./mazes/BeattieSchoberth.js\":10,\"./mazes/BinaryTree.js\":11,\"./mazes/CellularAutomata.js\":12,\"./mazes/EllersAlgorithm.js\":13,\"./mazes/GrowingTree.js\":14,\"./mazes/Metroidvania.js\":15,\"./mazes/RecursiveBacktrack.js\":16,\"./mazes/RecursiveDivision.js\":17,\"./mazes/ThomasHunter.js\":18,\"./shapes/Circle.js\":19,\"./shapes/Square.js\":20,\"./shapes/Triangle.js\":21,\"./terrains/FaultLine.js\":22,\"./terrains/PerlinNoise.js\":23,\"./util/noise.js\":27}],8:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = ALGORITHM_ALDOUS_BRODER;\n// AldousBroder.js - Marak Squires 2024\n// \"Aldous-Broder algorithm\" - https://en.wikipedia.org/wiki/Maze_generation_algorithm#Aldous-Broder_algorithm\nfunction ALGORITHM_ALDOUS_BRODER(tileMap, options) {\n tileMap.fill(1); // Fill with walls\n var visitedCells = 0;\n var totalCells = tileMap.width * tileMap.height / 4; // Assumes a grid where every other cell is open\n var currentX = 2 * Math.floor(tileMap.random() * Math.floor(tileMap.width / 2));\n var currentY = 2 * Math.floor(tileMap.random() * Math.floor(tileMap.height / 2));\n tileMap.data[currentY * tileMap.width + currentX] = 0; // Open starting cell\n visitedCells++;\n while (visitedCells < totalCells) {\n var directions = [[2, 0], [-2, 0], [0, 2], [0, -2]];\n var randomDirection = directions[Math.floor(tileMap.random() * directions.length)];\n var newX = currentX + randomDirection[0];\n var newY = currentY + randomDirection[1];\n if (newX >= 0 && newX < tileMap.width && newY >= 0 && newY < tileMap.height) {\n if (tileMap.data[newY * tileMap.width + newX] === 1) {\n // Open path between current cell and new cell\n tileMap.data[(currentY + randomDirection[1] / 2) * tileMap.width + (currentX + randomDirection[0] / 2)] = 0;\n tileMap.data[newY * tileMap.width + newX] = 0; // Open new cell\n visitedCells++;\n }\n currentX = newX;\n currentY = newY;\n }\n }\n}\n\n},{}],9:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = ALGORITHM_ALDOUS_BRODER_3D;\n// AldousBroder3D.js - Marak Squires 2024\n// \"Aldous-Broder algorithm\" - https://en.wikipedia.org/wiki/Maze_generation_algorithm#Aldous-Broder_algorithm\nfunction ALGORITHM_ALDOUS_BRODER_3D(tileMap, options) {\n tileMap.fill(1); // Fill with walls\n var visitedCells = 0;\n var totalCells = tileMap.width * tileMap.height * tileMap.depth / 8; // Assumes a grid where every other cell is open in 3D\n var currentX = 2 * Math.floor(Math.random() * Math.floor(tileMap.width / 2));\n var currentY = 2 * Math.floor(Math.random() * Math.floor(tileMap.height / 2));\n var currentZ = 2 * Math.floor(Math.random() * Math.floor(tileMap.depth / 2));\n tileMap.data[currentZ][currentY * tileMap.width + currentX] = 0; // Open starting cell\n visitedCells++;\n while (visitedCells < totalCells) {\n var directions = [[2, 0, 0], [-2, 0, 0], [0, 2, 0], [0, -2, 0], [0, 0, 2], [0, 0, -2]];\n var randomDirection = directions[Math.floor(Math.random() * directions.length)];\n var newX = currentX + randomDirection[0];\n var newY = currentY + randomDirection[1];\n var newZ = currentZ + randomDirection[2];\n if (newX >= 0 && newX < tileMap.width && newY >= 0 && newY < tileMap.height && newZ >= 0 && newZ < tileMap.depth) {\n if (tileMap.data[newZ][newY * tileMap.width + newX] === 1) {\n // Open path between current cell and new cell\n tileMap.data[currentZ + randomDirection[2] / 2][(currentY + randomDirection[1] / 2) * tileMap.width + (currentX + randomDirection[0] / 2)] = 0;\n tileMap.data[newZ][newY * tileMap.width + newX] = 0; // Open new cell\n visitedCells++;\n }\n currentX = newX;\n currentY = newY;\n currentZ = newZ;\n }\n }\n}\n\n},{}],10:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.BeattieSchoberthBuilder = exports.BeattieSchoberth = void 0;\nexports[\"default\"] = ALGORITHM_BEATTIE_SCHOBERTH;\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * Originally written for a game called \"Isolated\" in collaboration with Andrew Beattie and Greg Schoberth\n *\n * Originally written on June 12, 2013\n * Originally hosted at https://github.com/PhobosRising/javascript-roguelike-map-generator\n */\n\nvar MAX_X = 201;\nvar MAX_Y = 201;\nvar DIR = ['n', 'e', 's', 'w'];\n\n//const rand = require('../../utility/random/index.js');\nvar BeattieSchoberth = exports.BeattieSchoberth = /*#__PURE__*/function () {\n function BeattieSchoberth(_ref) {\n var rooms = _ref.rooms,\n keys = _ref.keys;\n _classCallCheck(this, BeattieSchoberth);\n this.maxRooms = rooms;\n this.maxKeys = keys;\n if (this.maxRooms < 2) {\n console.error(\"Room count \".concat(this.maxRooms, \" needs to be at least two (entrance and exit).\"));\n this.maxRooms = 2;\n }\n if (this.maxKeys > this.maxRooms - 2) {\n console.error(\"Key count \".concat(this.maxKeys, \" is greater than rooms \").concat(this.maxRooms, \" minus two (entrance and exit). Reducing keys by two.\"));\n this.maxKeys = this.maxRooms - 2;\n }\n this.build = this.generate;\n this.reset();\n }\n _createClass(BeattieSchoberth, [{\n key: \"render\",\n value: function render() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var bld = arguments.length > 1 ? arguments[1] : undefined;\n var NULL_KEY = '\\x1b[1;37m';\n var ENTER_EXIT = '\\x1b[7m';\n var KEY_COLORS = {\n 0: '\\x1b[1;31m' || options['0'],\n 1: '\\x1b[1;32m' || options['1'],\n 2: '\\x1b[1;34m' || options['2'],\n 3: '\\x1b[1;33m' || options['3'],\n 4: '\\x1b[1;35m' || options['4'],\n 5: '\\x1b[1;36m' || options['5']\n };\n var generated = bld || this.generate();\n var grid = generated.grid;\n var result = '';\n for (var y = 0; y < generated.size.height; y++) {\n var row1 = ''; // room numbers and hyphens\n var row2 = ''; // pipes\n for (var x = 0; x < generated.size.width; x++) {\n var roomId = grid[y][x];\n var room = generated.rooms[roomId];\n if (!room) {\n row1 += ' ';\n row2 += ' ';\n continue;\n }\n var color = KEY_COLORS[room.keyInRoom] || NULL_KEY;\n if (room.entrance || room.exit) {\n color = ENTER_EXIT;\n }\n row1 += color + String(roomId).padStart(3, '0') + '\\x1b[0m';\n //row1 += colors[color](String(roomId).padStart(3, '0'));\n\n if (room.doors.e !== null) {\n var door = generated.doors[room.doors.e];\n var _color = KEY_COLORS[door.key] || NULL_KEY;\n //row1 += colors[color]('-');\n row1 += _color + '-' + '\\x1b[0m';\n } else {\n row1 += ' ';\n }\n if (room.doors.s !== null) {\n var _door = generated.doors[room.doors.s];\n var _color2 = KEY_COLORS[_door.key] || NULL_KEY;\n //row2 += colors[color](' | ');\n row2 += _color2 + ' | ' + '\\x1b[0m';\n } else {\n row2 += ' ';\n }\n }\n result += row1 + '\\n';\n result += row2 + '\\n';\n }\n return result;\n }\n }, {\n key: \"reset\",\n value: function reset() {\n this.rooms = [];\n this.doors = [];\n this.keys = [];\n\n // Room IDs\n this.entrance = 0;\n this.exit = null;\n this.seed = {\n x: Math.floor(MAX_X / 2),\n y: Math.floor(MAX_Y / 2)\n };\n\n // Keeps track of the edges of the map\n // Useful to shrink map when done\n this.bounds = {\n n: this.seed.y,\n e: this.seed.x,\n s: this.seed.y,\n w: this.seed.x\n };\n\n // Keeps track of the room which is the furthest in any direction\n // Rooms are tracked based on their coordinate tangential to that direction\n // This lets us add rooms without iteratively 'sliding' them in from the outside\n this.furthest = {\n n: new Map(),\n // X => roomId\n e: new Map(),\n // Y => roomId\n s: new Map(),\n // X => roomId\n w: new Map() // Y => roomId\n };\n this.lockPool = new Map();\n this.maxDistance = 0;\n }\n }, {\n key: \"generate\",\n value: function generate(random) {\n this.random = random ? random : function () {\n return Math.random();\n };\n this.reset();\n\n /*const root = */\n this.addRoom(this.seed.x, this.seed.y);\n for (var i = 0; i < this.maxRooms - 1; i++) {\n var dir = DIR[Math.floor(random() * DIR.length)]; // Which direction are we adding a room from\n\n var x = void 0,\n y = void 0,\n parentRoom = void 0;\n if (dir === 'n') {\n // Sliding southward from north\n x = Math.floor(random() * (this.bounds.e - this.bounds.w)) + this.bounds.w;\n var parentRoomId = this.furthest.n.get(x);\n parentRoom = this.rooms[parentRoomId];\n y = parentRoom.y - 1;\n } else if (dir === 'e') {\n // Sliding westward from east\n y = Math.floor(random() * (this.bounds.s - this.bounds.n)) + this.bounds.n;\n var _parentRoomId = this.furthest.e.get(y);\n parentRoom = this.rooms[_parentRoomId];\n x = parentRoom.x + 1;\n } else if (dir === 's') {\n // Sliding northward from south\n x = Math.floor(random() * (this.bounds.e - this.bounds.w)) + this.bounds.w;\n var _parentRoomId2 = this.furthest.s.get(x);\n parentRoom = this.rooms[_parentRoomId2];\n y = parentRoom.y + 1;\n } else if (dir === 'w') {\n // Sliding eastward from west\n y = Math.floor(random() * (this.bounds.s - this.bounds.n)) + this.bounds.n;\n var _parentRoomId3 = this.furthest.w.get(y);\n parentRoom = this.rooms[_parentRoomId3];\n x = parentRoom.x - 1;\n }\n var newRoomId = this.addRoom(x, y);\n /*const d = */\n this.addDoor(parentRoom.id, newRoomId);\n }\n var CHILD_THRESHOLD = this.rooms.length / (this.maxKeys + 1);\n var lockedRoom = this.getHighestDistanceRoom();\n var roomToBeLocked = lockedRoom.id;\n this.setExit(roomToBeLocked);\n for (var _i = 0; _i < this.maxKeys; _i++) {\n var ascended = this.findRoomParentWithAtMostChildren(this.rooms[roomToBeLocked], CHILD_THRESHOLD);\n if (!ascended) {\n console.error('exhausted possible lockable rooms! giving up.');\n break;\n }\n this.removeRoomAndChildrenFromLockPool(ascended);\n this.decrementChildrenCountAllParents(ascended);\n var roomToPutKeyIn = this.getHighestDistanceRoom();\n if (!roomToPutKeyIn) {\n console.error('Cannot find a room to put a key in! Cancelling lock. Level should still be beatable.');\n break;\n }\n this.lock(ascended.id - 1, roomToPutKeyIn.id); // TODO: HACK: door between room and parent has ID of parentId - 1\n\n roomToBeLocked = roomToPutKeyIn.id;\n }\n var _this$squish = this.squish(),\n width = _this$squish.width,\n height = _this$squish.height;\n var grid = this.generateGrid(width, height);\n this.classifyRooms();\n return {\n size: {\n width: width,\n height: height\n },\n terminals: {\n entrance: this.entrance,\n exit: this.exit,\n deadends: this.deadends\n },\n //rooms: this.rooms,\n rooms: this.rooms.map(function (r) {\n // Hide internal data structures from outside world\n delete r.children;\n delete r.childrenCount;\n delete r.parent;\n return r;\n }),\n doors: this.doors.map(function (d) {\n d.rooms = d.rooms.map(function (r) {\n return r.id;\n });\n return d;\n }),\n keys: this.keys,\n grid: grid\n };\n }\n\n /**\n * Shrink the boundaries of the map\n * Set a new X/Y for every room\n * @return smallest {width,height} required to fit map\n */\n }, {\n key: \"squish\",\n value: function squish() {\n var width = this.bounds.e - this.bounds.w + 1;\n var height = this.bounds.s - this.bounds.n + 1;\n var xShift = this.bounds.w;\n var yShift = this.bounds.n;\n var _iterator = _createForOfIteratorHelper(this.rooms),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var room = _step.value;\n room.x -= xShift;\n room.y -= yShift;\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return {\n width: width,\n height: height\n };\n }\n }, {\n key: \"addRoom\",\n value: function addRoom(x, y) {\n var roomId = this.rooms.length;\n this.stretch(x, y);\n this.further(x, y, roomId);\n var room = {\n id: roomId,\n x: x,\n y: y,\n children: new Set(),\n childrenCount: 0,\n parent: null,\n keyInRoom: null,\n template: 'F1',\n distance: roomId === 0 ? 0 : null,\n // Distance from room[0] / spawn\n exit: false,\n entrance: roomId === 0,\n doors: {\n n: null,\n e: null,\n s: null,\n w: null\n }\n };\n this.rooms.push(room);\n return roomId;\n }\n }, {\n key: \"further\",\n value: function further(x, y, roomId) {\n var mostNorth = this.furthest.n.get(x);\n if (typeof mostNorth === 'undefined' || this.rooms[mostNorth].y > y) {\n this.furthest.n.set(x, roomId);\n }\n var mostEast = this.furthest.e.get(y);\n if (typeof mostEast === 'undefined' || this.rooms[mostEast].x < x) {\n this.furthest.e.set(y, roomId);\n }\n var mostSouth = this.furthest.s.get(x);\n if (typeof mostSouth === 'undefined' || this.rooms[mostSouth].y < y) {\n this.furthest.s.set(x, roomId);\n }\n var mostWest = this.furthest.w.get(y);\n if (typeof mostWest === 'undefined' || this.rooms[mostWest].x > x) {\n this.furthest.w.set(y, roomId);\n }\n }\n }, {\n key: \"stretch\",\n value: function stretch(x, y) {\n if (y < this.bounds.n) {\n this.bounds.n = y;\n }\n if (x > this.bounds.e) {\n this.bounds.e = x;\n }\n if (y > this.bounds.s) {\n this.bounds.s = y;\n }\n if (x < this.bounds.w) {\n this.bounds.w = x;\n }\n }\n }, {\n key: \"classifyRooms\",\n value: function classifyRooms() {\n this.deadends = [];\n var _iterator2 = _createForOfIteratorHelper(this.rooms),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var room = _step2.value;\n var doors = 0;\n if (room.doors.n !== null) doors++;\n if (room.doors.e !== null) doors++;\n if (room.doors.s !== null) doors++;\n if (room.doors.w !== null) doors++;\n if (doors === 1) {\n // D (Dead End)\n this.deadends.push(room.id);\n if (room.doors.n !== null) {\n room.template = 'D1';\n } else if (room.doors.e !== null) {\n room.template = 'D2';\n } else if (room.doors.s !== null) {\n room.template = 'D3';\n } else if (room.doors.w !== null) {\n room.template = 'D4';\n }\n } else if (doors === 2) {\n // B (Bend) or C (Corridoor)\n if (room.doors.n !== null && room.doors.s !== null) {\n room.template = 'C1';\n } else if (room.doors.e !== null && room.doors.w !== null) {\n room.template = 'C2';\n } else if (room.doors.n !== null && room.doors.e !== null) {\n room.template = 'B1';\n } else if (room.doors.e !== null && room.doors.s !== null) {\n room.template = 'B2';\n } else if (room.doors.s !== null && room.doors.w !== null) {\n room.template = 'B3';\n } else if (room.doors.w !== null && room.doors.n !== null) {\n room.template = 'B4';\n }\n } else if (doors === 3) {\n // E\n if (room.doors.s === null) {\n room.template = 'E1';\n } else if (room.doors.w === null) {\n room.template = 'E2';\n } else if (room.doors.n === null) {\n room.template = 'E3';\n } else if (room.doors.e === null) {\n room.template = 'E4';\n }\n } else if (doors === 4) {\n // A (All)\n room.template = 'A1';\n } else {\n // F (Fucked)\n room.template = 'F1';\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n\n /**\n * @param rooms Array of two door IDs\n *\n * @return doorId\n */\n }, {\n key: \"addDoor\",\n value: function addDoor(parentRoomId, childRoomId) {\n var parentRoom = this.rooms[parentRoomId];\n var childRoom = this.rooms[childRoomId];\n var doorId = this.doors.length;\n var orientation = null;\n if (parentRoom.x === childRoom.x && parentRoom.y === childRoom.y - 1) {\n // R1 north of R2\n orientation = 'v';\n parentRoom.doors.s = doorId;\n childRoom.doors.n = doorId;\n } else if (parentRoom.x === childRoom.x + 1 && parentRoom.y === childRoom.y) {\n // R1 east of R2\n orientation = 'h';\n parentRoom.doors.w = doorId;\n childRoom.doors.e = doorId;\n } else if (parentRoom.x === childRoom.x && parentRoom.y === childRoom.y + 1) {\n // R1 south of R2\n orientation = 'v';\n parentRoom.doors.n = doorId;\n childRoom.doors.s = doorId;\n } else if (parentRoom.x === childRoom.x - 1 && parentRoom.y === childRoom.y) {\n // R1 west of R2\n orientation = 'h';\n parentRoom.doors.e = doorId;\n childRoom.doors.w = doorId;\n } else {\n throw new Error('Rooms must be adjacent');\n }\n parentRoom.children.add(childRoom);\n childRoom.distance = parentRoom.distance + 1;\n childRoom.parent = parentRoom;\n this.increaseChildrenCountAllParents(childRoom);\n this.registerRoomDistanceLockPool(childRoom.id);\n this.doors.push({\n id: doorId,\n key: null,\n orientation: orientation,\n exit: false,\n rooms: [parentRoom, childRoom]\n });\n return doorId;\n }\n }, {\n key: \"increaseChildrenCountAllParents\",\n value: function increaseChildrenCountAllParents(room) {\n //eslint-disable-next-line no-cond-assign\n while (room = room.parent) {\n room.childrenCount++;\n }\n }\n }, {\n key: \"registerRoomDistanceLockPool\",\n value: function registerRoomDistanceLockPool(roomId) {\n var room = this.rooms[roomId];\n var distance = room.distance;\n if (!this.lockPool.get(distance)) {\n this.lockPool.set(distance, new Set());\n }\n this.lockPool.get(distance).add(room);\n if (distance > this.maxDistance) {\n this.maxDistance = distance;\n }\n }\n }, {\n key: \"removeFromLockPool\",\n value: function removeFromLockPool(room) {\n var distance = room.distance;\n var pool = this.lockPool.get(distance);\n if (!pool) {\n console.error(\"no pool of depth \".concat(distance));\n return;\n }\n pool[\"delete\"](room);\n\n //if (pool.size === 0) {\n //console.log('pool is now empty, removing pool');\n //console.log(`this should be deepest room total! my: ${distance}, max: ${this.maxDistance}`);\n //this.lockPool.delete(pool);\n ////this.maxDistance--; // get removed out of order\n //}\n }\n }, {\n key: \"getHighestDistanceRoom\",\n value: function getHighestDistanceRoom() {\n // TODO: This is slow, iterates every distance pool\n for (var i = this.maxDistance; i > 0; i--) {\n var collection = this.lockPool.get(i);\n if (!collection.size) {\n continue;\n }\n var item = collection.values().next().value;\n return item;\n }\n return null;\n }\n }, {\n key: \"findRoomParentWithAtMostChildren\",\n value: function findRoomParentWithAtMostChildren(room, count) {\n if (!room) {\n throw new Error('bad room');\n }\n var parent;\n //eslint-disable-next-line no-cond-assign\n while (parent = room.parent) {\n if (parent.childrenCount + 1 > count) {\n return room;\n }\n room = parent;\n }\n return room;\n }\n }, {\n key: \"decrementChildrenCountAllParents\",\n value: function decrementChildrenCountAllParents(room) {\n var decrementCount = room.childrenCount + 1;\n while (room) {\n room.childrenCount -= decrementCount;\n room = room.parent;\n }\n }\n }, {\n key: \"removeRoomAndChildrenFromLockPool\",\n value: function removeRoomAndChildrenFromLockPool(room) {\n this.removeFromLockPool(room);\n var _iterator3 = _createForOfIteratorHelper(room.children),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var child = _step3.value;\n this.removeFromLockPool(child);\n this.removeRoomAndChildrenFromLockPool(child);\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n }\n\n /**\n * Locks a door, putting the key in the specified room\n * @return keyId\n */\n }, {\n key: \"lock\",\n value: function lock(doorId, roomId) {\n var door = this.doors[doorId];\n var location = this.rooms[roomId];\n var keyId = this.keys.length;\n if (!door) {\n throw new Error(\"Invalid door \".concat(doorId));\n }\n if (!location) {\n throw new Error(\"Invalid room \".concat(roomId));\n }\n this.keys.push({\n id: keyId,\n location: location.id,\n door: doorId\n });\n this.doors[doorId].key = keyId;\n location.keyInRoom = keyId;\n return keyId;\n }\n\n /**\n * Generates a 2D array of Room IDs\n * Makes it easier for games to visualize the map\n */\n }, {\n key: \"generateGrid\",\n value: function generateGrid(width, height) {\n var grid = [];\n for (var y = 0; y < height; y++) {\n var row = [];\n for (var x = 0; x < width; x++) {\n row.push(null);\n }\n grid.push(row);\n }\n var self = this;\n function addRoomToGrid(roomId) {\n var room = self.rooms[roomId];\n grid[room.y][room.x] = room.id;\n var _iterator4 = _createForOfIteratorHelper(room.children),\n _step4;\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var child = _step4.value;\n addRoomToGrid(child.id);\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n }\n addRoomToGrid(0);\n return grid;\n }\n }, {\n key: \"setExit\",\n value: function setExit(roomId) {\n var room = this.rooms[roomId];\n if (!room) {\n throw new Error(\"invalid room id \".concat(roomId));\n }\n room.exit = true;\n if (room.doors.n !== null) this.doors[room.doors.n].exit = true;\n if (room.doors.e !== null) this.doors[room.doors.e].exit = true;\n if (room.doors.s !== null) this.doors[room.doors.s].exit = true;\n if (room.doors.w !== null) this.doors[room.doors.w].exit = true;\n this.exit = roomId;\n }\n }]);\n return BeattieSchoberth;\n}();\nvar TILE = {\n VOID: 0,\n WALL: 1,\n FLOOR: 2,\n DOOR: 3,\n SPECIAL_DOOR: 4,\n ENTER: 5,\n EXIT: 6\n};\nvar toCharGrid = function toCharGrid() {\n var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n return string.split('\\n').map(function (line) {\n return line.split('');\n });\n};\nvar Grid = /*#__PURE__*/function () {\n function Grid() {\n var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n _classCallCheck(this, Grid);\n this.grid = toCharGrid(str);\n }\n _createClass(Grid, [{\n key: \"overlay\",\n value: function overlay(subgrid, y, x) {\n var grid = Array.isArray(subgrid) ? subgrid : toCharGrid(subgrid);\n for (var row = 0; row < grid.length; row++) {\n for (var col = 0; col < grid[row].length; col++) {\n if (!this.grid[x + row]) this.grid[x + row] = [];\n this.grid[x + row][y + col] = grid[row][col];\n }\n }\n }\n }, {\n key: \"fill\",\n value: function fill(tile, max_width, max_height) {\n for (var y = 0; y < max_height; y++) {\n this.grid[y] = [];\n for (var x = 0; x < max_width; x++) {\n this.grid[y][x] = tile;\n }\n }\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return this.grid.map(function (chars) {\n return chars.join('');\n }).join('\\n');\n }\n }]);\n return Grid;\n}();\nvar BeattieSchoberthBuilder = exports.BeattieSchoberthBuilder = /*#__PURE__*/function () {\n function BeattieSchoberthBuilder() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, BeattieSchoberthBuilder);\n this.adventure = new BeattieSchoberth(config);\n this.options = config;\n this.max_height = config.maxHeight;\n this.max_width = config.maxWidth;\n }\n _createClass(BeattieSchoberthBuilder, [{\n key: \"renderWorld\",\n value: function renderWorld() {\n var _this = this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var blt = arguments.length > 1 ? arguments[1] : undefined;\n var opt = function opt(name) {\n return options[name] || _this.options[name];\n };\n var width = opt('width');\n var height = opt('height');\n var roomWidth = opt('roomWidth');\n var roomHeight = opt('roomHeight');\n var built = blt || this.build();\n var generated = built;\n var grid = generated.grid;\n var output = new Grid();\n var rendered = null;\n output.fill(TILE.VOID, width, height);\n for (var y = 0; y < generated.size.height; y++) {\n for (var x = 0; x < generated.size.width; x++) {\n var roomId = grid[y][x];\n var room = generated.rooms[roomId];\n if (room) {\n rendered = this.buildRoom({\n doors: room.doors\n });\n } else {\n rendered = this.emptyRoom({});\n }\n output.overlay(rendered, x * roomWidth, y * roomHeight);\n }\n }\n return output.grid;\n }\n }, {\n key: \"buildRoom\",\n value: function buildRoom() {\n var _this2 = this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var inDoorRange = function inDoorRange(n, max, range) {\n var half = Math.floor(max / 2);\n var odd = !!(max % 2);\n var halfRange = Math.floor(range / 2);\n if (odd) {\n if (n === half && range) {\n //in center\n return true;\n } else {\n if (n < half) {\n return n > half - halfRange;\n } else {\n return n < half + halfRange;\n }\n }\n } else {\n if (n <= half) {\n return n >= half - halfRange;\n } else {\n return n < half + halfRange;\n }\n }\n };\n var opt = function opt(name) {\n return options[name] || _this2.options[name];\n };\n var width = opt('roomWidth');\n var height = opt('roomHeight');\n var lines = [];\n for (var y = 0; y < height; y++) {\n var row = [];\n for (var x = 0; x < width; x++) {\n if (x === 0 || x === width - 1) {\n //TODO: doors\n if (x === 0) {\n if (options.doors.w && inDoorRange(y, height, 2)) {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.WALL);\n }\n } else {\n if (options.doors.e && inDoorRange(y, height, 2)) {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.WALL);\n }\n }\n } else {\n if (y === 0 || y === height - 1) {\n if (y === 0) {\n if (options.doors.n && inDoorRange(x, width, 2)) {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.WALL);\n }\n } else {\n if (options.doors.s && inDoorRange(x, width, 2)) {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.WALL);\n }\n }\n } else {\n row.push(TILE.FLOOR);\n }\n }\n }\n lines.push(row);\n }\n return lines;\n }\n }, {\n key: \"emptyRoom\",\n value: function emptyRoom() {\n var _this3 = this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var opt = function opt(name) {\n return options[name] || _this3.options[name];\n };\n var width = opt('roomWidth');\n var height = opt('roomHeight');\n var result = [];\n for (var y = 0; y < height; y++) {\n var row = [];\n for (var x = 0; x < width; x++) {\n row.push(TILE.VOID);\n }\n result.push(row);\n }\n return result;\n }\n }, {\n key: \"build\",\n value: function build(rand) {\n var adventureBuild = this.adventure.build(rand);\n adventureBuild.world = this.renderWorld({}, adventureBuild);\n return adventureBuild;\n }\n }]);\n return BeattieSchoberthBuilder;\n}();\nfunction ALGORITHM_BEATTIE_SCHOBERTH(tileMap, options) {\n var fractional = Math.floor(Math.sqrt(Math.max(tileMap.width, tileMap.height)));\n var builder = new BeattieSchoberthBuilder({\n rooms: fractional * 2,\n keys: 3,\n special: 2,\n width: tileMap.width,\n height: tileMap.height,\n roomHeight: options.roomHeight || fractional,\n roomWidth: options.roomWidth || fractional\n });\n var built = builder.build(function () {\n return tileMap.random();\n });\n var flattened = built.world.reduce(function (agg, line) {\n return agg.concat(line);\n }, []);\n built.world = null;\n for (var lcv = 0; lcv < tileMap.data.length; lcv++) {\n tileMap.data[lcv] = flattened[lcv];\n }\n tileMap.world = built;\n}\n\n},{}],11:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = ALGORITHM_BINARY_TREE;\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction ALGORITHM_BINARY_TREE(tileMap, options) {\n tileMap.fill(1); // Fill with walls\n\n for (var y = 0; y < tileMap.height; y += 2) {\n for (var x = 0; x < tileMap.width; x += 2) {\n tileMap.data[y * tileMap.width + x] = 0; // Open cell\n\n var neighbors = [];\n if (x + 2 < tileMap.width) neighbors.push([2, 0]); // East\n if (y + 2 < tileMap.height) neighbors.push([0, 2]); // South\n\n if (neighbors.length > 0) {\n var randomIndex = Math.floor(tileMap.random() * neighbors.length);\n var _neighbors$randomInde = _slicedToArray(neighbors[randomIndex], 2),\n dx = _neighbors$randomInde[0],\n dy = _neighbors$randomInde[1];\n tileMap.data[(y + dy) * tileMap.width + (x + dx)] = 0; // Open path to the selected neighbor\n tileMap.data[(y + dy / 2) * tileMap.width + (x + dx / 2)] = 0; // Open wall between current cell and selected neighbor\n }\n }\n }\n}\n\n},{}],12:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generateCellularAutomataMap;\n// CellularAutomata.js - Marak Squires 2024\nfunction generateCellularAutomataMap(tileMap, options) {\n var floorTileId = 1;\n var wallTileId = 0;\n var wallChance = options.wallChance || 0.45;\n var iterations = options.iterations || 4;\n var neighborThreshold = options.neighborThreshold || 4;\n\n // Randomly initialize map\n for (var y = 0; y < tileMap.height; y++) {\n for (var x = 0; x < tileMap.width; x++) {\n tileMap.data[y * tileMap.width + x] = tileMap.random() < wallChance ? wallTileId : floorTileId;\n }\n }\n\n // Cellular automata iteration\n for (var i = 0; i < iterations; i++) {\n var newData = new Array(tileMap.width * tileMap.height).fill(floorTileId);\n for (var _y = 0; _y < tileMap.height; _y++) {\n for (var _x = 0; _x < tileMap.width; _x++) {\n var wallNeighbors = 0;\n for (var dy = -1; dy <= 1; dy++) {\n for (var dx = -1; dx <= 1; dx++) {\n if (dx === 0 && dy === 0) continue;\n var nx = _x + dx;\n var ny = _y + dy;\n if (nx >= 0 && nx < tileMap.width && ny >= 0 && ny < tileMap.height) {\n wallNeighbors += tileMap.data[ny * tileMap.width + nx] === wallTileId ? 1 : 0;\n } else {\n wallNeighbors++;\n }\n }\n }\n newData[_y * tileMap.width + _x] = wallNeighbors >= neighborThreshold ? wallTileId : floorTileId;\n }\n }\n tileMap.data = newData;\n }\n}\n\n},{}],13:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generateEllersAlgorithmMap;\n// EllersAlgorithm.js - Marak Squires 2024\nfunction generateEllersAlgorithmMap(tileMap, options) {\n var floorTileId = 1;\n var wallTileId = 0;\n tileMap.data.fill(wallTileId);\n var sets = {};\n function makeSet(x, y) {\n var id = \"\".concat(x, \",\").concat(y);\n sets[id] = {\n id: id,\n cells: [id]\n };\n return sets[id];\n }\n function findSet(x, y) {\n var id = \"\".concat(x, \",\").concat(y);\n return sets[id] || makeSet(x, y);\n }\n function unionSets(x1, y1, x2, y2) {\n var set1 = findSet(x1, y1);\n var set2 = findSet(x2, y2);\n if (set1.id === set2.id) return;\n\n // Merge two sets\n set2.cells.forEach(function (cellId) {\n set1.cells.push(cellId);\n sets[cellId] = set1;\n });\n }\n for (var y = 0; y < tileMap.height; y += 2) {\n // Join cells horizontally\n for (var x = 0; x < tileMap.width - 2; x += 2) {\n if (tileMap.random() > 0.5) {\n unionSets(x, y, x + 2, y);\n tileMap.data[y * tileMap.width + x + 1] = floorTileId;\n }\n }\n\n // Join cells vertically\n if (y < tileMap.height - 2) {\n var setVisited = {};\n for (var _x = 0; _x < tileMap.width; _x += 2) {\n var currentSet = findSet(_x, y).id;\n if (!setVisited[currentSet] && tileMap.random() > 0.5) {\n unionSets(_x, y, _x, y + 2);\n tileMap.data[(y + 1) * tileMap.width + _x] = floorTileId;\n setVisited[currentSet] = true;\n }\n }\n }\n }\n\n // Ensure all paths are connected in the last row\n for (var _x2 = 0; _x2 < tileMap.width - 2; _x2 += 2) {\n if (findSet(_x2, tileMap.height - 1).id !== findSet(_x2 + 2, tileMap.height - 1).id) {\n unionSets(_x2, tileMap.height - 1, _x2 + 2, tileMap.height - 1);\n tileMap.data[(tileMap.height - 1) * tileMap.width + _x2 + 1] = floorTileId;\n }\n }\n}\n\n},{}],14:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generateGrowingTreeAlgorithmMap;\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction generateGrowingTreeAlgorithmMap(tileMap, options) {\n var floorTileId = 1; // Open cell\n var wallTileId = 0; // Wall\n\n tileMap.data.fill(wallTileId); // Initialize all tiles as walls\n\n // Function to carve a passage between two points\n function carvePassage(x1, y1, x2, y2) {\n tileMap.data[y1 * tileMap.width + x1] = floorTileId;\n // Carve passage to the next cell (midpoint for the wall and the cell itself)\n tileMap.data[Math.floor((y1 + y2) / 2) * tileMap.width + Math.floor((x1 + x2) / 2)] = floorTileId;\n tileMap.data[y2 * tileMap.width + x2] = floorTileId;\n }\n var currentX = Math.floor(tileMap.random() * tileMap.width);\n var currentY = Math.floor(tileMap.random() * tileMap.height);\n var cellsStack = [[currentX, currentY]]; // Start with a single cell in stack\n var _loop = function _loop() {\n var _cellsStack = _slicedToArray(cellsStack[cellsStack.length - 1], 2),\n cx = _cellsStack[0],\n cy = _cellsStack[1]; // Use the latest cell\n var neighbors = [];\n\n // Directions: N, S, E, W\n var directions = [[0, -2], [0, 2], [2, 0], [-2, 0]];\n directions.forEach(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n dx = _ref2[0],\n dy = _ref2[1];\n var nx = cx + dx,\n ny = cy + dy;\n if (nx >= 0 && nx < tileMap.width && ny >= 0 && ny < tileMap.height && tileMap.data[ny * tileMap.width + nx] === wallTileId) {\n neighbors.push([nx, ny]);\n }\n });\n if (neighbors.length > 0) {\n var randomIndex = Math.floor(tileMap.random() * neighbors.length);\n var _neighbors$randomInde = _slicedToArray(neighbors[randomIndex], 2),\n nextX = _neighbors$randomInde[0],\n nextY = _neighbors$randomInde[1];\n carvePassage(cx, cy, nextX, nextY);\n cellsStack.push([nextX, nextY]);\n } else {\n cellsStack.pop(); // No neighbors found, backtrack\n }\n };\n while (cellsStack.length > 0) {\n _loop();\n }\n}\n\n},{}],15:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = ALGORITHM_METROIDVANIA;\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * Metroidvania.js - Abbey Hawk Sparrow 2024\n * Originally written by Thomas Hunter II\n *\n * Originally written on June 12, 2013\n * Originally hosted at https://github.com/PhobosRising/javascript-roguelike-map-generator\n */\n\nvar WALL = 'wall';\nvar DOOR = 'door';\nvar OPEN = 'open';\nvar EXIT = 'exit';\nvar DIRECTIONS = ['n', 'e', 's', 'w'];\nvar TILE = {\n VOID: 0,\n WALL: 1,\n FLOOR: 2,\n DOOR: 3,\n SPECIAL_DOOR: 4,\n ENTER: 5,\n EXIT: 6\n};\nvar toCharGrid = function toCharGrid() {\n var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n return string.split('\\n').map(function (line) {\n return line.split('');\n });\n};\nvar Grid = /*#__PURE__*/function () {\n function Grid() {\n var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n _classCallCheck(this, Grid);\n this.grid = toCharGrid(str);\n }\n _createClass(Grid, [{\n key: \"overlay\",\n value: function overlay(subgrid, y, x) {\n var grid = Array.isArray(subgrid) ? subgrid : toCharGrid(subgrid);\n for (var row = 0; row < grid.length; row++) {\n for (var col = 0; col < grid[row].length; col++) {\n if (!this.grid[x + row]) this.grid[x + row] = [];\n this.grid[x + row][y + col] = grid[row][col];\n }\n }\n }\n }, {\n key: \"fill\",\n value: function fill(tile, max_width, max_height) {\n for (var y = 0; y < max_height; y++) {\n this.grid[y] = [];\n for (var x = 0; x < max_width; x++) {\n this.grid[y][x] = tile;\n }\n }\n }\n }, {\n key: \"toString\",\n value: function toString(incoming) {\n return (incoming || this.grid).map(function (chars) {\n return chars.join('');\n }).join('\\n');\n }\n }]);\n return Grid;\n}();\nvar Metroidvania = /*#__PURE__*/function () {\n function Metroidvania() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, Metroidvania);\n this.options = config;\n }\n _createClass(Metroidvania, [{\n key: \"render\",\n value: function render() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var blt = arguments.length > 1 ? arguments[1] : undefined;\n var built = blt || this.build();\n var world = built.map;\n var result = '';\n // Crude mechanism for drawing level\n for (var y = 0; y < world.length; y++) {\n var row = '';\n for (var x = 0; x < world[y].length; x++) {\n if (world[y][x].edges.e || world[y][x].edges.w || world[y][x].edges.n || world[y][x].edges.s) row += '#';else row += ' ';\n }\n result += row + '\\n';\n //console.log(row + '| ' + y);\n }\n return result;\n }\n }, {\n key: \"build\",\n value: function build(random) {\n this.random = random;\n var data = platformGenerator(this.options, random);\n var grid = new Grid();\n var roomWidth = this.options.roomWidth || 10;\n var roomHeight = this.options.roomHeight || 10;\n grid.fill(TILE.VOID, this.options.gridWidth, this.options.gridHeight);\n for (var col = 0; col < data.rooms.length; col++) {\n for (var row = 0; row < data.rooms[col].length; row++) {\n var location = data.rooms[col][row];\n var roomData = data.map[location.y][location.x];\n var room = buildRoom(roomData, this.options.roomHeight, this.options.roomWidth\n /*{\n room: roomData,\n roomWidth: this.options.roomWidth,\n roomHeight: this.options.roomHeight\n }*/);\n grid.overlay(room, location.x * this.options.roomHeight, location.y * this.options.roomWidth);\n }\n }\n data.world = grid.grid;\n return data;\n }\n }]);\n return Metroidvania;\n}();\nvar inDoorRange = function inDoorRange(n, max, range) {\n var half = Math.floor(max / 2);\n var odd = !!(max % 2);\n var halfRange = Math.floor(range / 2);\n if (odd) {\n if (n === half && range) {\n //in center\n return true;\n } else {\n if (n < half) {\n return n > half - halfRange;\n } else {\n return n < half + halfRange;\n }\n }\n } else {\n if (n <= half) {\n return n >= half - halfRange;\n } else {\n return n < half + halfRange;\n }\n }\n};\nvar buildRoom = function buildRoom() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var roomHeight = arguments.length > 1 ? arguments[1] : undefined;\n var roomWidth = arguments.length > 2 ? arguments[2] : undefined;\n var width = roomHeight;\n var height = roomWidth;\n var lines = [];\n for (var y = 0; y < height; y++) {\n var row = [];\n for (var x = 0; x < width; x++) {\n if (x === 0 || x === width - 1) {\n //TODO: doors\n if (x === 0) {\n if (options.edges.w === 'open') {\n if (y === 0 || y === height - 1) row.push(TILE.WALL);else row.push(TILE.FLOOR);\n } else {\n if ((options.edges.w === 'door' || options.edges.w === 'exit') && inDoorRange(y, height, 2)) {\n if (options.edges.w === 'door') {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.EXIT);\n }\n } else {\n row.push(TILE.WALL);\n }\n }\n } else {\n if (options.edges.e === 'open') {\n if (y === 0 || y === height - 1) row.push(TILE.WALL);else row.push(TILE.FLOOR);\n } else {\n if ((options.edges.e === 'door' || options.edges.e === 'exit') && inDoorRange(y, height, 2)) {\n if (options.edges.e === 'door') {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.EXIT);\n }\n } else {\n row.push(TILE.WALL);\n }\n }\n }\n } else {\n if (y === 0 || y === height - 1) {\n if (y === 0) {\n if (options.edges.n === 'open') {\n row.push(TILE.FLOOR);\n } else {\n if ((options.edges.n === 'door' || options.edges.n === 'exit') && inDoorRange(x, width, 2)) {\n if (options.edges.n === 'door') {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.EXIT);\n }\n } else {\n row.push(TILE.WALL);\n }\n }\n } else {\n if (options.edges.s === 'open') {\n row.push(TILE.FLOOR);\n } else {\n if ((options.edges.s === 'door' || options.edges.s === 'exit') && inDoorRange(x, width, 2)) {\n if (options.edges.s === 'door') {\n row.push(TILE.DOOR);\n } else {\n row.push(TILE.EXIT);\n }\n } else {\n row.push(TILE.WALL);\n }\n }\n }\n } else {\n row.push(TILE.FLOOR);\n }\n }\n }\n lines.push(row);\n }\n return lines;\n};\nvar platformGenerator = function platformGenerator() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var random = arguments.length > 1 ? arguments[1] : undefined;\n var MAP_WIDTH = config.width || 20;\n var MAP_HEIGHT = config.height || 20;\n var MIN_ZONES_PER_ROOM = config.minZonesPerRoom || 1;\n var MAX_ZONES_PER_ROOM = config.maxZonesPerRoom || 4;\n var MIN_ROOMS_PER_MAP = config.minRoomsPerMap || 10;\n var MAX_ROOMS_PER_MAP = config.maxRoomsPerMap || 20;\n\n // If we don't get at least this many random doors, start over\n var NEW_DOOR_MIN_THRESHOLD = config.newDoors || 3;\n\n // How this really should work is the odds of creating a door are higher as the room id's get farther apart\n var ROOM_ID_DIFF_RANDOM_DOOR_THRESHOLD = config.roomDiff || 3; // How different should two rooms be?\n var ROOM_ID_DIFF_RANDOM_DOOR_ODDS = config.roomDiffOdds || 1 / 5; // What are the odds we'll act upon this?\n\n var failCount = 0;\n var result = null;\n while (!result) {\n result = build(initialize(MAP_WIDTH, MAP_HEIGHT));\n }\n return result;\n function build(map) {\n // Determin the total number of rooms in the beginning\n var number_of_rooms = rangedRandom(MIN_ROOMS_PER_MAP, MAX_ROOMS_PER_MAP, random);\n\n // The cursor is this special little pointer for the next zone being built\n var cursor = {\n x: Math.floor(MAP_WIDTH / 2),\n y: Math.floor(MAP_WIDTH / 2)\n };\n var exits = {\n n: {\n // negative Y\n x: cursor.x,\n y: cursor.y\n },\n s: {\n // positive Y\n x: cursor.x,\n y: cursor.y\n },\n e: {\n // positive X\n x: cursor.x,\n y: cursor.y\n },\n w: {\n // negative X\n x: cursor.x,\n y: cursor.y\n }\n };\n\n // Each placed zone will have its own id\n var zone_id = 0;\n\n // An array of room id's, and the room locations within it\n var all_room_zones = [];\n\n // Run this loop once per room we're going to build\n for (var room = 0; room < number_of_rooms; room++) {\n // determine the number of zones in this room at the beginning\n var number_of_zones = rangedRandom(MIN_ZONES_PER_ROOM, MAX_ZONES_PER_ROOM, random);\n var zones_in_this_room = [];\n\n // Run this loop once per zone within this room\n for (var zone_number = 0; zone_number < number_of_zones; zone_number++) {\n if (!cursor) {\n return null;\n }\n var zone = map[cursor.y][cursor.x];\n zones_in_this_room.push({\n x: cursor.x,\n y: cursor.y\n });\n zone.open = true;\n zone.room = room;\n zone.zone = zone_id;\n zone_id++;\n if (cursor.x <= exits.w.x) exits.w = cursor;\n if (cursor.x >= exits.e.x) exits.e = cursor;\n if (cursor.y <= exits.n.y) exits.n = cursor;\n if (cursor.y >= exits.s.y) exits.s = cursor;\n cursor = moveCursor(map, cursor, random);\n if (!cursor) {\n // When this happens, we should just instead start building from somewhere else\n //console.log('CURSOR STUCK. Rebuild...');\n failCount++;\n if (config.maxFails && failCount > config.maxFails) throw new Error('Failed too many times to generate this configuration');\n return false;\n }\n }\n\n // Build walls between this room and other rooms / void\n for (var _i = 0, _zones_in_this_room = zones_in_this_room; _i < _zones_in_this_room.length; _i++) {\n var zone_location = _zones_in_this_room[_i];\n buildWallsForZone(map, zone_location);\n }\n all_room_zones[room] = zones_in_this_room;\n\n // Move cursor to an area outside but next to this room, and add door\n if (room != number_of_rooms - 1) {\n cursor = findNakedAdjacent(map, zones_in_this_room, random);\n }\n }\n\n // Lets add some random doors between rooms, otherwise it's too linear\n var new_door_count = 0;\n for (var _i2 = 0, _all_room_zones = all_room_zones; _i2 < _all_room_zones.length; _i2++) {\n var room_zones = _all_room_zones[_i2];\n var _iterator = _createForOfIteratorHelper(room_zones),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var coords = _step.value;\n if (coords.x === 0 || coords.y === 0 || coords.x >= MAP_WIDTH - 1 || coords.y >= MAP_HEIGHT - 1) {\n // Don't attempt to build random doors on extremes. Could be more specific though, doesn't always need to be avoided.\n continue;\n }\n var this_zone = map[coords.y][coords.x];\n var this_room_id = this_zone.room;\n var comparedZone = null;\n\n // South\n comparedZone = map[coords.y + 1][coords.x];\n if (comparedZone.open && Math.abs(comparedZone.room - this_room_id) > ROOM_ID_DIFF_RANDOM_DOOR_THRESHOLD && Math.random() <= ROOM_ID_DIFF_RANDOM_DOOR_ODDS) {\n buildDoorBetweenZones(map, coords, {\n x: coords.x,\n y: coords.y + 1\n });\n new_door_count++;\n }\n\n // North\n comparedZone = map[coords.y - 1][coords.x];\n if (comparedZone.open && Math.abs(comparedZone.room - this_room_id) > ROOM_ID_DIFF_RANDOM_DOOR_THRESHOLD && Math.random() <= ROOM_ID_DIFF_RANDOM_DOOR_ODDS) {\n buildDoorBetweenZones(map, coords, {\n x: coords.x,\n y: coords.y - 1\n });\n new_door_count++;\n }\n\n // West\n comparedZone = map[coords.y][coords.x - 1];\n if (comparedZone.open && Math.abs(comparedZone.room - this_room_id) > ROOM_ID_DIFF_RANDOM_DOOR_THRESHOLD && Math.random() <= ROOM_ID_DIFF_RANDOM_DOOR_ODDS) {\n buildDoorBetweenZones(map, coords, {\n x: coords.x - 1,\n y: coords.y\n });\n new_door_count++;\n }\n\n // East\n comparedZone = map[coords.y][coords.x + 1];\n if (comparedZone.open && Math.abs(comparedZone.room - this_room_id) > ROOM_ID_DIFF_RANDOM_DOOR_THRESHOLD && Math.random() <= ROOM_ID_DIFF_RANDOM_DOOR_ODDS) {\n buildDoorBetweenZones(map, coords, {\n x: coords.x + 1,\n y: coords.y\n });\n new_door_count++;\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n }\n if (new_door_count < NEW_DOOR_MIN_THRESHOLD) {\n failCount++;\n if (config.maxFails && failCount > config.maxFails) throw new Error('Failed too many times to generate this configuration');\n //console.log('UNMET DOOR THRESHOLD: ' + new_door_count + ' OF ' + //NEW_DOOR_MIN_THRESHOLD + '. Rebuild...');\n return false;\n }\n\n // Build our exits\n for (var _i3 = 0, _DIRECTIONS = DIRECTIONS; _i3 < _DIRECTIONS.length; _i3++) {\n var dir = _DIRECTIONS[_i3];\n map[exits[dir].y][exits[dir].x].edges[dir] = EXIT;\n map[exits[dir].y][exits[dir].x].exit = true;\n }\n return {\n map: map,\n exits: exits,\n failCount: failCount,\n rooms: all_room_zones\n };\n }\n\n // Finds an open zone which is adjacent to one of the supplied zones\n function findNakedAdjacent(map, zones, random) {\n zones = shuffle(zones, random);\n var _iterator2 = _createForOfIteratorHelper(zones),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var current_zone = _step2.value;\n var newZone = moveCursor(map, current_zone, random);\n if (newZone) {\n buildDoorBetweenZones(map, current_zone, newZone);\n return newZone;\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n return false;\n }\n\n // Move the cursor to an available adjacent zone\n function moveCursor(map, cursor, random) {\n var adjacents = shuffle([{\n d: 'n',\n x: 0,\n y: 1\n }, {\n d: 'e',\n x: 1,\n y: 0\n }, {\n d: 's',\n x: 0,\n y: -1\n }, {\n d: 'w',\n x: -1,\n y: 0\n }], random);\n var direction = null;\n var newCursor = null;\n //eslint-disable-next-line no-cond-assign\n while (direction = adjacents.pop()) {\n newCursor = {\n x: cursor.x + direction.x,\n y: cursor.y + direction.y\n };\n if (newCursor.x < 0 || newCursor.y < 0 || newCursor.x >= MAP_WIDTH || newCursor.y >= MAP_HEIGHT) {\n // When this happens, we should just move the cursor somewhere else\n //console.log('CURSOR OUT OF BOUNDS. Rebuild...');\n failCount++;\n if (config.maxFails && failCount > config.maxFails) throw new Error('Failed too many times to generate this configuration');\n return null;\n }\n if (!map[newCursor.y][newCursor.x].open) {\n return newCursor;\n }\n }\n return false;\n }\n\n // Takes the coordinates of a zone, and map info, and works on building\n // walls for that particular zone. Should also update this so that we make\n // sure we're not looking outside the bounds of our array (<0 | >MAX).\n // Also, don't want to blow away doors...\n function buildWallsForZone(map, loc) {\n var room = map[loc.y][loc.x].room;\n\n // NORTH\n if (map[loc.y][loc.x].edges.n != DOOR) {\n if (loc.y === 0 || !map[loc.y - 1][loc.x].open || map[loc.y - 1][loc.x].room != room) {\n map[loc.y][loc.x].edges.n = WALL;\n } else {\n map[loc.y][loc.x].edges.n = OPEN;\n }\n }\n\n // EAST\n if (map[loc.y][loc.x].edges.e != DOOR) {\n if (loc.x >= MAP_WIDTH - 1 || !map[loc.y][loc.x + 1].open || map[loc.y][loc.x + 1].room != room) {\n map[loc.y][loc.x].edges.e = WALL;\n } else {\n map[loc.y][loc.x].edges.e = OPEN;\n }\n }\n\n // SOUTH\n if (map[loc.y][loc.x].edges.s != DOOR) {\n if (loc.y >= MAP_HEIGHT - 1 || !map[loc.y + 1][loc.x].open || map[loc.y + 1][loc.x].room != room) {\n map[loc.y][loc.x].edges.s = WALL;\n } else {\n map[loc.y][loc.x].edges.s = OPEN;\n }\n }\n\n // WEST\n if (map[loc.y][loc.x].edges.w != DOOR) {\n if (loc.x === 0 || !map[loc.y][loc.x - 1].open || map[loc.y][loc.x - 1].room != room) {\n map[loc.y][loc.x].edges.w = WALL;\n } else {\n map[loc.y][loc.x].edges.w = OPEN;\n }\n }\n }\n};\n\n// Get a random integer between the supplied min and max\nfunction rangedRandom(min, max, random) {\n return Math.floor(random() * (max + 1 - min) + min);\n}\n\n// Builds a door between these two (hopefully) adjacent zones\nfunction buildDoorBetweenZones(map, zonePos1, zonePos2) {\n var zone1 = map[zonePos1.y][zonePos1.x];\n var zone2 = map[zonePos2.y][zonePos2.x];\n if (zonePos1.x == zonePos2.x && zonePos1.y > zonePos2.y) {\n // ZONE1 SOUTH OF ZONE2\n zone1.edges.n = DOOR;\n zone2.edges.s = DOOR;\n } else if (zonePos1.x == zonePos2.x && zonePos1.y < zonePos2.y) {\n // ZONE1 NORTH OF ZONE2\n zone1.edges.s = DOOR;\n zone2.edges.n = DOOR;\n } else if (zonePos1.y == zonePos2.y && zonePos1.x > zonePos2.x) {\n // ZONE1 EAST OF ZONE2\n zone1.edges.w = DOOR;\n zone2.edges.e = DOOR;\n } else if (zonePos1.y == zonePos2.y && zonePos1.x < zonePos2.x) {\n // ZONE1 WEST OF ZONE2\n zone1.edges.e = DOOR;\n zone2.edges.w = DOOR;\n } else {\n console.log('BUILD DOOR FAILURE', zone1, zone2);\n }\n}\n\n// Randomizes an array\nfunction shuffle(array, random) {\n var arr = array.slice(); // clone array\n var i = arr.length,\n j,\n tempi,\n tempj;\n if (i == 0) return false;\n while (--i) {\n j = Math.floor(random() * (i + 1));\n tempi = arr[i];\n tempj = arr[j];\n arr[i] = tempj;\n arr[j] = tempi;\n }\n return arr;\n}\n\n// Builds a big empty square array, an entire map\nfunction initialize(width, height) {\n var map = [];\n for (var y = 0; y < height; y++) {\n map[y] = [];\n for (var x = 0; x < width; x++) {\n map[y][x] = {\n open: false,\n room: null,\n exit: null,\n zone: null,\n edges: {\n n: null,\n e: null,\n s: null,\n w: null\n }\n };\n }\n }\n return map;\n}\nfunction ALGORITHM_METROIDVANIA(tileMap, options) {\n tileMap.fill(0); // Fill with walls\n var maxDimension = Math.max(tileMap.width, tileMap.height);\n if (maxDimension <= 5) {\n return;\n }\n var fractional = Math.sqrt(maxDimension);\n if (fractional % 2 !== 1) fractional++;\n var size = maxDimension < 10 ? Math.floor(maxDimension / 2) : 10;\n var doorDiff = maxDimension < 10 ? 1 : 2;\n var roomSizeHeight = Math.floor(tileMap.width / size);\n var roomSizeWidth = Math.floor(tileMap.height / size);\n var numRoomsWide = Math.floor(tileMap.width / roomSizeHeight);\n var numRoomsHigh = Math.floor(tileMap.height / roomSizeWidth);\n var maxCount = Math.floor(numRoomsWide * numRoomsHigh * 0.8);\n var minCount = Math.floor(maxCount / 4);\n var generator = new Metroidvania({\n roomWidth: roomSizeWidth,\n roomHeight: roomSizeHeight,\n maxFails: 25000,\n width: numRoomsWide,\n // Max number of zones wide\n height: numRoomsWide,\n // Max number of zones tall\n gridHeight: tileMap.height,\n gridWidth: tileMap.width,\n minZonesPerRoom: 1,\n // Minimum number of zones per room\n maxZonesPerRoom: 3,\n // Maximum number of zones per room\n minRoomsPerMap: minCount,\n // Minimum number of rooms per map\n maxRoomsPerMap: maxCount,\n // Maximum number of rooms per map\n newDoors: doorDiff,\n // # doors to add to prevent tedious linear mazes\n roomDiff: doorDiff,\n // When adding a new door, room ID distance\n roomDiffOdds: 1 / 2 // Odds of inserting a new door on opportunity\n });\n var built = generator.build(function () {\n return tileMap.random();\n });\n var flattened = built.world.reduce(function (agg, line) {\n return agg.concat(line);\n }, []);\n built.world = null;\n tileMap.world = built;\n for (var lcv = 0; lcv < tileMap.data.length; lcv++) {\n tileMap.data[lcv] = flattened[lcv];\n }\n}\n\n},{}],16:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generateMap;\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction generateMap(tileMap, options) {\n var stack = [];\n var visited = Array.from({\n length: tileMap.height\n }, function () {\n return Array(tileMap.width).fill(false);\n });\n var visitCell = function visitCell(x, y) {\n visited[y][x] = true;\n stack.push([x, y]);\n while (stack.length > 0) {\n var _stack = _slicedToArray(stack[stack.length - 1], 2),\n cx = _stack[0],\n cy = _stack[1];\n var neighbors = getNeighbors(cx, cy);\n if (neighbors.length > 0) {\n var _neighbors$Math$floor = _slicedToArray(neighbors[Math.floor(tileMap.random(neighbors.length))], 2),\n nx = _neighbors$Math$floor[0],\n ny = _neighbors$Math$floor[1];\n removeWall(cx, cy, nx, ny);\n visited[ny][nx] = true;\n stack.push([nx, ny]);\n } else {\n stack.pop();\n }\n }\n };\n var getNeighbors = function getNeighbors(x, y) {\n var neighbors = [];\n if (x > 0 && !visited[y][x - 1]) neighbors.push([x - 1, y]);\n if (y > 0 && !visited[y - 1][x]) neighbors.push([x, y - 1]);\n if (x < tileMap.width - 1 && !visited[y][x + 1]) neighbors.push([x + 1, y]);\n if (y < tileMap.height - 1 && !visited[y + 1][x]) neighbors.push([x, y + 1]);\n return neighbors;\n };\n var removeWall = function removeWall(x, y, nx, ny) {\n var index1 = y * tileMap.width + x;\n var index2 = ny * tileMap.width + nx;\n tileMap.data[Math.min(index1, index2)] = 0; // Assuming 1 is a wall and 0 is an open path\n };\n\n // Start from a random cell\n var startX = Math.floor(tileMap.random(tileMap.width));\n var startY = Math.floor(tileMap.random(tileMap.height));\n visitCell(startX, startY);\n}\n\n},{}],17:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generateRecursiveDivisionMap;\n// RecursiveDivision.js - Marak Squires 2024\nfunction generateRecursiveDivisionMap(tileMap, options) {\n var floorTileId = 1; // TODO: change to 0\n var wallTileId = 0; // TODO: change to 1\n\n tileMap.data.fill(floorTileId);\n var addWalls = function addWalls(x1, y1, x2, y2) {\n if (x2 - x1 < 2 || y2 - y1 < 2) return;\n var horizontal = x2 - x1 < y2 - y1;\n var wx = horizontal ? x1 : Math.floor(tileMap.random(x2 - x1 - 2)) + x1 + 1;\n var wy = horizontal ? Math.floor(tileMap.random(y2 - y1 - 2)) + y1 + 1 : y1;\n var px = horizontal ? Math.floor(tileMap.random(x2 - x1)) + x1 : wx;\n var py = horizontal ? wy : Math.floor(tileMap.random(y2 - y1)) + y1;\n for (var x = x1; x < x2; x++) {\n for (var y = y1; y < y2; y++) {\n if (horizontal && x === wx && y !== py || !horizontal && y === wy && x !== px) {\n tileMap.data[y * tileMap.width + x] = wallTileId;\n }\n }\n }\n if (horizontal) {\n addWalls(x1, y1, x2, wy);\n addWalls(x1, wy, x2, y2);\n } else {\n addWalls(x1, y1, wx, y2);\n addWalls(wx, y1, x2, y2);\n }\n };\n addWalls(0, 0, tileMap.width, tileMap.height);\n}\n\n},{}],18:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = ALGORITHM_THOMAS_HUNTER;\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * Originally written by Thomas Hunter II\n *\n * Originally written on June 12, 2013\n * Originally hosted at https://github.com/PhobosRising/javascript-roguelike-map-generator\n */\n\n//import { random } from './random.mjs';\n\n//const rand = require('../../utility/random/index.js');\n\nvar TILE = {\n VOID: 0,\n FLOOR: 1,\n WALL: 2,\n DOOR: 3,\n SPECIAL_DOOR: 4,\n ENTER: 5,\n EXIT: 6\n};\nvar DEFAULT = {\n WIDTH: 21,\n HEIGHT: 21,\n MIN_ROOM_WIDTH: 3,\n MAX_ROOM_WIDTH: 7,\n MIN_ROOM_HEIGHT: 3,\n MAX_ROOM_HEIGHT: 7,\n IDEAL_COUNT: 10,\n RETRY_COUNT: 100\n};\n\n//var WALL_X = 0;\n//var WALL_Y = 1;\n\nvar ROOM_GAP = 1;\nvar Roguelike = /*#__PURE__*/function () {\n function Roguelike() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, Roguelike);\n if (!config) {\n config = {};\n }\n if (!config.room) {\n config.room = {};\n }\n this.max_width = config.width || DEFAULT.WIDTH;\n this.max_height = config.height || DEFAULT.HEIGHT;\n this.room_min_width = config.room.min_width || DEFAULT.MIN_ROOM_WIDTH;\n this.room_max_width = config.room.max_width || DEFAULT.MAX_ROOM_WIDTH;\n this.room_min_height = config.room.min_height || DEFAULT.MIN_ROOM_HEIGHT;\n this.room_max_height = config.room.max_height || DEFAULT.MAX_ROOM_HEIGHT;\n this.room_ideal_count = config.room.ideal || DEFAULT.IDEAL_COUNT;\n this.retry_count = config.retry || DEFAULT.IDEAL_COUNT;\n this.want_special = !!config.special;\n }\n _createClass(Roguelike, [{\n key: \"render\",\n value: function render() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var blt = arguments.length > 1 ? arguments[1] : undefined;\n var built = blt || this.build();\n var world = built.world;\n\n //var end = new Date();\n\n var result = '';\n // Crude mechanism for drawing level\n for (var y = 0; y < world.length; y++) {\n var row = '';\n for (var x = 0; x < world[y].length; x++) {\n var tile = world[y][x];\n if (tile === 0) {\n row += ' ';\n } else if (tile === 1) {\n row += '.';\n } else if (tile === 2) {\n row += '#';\n } else if (tile === 3) {\n row += '/';\n } else if (tile === 4) {\n row += 'X';\n } else if (tile === 5) {\n row += '<';\n } else if (tile === 6) {\n row += '>';\n } else {\n row += world[y][x];\n }\n }\n result += row + '\\n';\n //console.log(row + '| ' + y);\n }\n return result;\n }\n }, {\n key: \"build\",\n value: function build(random) {\n this.random = random ? random : function () {\n return Math.random();\n };\n this.world = null; // 2D array representing the world\n this.rooms = {}; // Object containing rooms where the key is the Room ID\n this.doors = {}; // Object containing doors where the key is the Door ID\n this.walls = []; // Array of all walls, where each items is an [X,Y] pair\n this.enter = null; // {x, y, room_id} object pointing to level entrance\n this.exit = null; // {x, y, room_id} object pointing to level exit\n this.special = null; // {room_id, door_id} object pointing to special area\n this.deadends = [];\n this.room_id = 0;\n this.door_id = 0;\n this.createVoid();\n this.addStarterRoom();\n this.generateRooms();\n this.addSpecialRooms();\n this.buildWalls();\n return {\n width: this.max_width,\n height: this.max_height,\n enter: this.enter,\n exit: this.exit,\n deadends: this.deadends,\n special: this.special,\n door_count: this.door_id,\n doors: this.doors,\n room_count: this.room_id,\n rooms: this.rooms,\n walls: this.walls,\n world: this.world\n };\n }\n\n /**\n * Creates a 2D array of VOID tiles\n */\n }, {\n key: \"createVoid\",\n value: function createVoid() {\n var world = [];\n for (var y = 0; y < this.max_height; y++) {\n world[y] = [];\n for (var x = 0; x < this.max_width; x++) {\n world[y][x] = TILE.VOID;\n }\n }\n this.world = world;\n }\n }, {\n key: \"addStarterRoom\",\n value: function addStarterRoom() {\n var dimen = this.getRoomDimensions();\n var min_left = ROOM_GAP;\n var max_left = this.max_width - (dimen.width + ROOM_GAP * 2) + ROOM_GAP;\n var min_top = ROOM_GAP;\n var max_top = this.max_height - (dimen.height + ROOM_GAP * 2) + ROOM_GAP;\n var left = this.randomOdd(min_left, max_left);\n var top = this.randomOdd(min_top, max_top);\n //console.log('starter', left, top, dimen.width, dimen.height)\n this.addRoom(left, top, dimen.width, dimen.height);\n //console.log('W', this.world)\n }\n }, {\n key: \"getRoomDimensions\",\n value: function getRoomDimensions() {\n return {\n width: this.randomOdd(this.room_min_width, this.room_max_width),\n height: this.randomOdd(this.room_min_height, this.room_max_height)\n };\n }\n }, {\n key: \"addRoom\",\n value: function addRoom(left, top, width, height) {\n var room_id = this.room_id++;\n this.rooms[room_id] = {\n left: left,\n top: top,\n width: width,\n height: height,\n id: room_id,\n walls: [],\n neighbors: [],\n doors: []\n };\n for (var y = top; y < top + height; y++) {\n for (var x = left; x < left + width; x++) {\n //console.log('f');\n this.world[y][x] = TILE.FLOOR;\n }\n }\n return room_id;\n }\n\n /**\n * Adds one-off floors, e.g. for building hallways\n */\n }, {\n key: \"addFloor\",\n value: function addFloor(x, y) {\n this.world[y][x] = TILE.FLOOR;\n }\n }, {\n key: \"generateRooms\",\n value: function generateRooms() {\n var retries = this.retry_count;\n while (this.room_id < this.room_ideal_count) {\n //console.log('!')\n if (!this.generateRoom() && --retries <= 0) {\n break;\n }\n }\n }\n\n /**\n * Attempts to add a single room to our world\n *\n * Pick a random cardinal direction\n * Generate a room size\n * Slide that room in until it bumps into another room\n * Build a door that connects the two\n */\n }, {\n key: \"generateRoom\",\n value: function generateRoom() {\n var slide = this.randomFn(0, 3); // North, East, South, West\n\n var x_dir = slide === 1 ? +1 : slide === 3 ? -1 : 0;\n var y_dir = slide === 0 ? +1 : slide === 2 ? -1 : 0;\n var dimen = this.getRoomDimensions();\n var top, left, name;\n if (slide === 0) {\n // Slide South from Top\n name = 'south';\n top = ROOM_GAP;\n left = this.randomOdd(ROOM_GAP, this.max_width - dimen.width - ROOM_GAP * 2);\n } else if (slide === 1) {\n // Slide East from Left\n name = 'east';\n top = this.randomOdd(ROOM_GAP, this.max_height - dimen.height - ROOM_GAP * 2);\n left = ROOM_GAP;\n } else if (slide === 2) {\n // Slide North from Bottom\n name = 'north';\n top = this.max_height - dimen.height - ROOM_GAP;\n left = this.randomOdd(ROOM_GAP, this.max_width - dimen.width - ROOM_GAP * 2);\n } else if (slide === 3) {\n // Slide West from Right\n //eslint-disable-next-line no-unused-vars\n name = 'west';\n top = this.randomOdd(ROOM_GAP, this.max_height - dimen.height - ROOM_GAP * 2);\n left = this.max_width - dimen.width - ROOM_GAP;\n }\n\n //console.log(name, top, left)\n\n // Our start position for adding a room overlaps with an existing one :(\n if (false !== this.collides(top, left, dimen.width, dimen.height)) {\n return false;\n }\n var collide_room = null;\n while (false === (collide_room = this.collides(top + y_dir, left + x_dir, dimen.width, dimen.height))) {\n top += y_dir;\n left += x_dir;\n //console.log(name, top, left)\n // We slid the room out of bounds of the world\n if (this.invalid(top, left, dimen.width, dimen.height)) {\n //console.log('INVALID')\n return false;\n }\n }\n var new_room_id = this.addRoom(left, top, dimen.width, dimen.height);\n //console.log('world', this.world);\n this.addDoorBetweenRooms(x_dir, y_dir, collide_room, new_room_id);\n return true;\n }\n }, {\n key: \"collides\",\n value: function collides(top, left, width, height) {\n var target = {\n top: top,\n left: left,\n width: width,\n height: height\n };\n for (var i = 0; i < this.room_id; i++) {\n var room = this.rooms[i];\n /*console.log(target.left, room.left + room.width,\n target.left + target.width , room.left,\n target.top , room.top + room.height,\n target.top + target.height , room.top)*/\n if (!(target.left > room.left + room.width || target.left + target.width < room.left || target.top > room.top + room.height || target.top + target.height < room.top)) {\n return room.id; // truthy int\n }\n }\n return false;\n }\n }, {\n key: \"invalid\",\n value: function invalid(top, left, width, height) {\n if (top <= ROOM_GAP) {\n // Too far north\n return true;\n } else if (left <= ROOM_GAP) {\n // Too far west\n return true;\n } else if (top + height >= this.max_height - ROOM_GAP) {\n // Too far east\n return true;\n } else if (left + width >= this.max_width - ROOM_GAP) {\n // Too far south\n return true;\n }\n\n // A O.K.\n return false;\n }\n\n /**\n * Finds boundaries between floors and void, adding walls\n */\n }, {\n key: \"buildWalls\",\n value: function buildWalls() {\n var rooms = this.rooms;\n //var world = this.world;\n\n // Do this for halls and rooms\n for (var i = 0; i < this.room_id; i++) {\n var room = rooms[i];\n\n // Top Wall (Long)\n for (var tx = room.left - 1; tx < room.left + room.width + 1; tx++) {\n this.addWall(tx, room.top - 1, room);\n }\n\n // Right Wall (Short)\n for (var ry = room.top; ry < room.top + room.height; ry++) {\n this.addWall(room.left + room.width, ry, room);\n }\n\n // Bottom Wall (Long)\n for (var bx = room.left - 1; bx < room.left + room.width + 1; bx++) {\n this.addWall(bx, room.top + room.height, room);\n }\n\n // Left Wall (Short)\n for (var ly = room.top; ly < room.top + room.height; ly++) {\n this.addWall(room.left - 1, ly, room);\n }\n }\n }\n }, {\n key: \"addWall\",\n value: function addWall(x, y, room) {\n // Walls should only appear once in the global walls list and world grid\n if (this.world[y][x] === TILE.VOID) {\n this.world[y][x] = TILE.WALL;\n this.walls.push([x, y]);\n }\n if (this.world[y][x] === TILE.VOID || this.world[y][x] === TILE.WALL) {\n room.walls.push([x, y]);\n }\n }\n }, {\n key: \"addDoorBetweenRooms\",\n value: function addDoorBetweenRooms(x_dir, y_dir, existing_room_id, new_room_id) {\n var existing_room = this.rooms[existing_room_id];\n var new_room = this.rooms[new_room_id];\n var x, y, orientation;\n if (x_dir === 1) {\n // eastward\n x = existing_room.left - 1;\n y = this.randomFn(Math.max(existing_room.top, new_room.top) + 1, Math.min(existing_room.top + existing_room.height, new_room.top + new_room.height) - 2);\n orientation = 'h'; // horizontal\n } else if (x_dir === -1) {\n // stabbing westward\n x = new_room.left - 1;\n y = this.randomFn(Math.max(new_room.top, existing_room.top) + 1, Math.min(new_room.top + new_room.height, existing_room.top + existing_room.height) - 2);\n orientation = 'h'; // horizontal\n } else if (y_dir === -1) {\n // northward\n x = this.randomFn(Math.max(existing_room.left, new_room.left) + 1, Math.min(existing_room.left + existing_room.width, new_room.left + new_room.width) - 2);\n y = new_room.top - 1;\n orientation = 'v'; // vertical\n } else if (y_dir === 1) {\n // southward\n x = this.randomFn(Math.max(new_room.left, existing_room.left) + 1, Math.min(new_room.left + new_room.width, existing_room.left + existing_room.width) - 2);\n y = existing_room.top - 1;\n orientation = 'v'; // vertical\n }\n this.addDoor(x, y, existing_room_id, new_room_id, orientation);\n this.rooms[existing_room_id].neighbors.push(new_room_id);\n this.rooms[new_room_id].neighbors.push(existing_room_id);\n }\n\n /**\n * Add an entrance and exit to the level.\n *\n * Optionally adds a special room (could be hidden, a shop, etc.)\n *\n * We pick two random rooms with only a single attached neighbor.\n * This ensures two adjacent rooms aren't entrance and exit.\n */\n }, {\n key: \"addSpecialRooms\",\n value: function addSpecialRooms() {\n var deadends = [];\n var smallest = {\n id: null,\n area: Infinity\n };\n var room, area;\n for (var i = 0; i < this.room_id; i++) {\n room = this.rooms[i];\n if (room.neighbors.length === 1) {\n this.rooms[i].deadend = true;\n deadends.push(i);\n area = room.width * room.height;\n if (area < smallest.area) {\n smallest.id = i;\n }\n }\n }\n if (this.want_special && deadends.length >= 2) {\n // Enter + Exit + Special\n var index = deadends.indexOf(smallest.id);\n deadends.splice(index, 1);\n var door_id = this.rooms[smallest.id].doors[0];\n var room_id = smallest.id;\n this.special = {\n room_id: room_id,\n door_id: door_id\n };\n var door = this.doors[door_id];\n door.special = true;\n this.rooms[room_id].special = true;\n this.world[door.y][door.x] = TILE.SPECIAL_DOOR;\n }\n this.shuffle(deadends);\n var enter_room_id = deadends.pop();\n if (typeof enter_room_id === 'undefined') {\n //throw new Error('Unable to find a dead end room for Enter!');\n return;\n }\n var enter = this.randomNonEdgeInRoom(enter_room_id);\n this.world[enter.y][enter.x] = TILE.ENTER;\n this.enter = {\n x: enter.x,\n y: enter.y,\n room_id: enter_room_id\n };\n this.rooms[enter_room_id].enter = true;\n var enter_door = this.rooms[enter_room_id].doors[0];\n this.doors[enter_door].enter = true;\n var exit_room_id = deadends.pop();\n if (typeof exit_room_id === 'undefined') {\n //throw new Error('Unable to find a dead end room for Exit!');\n return;\n }\n var exit = this.randomNonEdgeInRoom(exit_room_id);\n this.world[exit.y][exit.x] = TILE.EXIT;\n this.exit = {\n x: exit.x,\n y: exit.y,\n room_id: exit_room_id\n };\n this.rooms[exit_room_id].exit = true;\n var exit_door = this.rooms[exit_room_id].doors[0];\n this.doors[exit_door].exit = true;\n this.deadends = deadends;\n }\n }, {\n key: \"randomNonEdgeInRoom\",\n value: function randomNonEdgeInRoom(room_id) {\n var room = this.rooms[room_id];\n return {\n x: this.randomFn(room.left + 1, room.left + room.width - 2),\n y: this.randomFn(room.top + 1, room.top + room.height - 2)\n };\n }\n }, {\n key: \"addDoor\",\n value: function addDoor(x, y, room1, room2, orientation) {\n this.world[y][x] = TILE.DOOR;\n var door_id = this.door_id++;\n this.doors[door_id] = {\n x: x,\n y: y,\n id: door_id,\n orientation: orientation,\n rooms: [room1, room2]\n };\n this.rooms[room1].doors.push(door_id);\n this.rooms[room2].doors.push(door_id);\n return door_id;\n }\n\n /**\n * Pick a number between min and max, inclusive\n * e.g. 1,7 => 1,2,3,4,5,6,7\n */\n }, {\n key: \"randomFn\",\n value: function randomFn(min_raw, max_raw) {\n var min = Math.floor(min_raw);\n var max = Math.floor(max_raw);\n return Math.floor(this.random() * (max + 1 - min) + min);\n }\n\n /**\n * Picks a random odd number between min and max, inclusive (if odd)\n * e.g. 2,9 => 3,5,7,9\n *\n * TODO: Make this a one-liner\n */\n }, {\n key: \"randomOdd\",\n value: function randomOdd(min_raw, max_raw) {\n // Convert them to integers\n var min = Math.floor(min_raw);\n var max = Math.floor(max_raw);\n\n // Make them both Odd\n if (min % 2 === 0) min++;\n if (max % 2 === 0) max--;\n\n // Shift down one, make them even\n min -= 1;\n max -= 1;\n\n // Cut them in half\n min /= 2;\n max /= 2;\n var r = this.random();\n //console.log('R', r);\n var result = Math.floor(r * (max + 1 - min) + min);\n result *= 2;\n result += 1;\n return result;\n }\n }, {\n key: \"shuffle\",\n value: function shuffle(o) {\n for (var j, x, i = o.length; i; j = Math.floor(this.random() * i), x = o[--i], o[i] = o[j], o[j] = x);\n }\n }]);\n return Roguelike;\n}();\nfunction ALGORITHM_THOMAS_HUNTER(tileMap, options) {\n tileMap.fill(1); // Fill with walls\n var maxDimension = Math.max(tileMap.width, tileMap.height);\n if (maxDimension <= 5) {\n return;\n }\n var fractional = Math.floor(Math.sqrt(Math.max(tileMap.width, tileMap.height)));\n if (fractional % 2 !== 1) fractional++;\n var roomNumber = Math.floor(tileMap.width / fractional * tileMap.width / fractional / 2);\n var rangius = Math.ceil(fractional / 2);\n var generator = new Roguelike({\n width: tileMap.width,\n // Max Width of the world\n height: tileMap.height,\n // Max Height of the world\n retry: 100,\n // How many times should we try to add a room?\n special: true,\n // Should we generate a \"special\" room?\n room: {\n // Give up once we get this number of rooms\n ideal: options.roomCount || roomNumber,\n min_width: options.roomMinWidth || fractional - rangius,\n max_width: options.roomMaxWidth || fractional + rangius,\n min_height: options.roomMinHeight || fractional - rangius,\n max_height: options.roomMinHeight || fractional + rangius\n }\n });\n var built = generator.build(function () {\n return tileMap.random();\n });\n\n //console.log(built.world.map((line)=>line.join('')).join('\\n'));\n var flattened = built.world.reduce(function (agg, line) {\n return agg.concat(line);\n }, []);\n built.world = null;\n tileMap.world = built;\n for (var lcv = 0; lcv < tileMap.data.length; lcv++) {\n tileMap.data[lcv] = flattened[lcv];\n }\n}\n\n},{}],19:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = SHAPE_CIRCLE;\nfunction SHAPE_CIRCLE(tileMap, options) {\n tileMap.fill(1);\n var radius = Math.min(tileMap.width, tileMap.height) / 2;\n var centerX = tileMap.width / 2;\n var centerY = tileMap.height / 2;\n for (var y = 0; y < tileMap.height; y++) {\n for (var x = 0; x < tileMap.width; x++) {\n if (Math.pow(x - centerX, 2) + Math.pow(y - centerY, 2) <= Math.pow(radius, 2)) {\n tileMap.data[y * tileMap.width + x] = 0;\n }\n }\n }\n}\n\n},{}],20:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = SHAPE_SQUARE;\nfunction SHAPE_SQUARE(tileMap, options) {\n tileMap.fill(0); // Filling the map with empty tiles\n var size = Math.min(tileMap.width, tileMap.height);\n var startX = Math.floor((tileMap.width - size) / 2);\n var startY = Math.floor((tileMap.height - size) / 2);\n for (var y = startY; y < startY + size; y++) {\n for (var x = startX; x < startX + size; x++) {\n tileMap.data[y * tileMap.width + x] = 1; // Fill with a different tile\n }\n }\n}\n\n},{}],21:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = SHAPE_TRIANGLE;\nfunction SHAPE_TRIANGLE(tileMap, options) {\n tileMap.fill(0);\n var height = tileMap.height;\n var width = tileMap.width;\n for (var y = 0; y < height; y++) {\n for (var x = 0; x <= y; x++) {\n tileMap.data[y * width + x] = 1;\n }\n }\n}\n\n},{}],22:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generateFaultLineMap;\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction generateFaultLineMap(tileMap, options) {\n var iterations = options.iterations || 100;\n var heightIncrease = options.heightIncrease || 0.01;\n\n // Initialize the height map\n var heightMap = new Array(tileMap.width * tileMap.height).fill(0);\n for (var i = 0; i < iterations; i++) {\n // Randomly create a fault line using tileMap.random()\n var a = tileMap.random() - 0.5;\n var b = tileMap.random() - 0.5;\n var d = tileMap.random();\n\n // Adjust the height on one side of the fault line\n for (var y = 0; y < tileMap.height; y++) {\n for (var x = 0; x < tileMap.width; x++) {\n if (a * x + b * y - d > 0) {\n heightMap[y * tileMap.width + x] += heightIncrease;\n }\n }\n }\n }\n\n // Normalize and apply to tileMap\n applyHeightToTileMap(tileMap, heightMap);\n}\nfunction applyHeightToTileMap(tileMap, heightMap) {\n var max = Math.max.apply(Math, _toConsumableArray(heightMap));\n var min = Math.min.apply(Math, _toConsumableArray(heightMap));\n for (var i = 0; i < heightMap.length; i++) {\n // Normalize the height values\n var normalizedHeight = (heightMap[i] - min) / (max - min);\n tileMap.data[i] = normalizedHeight;\n }\n}\n\n},{}],23:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generatePerlinNoiseMap;\nfunction generatePerlinNoiseMap(tileMap, options) {\n var scale = options.scale || 0.1; // Determines the \"zoom level\" of the noise\n\n for (var y = 0; y < tileMap.height; y++) {\n for (var x = 0; x < tileMap.width; x++) {\n // Generate Perlin noise value for each tile\n var noiseValue = tileMap.noise(x * scale, y * scale);\n\n // Optionally transform noiseValue here to suit your needs\n\n // Assign noise value to tileMap data\n tileMap.data[y * tileMap.width + x] = noiseValue;\n }\n }\n}\n\n},{}],24:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n// this program is a JavaScript version of Mersenne Twister, with concealment and encapsulation in class,\n// an almost straight conversion from the original program, mt19937ar.c,\n// translated by y. okada on July 17, 2006.\n// and modified a little at july 20, 2006, but there are not any substantial differences.\n// in this program, procedure descriptions and comments of original source code were not removed.\n// lines commented with //c// were originally descriptions of c procedure. and a few following lines are appropriate JavaScript descriptions.\n// lines commented with /* and */ are original comments.\n// lines commented with // are additional comments in this JavaScript version.\n// before using this version, create at least one instance of MersenneTwister19937 class, and initialize the each state, given below in c comments, of all the instances.\n/*\n A C-program for MT19937, with initialization improved 2002/1/26.\n Coded by Takuji Nishimura and Makoto Matsumoto.\n\n Before using, initialize the state by using init_genrand(seed)\n or init_by_array(init_key, key_length).\n\n Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions\n are met:\n\n 1. Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n 3. The names of its contributors may not be used to endorse or promote\n products derived from this software without specific prior written\n permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n Any feedback is very welcome.\n http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\n email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)\n*/\n\nfunction MersenneTwister19937() {\n /* constants should be scoped inside the class */\n var N, M, MATRIX_A, UPPER_MASK, LOWER_MASK;\n /* Period parameters */\n //c//#define N 624\n //c//#define M 397\n //c//#define MATRIX_A 0x9908b0dfUL /* constant vector a */\n //c//#define UPPER_MASK 0x80000000UL /* most significant w-r bits */\n //c//#define LOWER_MASK 0x7fffffffUL /* least significant r bits */\n N = 624;\n M = 397;\n MATRIX_A = 0x9908b0df; /* constant vector a */\n UPPER_MASK = 0x80000000; /* most significant w-r bits */\n LOWER_MASK = 0x7fffffff; /* least significant r bits */\n //c//static unsigned long mt[N]; /* the array for the state vector */\n //c//static int mti=N+1; /* mti==N+1 means mt[N] is not initialized */\n var mt = new Array(N); /* the array for the state vector */\n var mti = N + 1; /* mti==N+1 means mt[N] is not initialized */\n\n function unsigned32(n1)\n // returns a 32-bits unsiged integer from an operand to which applied a bit operator.\n {\n return n1 < 0 ? (n1 ^ UPPER_MASK) + UPPER_MASK : n1;\n }\n function subtraction32(n1, n2)\n // emulates lowerflow of a c 32-bits unsiged integer variable, instead of the operator -. these both arguments must be non-negative integers expressible using unsigned 32 bits.\n {\n return n1 < n2 ? unsigned32(0x100000000 - (n2 - n1) & 0xffffffff) : n1 - n2;\n }\n function addition32(n1, n2)\n // emulates overflow of a c 32-bits unsiged integer variable, instead of the operator +. these both arguments must be non-negative integers expressible using unsigned 32 bits.\n {\n return unsigned32(n1 + n2 & 0xffffffff);\n }\n function multiplication32(n1, n2)\n // emulates overflow of a c 32-bits unsiged integer variable, instead of the operator *. these both arguments must be non-negative integers expressible using unsigned 32 bits.\n {\n var sum = 0;\n for (var i = 0; i < 32; ++i) {\n if (n1 >>> i & 0x1) {\n sum = addition32(sum, unsigned32(n2 << i));\n }\n }\n return sum;\n }\n\n /* initializes mt[N] with a seed */\n //c//void init_genrand(unsigned long s)\n this.init_genrand = function (s) {\n //c//mt[0]= s & 0xffffffff;\n mt[0] = unsigned32(s & 0xffffffff);\n for (mti = 1; mti < N; mti++) {\n mt[mti] =\n //c//(1812433253 * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);\n addition32(multiplication32(1812433253, unsigned32(mt[mti - 1] ^ mt[mti - 1] >>> 30)), mti);\n /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */\n /* In the previous versions, MSBs of the seed affect */\n /* only MSBs of the array mt[]. */\n /* 2002/01/09 modified by Makoto Matsumoto */\n //c//mt[mti] &= 0xffffffff;\n mt[mti] = unsigned32(mt[mti] & 0xffffffff);\n /* for >32 bit machines */\n }\n };\n\n /* initialize by an array with array-length */\n /* init_key is the array for initializing keys */\n /* key_length is its length */\n /* slight change for C++, 2004/2/26 */\n //c//void init_by_array(unsigned long init_key[], int key_length)\n this.init_by_array = function (init_key, key_length) {\n //c//int i, j, k;\n var i, j, k;\n //c//init_genrand(19650218);\n this.init_genrand(19650218);\n i = 1;\n j = 0;\n k = N > key_length ? N : key_length;\n for (; k; k--) {\n //c//mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525))\n //c//\t+ init_key[j] + j; /* non linear */\n mt[i] = addition32(addition32(unsigned32(mt[i] ^ multiplication32(unsigned32(mt[i - 1] ^ mt[i - 1] >>> 30), 1664525)), init_key[j]), j);\n mt[i] =\n //c//mt[i] &= 0xffffffff; /* for WORDSIZE > 32 machines */\n unsigned32(mt[i] & 0xffffffff);\n i++;\n j++;\n if (i >= N) {\n mt[0] = mt[N - 1];\n i = 1;\n }\n if (j >= key_length) {\n j = 0;\n }\n }\n for (k = N - 1; k; k--) {\n //c//mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941))\n //c//- i; /* non linear */\n mt[i] = subtraction32(unsigned32((dbg = mt[i]) ^ multiplication32(unsigned32(mt[i - 1] ^ mt[i - 1] >>> 30), 1566083941)), i);\n //c//mt[i] &= 0xffffffff; /* for WORDSIZE > 32 machines */\n mt[i] = unsigned32(mt[i] & 0xffffffff);\n i++;\n if (i >= N) {\n mt[0] = mt[N - 1];\n i = 1;\n }\n }\n mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */\n };\n\n /* moved outside of genrand_int32() by jwatte 2010-11-17; generate less garbage */\n var mag01 = [0x0, MATRIX_A];\n\n /* generates a random number on [0,0xffffffff]-interval */\n //c//unsigned long genrand_int32(void)\n this.genrand_int32 = function () {\n //c//unsigned long y;\n //c//static unsigned long mag01[2]={0x0UL, MATRIX_A};\n var y;\n /* mag01[x] = x * MATRIX_A for x=0,1 */\n\n if (mti >= N) {\n /* generate N words at one time */\n //c//int kk;\n var kk;\n if (mti == N + 1) /* if init_genrand() has not been called, */\n //c//init_genrand(5489); /* a default initial seed is used */\n {\n this.init_genrand(5489);\n } /* a default initial seed is used */\n\n for (kk = 0; kk < N - M; kk++) {\n //c//y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);\n //c//mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1];\n y = unsigned32(mt[kk] & UPPER_MASK | mt[kk + 1] & LOWER_MASK);\n mt[kk] = unsigned32(mt[kk + M] ^ y >>> 1 ^ mag01[y & 0x1]);\n }\n for (; kk < N - 1; kk++) {\n //c//y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);\n //c//mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1];\n y = unsigned32(mt[kk] & UPPER_MASK | mt[kk + 1] & LOWER_MASK);\n mt[kk] = unsigned32(mt[kk + (M - N)] ^ y >>> 1 ^ mag01[y & 0x1]);\n }\n //c//y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);\n //c//mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1];\n y = unsigned32(mt[N - 1] & UPPER_MASK | mt[0] & LOWER_MASK);\n mt[N - 1] = unsigned32(mt[M - 1] ^ y >>> 1 ^ mag01[y & 0x1]);\n mti = 0;\n }\n y = mt[mti++];\n\n /* Tempering */\n //c//y ^= (y >> 11);\n //c//y ^= (y << 7) & 0x9d2c5680;\n //c//y ^= (y << 15) & 0xefc60000;\n //c//y ^= (y >> 18);\n y = unsigned32(y ^ y >>> 11);\n y = unsigned32(y ^ y << 7 & 0x9d2c5680);\n y = unsigned32(y ^ y << 15 & 0xefc60000);\n y = unsigned32(y ^ y >>> 18);\n return y;\n };\n\n /* generates a random number on [0,0x7fffffff]-interval */\n //c//long genrand_int31(void)\n this.genrand_int31 = function () {\n //c//return (genrand_int32()>>1);\n return this.genrand_int32() >>> 1;\n };\n\n /* generates a random number on [0,1]-real-interval */\n //c//double genrand_real1(void)\n this.genrand_real1 = function () {\n //c//return genrand_int32()*(1.0/4294967295.0);\n return this.genrand_int32() * (1.0 / 4294967295.0);\n /* divided by 2^32-1 */\n };\n\n /* generates a random number on [0,1)-real-interval */\n //c//double genrand_real2(void)\n this.genrand_real2 = function () {\n //c//return genrand_int32()*(1.0/4294967296.0);\n return this.genrand_int32() * (1.0 / 4294967296.0);\n /* divided by 2^32 */\n };\n\n /* generates a random number on (0,1)-real-interval */\n //c//double genrand_real3(void)\n this.genrand_real3 = function () {\n //c//return ((genrand_int32()) + 0.5)*(1.0/4294967296.0);\n return (this.genrand_int32() + 0.5) * (1.0 / 4294967296.0);\n /* divided by 2^32 */\n };\n\n /* generates a random number on [0,1) with 53-bit resolution*/\n //c//double genrand_res53(void)\n this.genrand_res53 = function () {\n //c//unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;\n var a = this.genrand_int32() >>> 5,\n b = this.genrand_int32() >>> 6;\n return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0);\n };\n /* These real versions are due to Isaku Wada, 2002/01/09 added */\n}\n\n// Exports: Public API\n\n// Export the twister class\n//exports.MersenneTwister19937 = MersenneTwister19937;\nvar _default = exports[\"default\"] = MersenneTwister19937;\n\n},{}],25:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = generateTiledJSON;\nfunction generateTiledJSON(tileMap) {\n var layers = [];\n // Check if tileMap.data is a 3D array\n if (typeof tileMap.data[0][0] !== 'undefined') {\n var depth = tileMap.data.length; // Assuming the depth is the first dimension of the 3D array\n for (var z = 0; z < depth; z++) {\n layers.push({\n \"data\": tileMap.data[z].flat(),\n // Flatten the 2D array to 1D for the layer data\n \"height\": tileMap.height,\n \"id\": z + 1,\n // ID should be unique for each layer, hence z + 1\n \"name\": \"Tile Layer \".concat(z + 1),\n \"opacity\": 1,\n \"type\": \"tilelayer\",\n \"visible\": true,\n \"width\": tileMap.width,\n \"x\": 0,\n \"y\": 0,\n \"parallaxoriginy\": z / depth // Set the parallaxoriginy based on z-index\n });\n }\n } else {\n // If it's not a 3D array, just use the original layer\n layers.push({\n \"data\": tileMap.data,\n \"height\": tileMap.height,\n \"id\": 1,\n \"name\": \"Tile Layer 1\",\n \"opacity\": 1,\n \"type\": \"tilelayer\",\n \"visible\": true,\n \"width\": tileMap.width,\n \"x\": 0,\n \"y\": 0\n });\n }\n var tiledJSON = {\n \"compressionlevel\": -1,\n \"height\": tileMap.height,\n \"infinite\": false,\n \"layers\": layers,\n \"nextlayerid\": layers.length + 1,\n \"nextobjectid\": 1,\n \"orientation\": \"orthogonal\",\n \"renderorder\": \"right-down\",\n \"tiledversion\": \"1.10.2\",\n \"tileheight\": 16,\n \"tilesets\": [{\n \"columns\": 0,\n \"firstgid\": 1,\n \"grid\": {\n \"height\": 1,\n \"orientation\": \"orthogonal\",\n \"width\": 1\n },\n \"margin\": 0,\n \"name\": \"grass-land\",\n \"spacing\": 0,\n \"tilecount\": 2,\n \"tileheight\": 16,\n \"tiles\": [\n // Custom tile set mappings\n ],\n \"tilewidth\": 16\n }],\n \"tilewidth\": 16,\n \"type\": \"map\",\n \"version\": \"1.10\",\n \"width\": tileMap.width\n };\n tiledJSON.tilesets[0].tiles = [\n // TODO: custom tile set mappings\n {\n \"id\": 0,\n \"image\": \"tile-bush.png\",\n \"imageheight\": 16,\n \"imagewidth\": 16\n }, {\n \"id\": 1,\n \"image\": \"tile-grass.png\",\n \"imageheight\": 16,\n \"imagewidth\": 16\n }, {\n \"id\": 2,\n \"image\": \"tile-block.png\",\n \"imageheight\": 16,\n \"imagewidth\": 16\n }, {\n \"id\": 3,\n \"image\": \"tile-path-brown.png\",\n \"imageheight\": 16,\n \"imagewidth\": 16\n }, {\n \"id\": 4,\n \"image\": \"tile-path-green.png\",\n \"imageheight\": 16,\n \"imagewidth\": 16\n }];\n return tiledJSON;\n}\n\n/* infinite style map with chunks\n \"editorsettings\": {\n \"chunksize\": {\n \"height\": 8,\n \"width\": 8\n }\n },\n\n \"layers\": [{\n \"chunks\": [{\n \"data\": tileMap.data, // Your tileMap data\n \"height\": tileMap.height,\n \"width\": tileMap.width,\n \"x\": 0,\n \"y\": 0\n }],\n \"height\": tileMap.height,\n \"name\": \"Tile Layer 1\",\n \"opacity\": 1,\n \"startx\": 0,\n \"starty\": 0,\n \"type\": \"tilelayer\",\n \"visible\": true,\n \"width\": tileMap.width,\n \"x\": 0,\n \"y\": 0\n }],\n */\n\n},{}],26:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _MersenneTwister = _interopRequireDefault(require(\"./MersenneTwister19937.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); } // var Gen = require('../vendor/mersenne').MersenneTwister19937;\nfunction Mersenne() {\n var gen = new _MersenneTwister[\"default\"]();\n var seed = new Date().getTime() % 1000000000;\n this.currentSeed = seed;\n gen.init_genrand(seed);\n this.rand = function (max, min) {\n if (typeof max === 'undefined') {\n return gen.genrand_real2(); // Returns a floating-point number between 0 and 1\n }\n if (typeof min === 'undefined') {\n min = 0;\n }\n return Math.floor(gen.genrand_real2() * (max - min) + min);\n };\n this.seed = function (S) {\n // check incoming value of seed and coherce to number\n // try to convert seed to number, if not number, consider as string\n var _seed = Number(S);\n if (isNaN(_seed)) {\n // convert into hash\n _seed = this.stringToSeed(S);\n }\n if (typeof _seed != 'number') {\n throw new Error(\"seed(S) must take numeric argument; is \" + _typeof(S));\n }\n this.currentSeed = _seed;\n gen.init_genrand(_seed);\n };\n this.seed_array = function (A) {\n if (_typeof(A) != 'object') {\n throw new Error(\"seed_array(A) must take array of numbers; is \" + _typeof(A));\n }\n this.currentSeed = A;\n gen.init_by_array(A, A.length);\n };\n this.stringToSeed = function (str) {\n // Simple hash function to convert a string to a number\n var hash = 0;\n for (var i = 0; i < str.length; i++) {\n var _char = str.charCodeAt(i);\n hash = (hash << 5) - hash + _char;\n hash = hash & hash; // Convert to 32bit integer\n }\n return hash;\n };\n}\nvar _default = exports[\"default\"] = Mersenne;\n\n},{\"./MersenneTwister19937.js\":24}],27:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n//////////////////////////////////////////////////////////////\n// From p5.js - LGPL-2.1 license\n// https://github.com/processing/p5.js\n// https://github.com/processing/p5.js/blob/3d45ce9b130a007668bfac7768fbcdd6b8ff41ec/src/math/noise.js\n// http://mrl.nyu.edu/~perlin/noise/\n// Adapting from PApplet.java\n// which was adapted from toxi\n// which was adapted from the german demo group farbrausch\n// as used in their demo \"art\": http://www.farb-rausch.de/fr010src.zip\n\n// someday we might consider using \"improved noise\"\n// http://mrl.nyu.edu/~perlin/paper445.pdf\n// See: https://github.com/shiffman/The-Nature-of-Code-Examples-p5.js/\n// blob/main/introduction/Noise1D/noise.js\n\n/**\n * @module Math\n * @submodule Noise\n * @for p5\n * @requires core\n */\n\nvar p5 = function p5() {};\nvar PERLIN_YWRAPB = 4;\nvar PERLIN_YWRAP = 1 << PERLIN_YWRAPB;\nvar PERLIN_ZWRAPB = 8;\nvar PERLIN_ZWRAP = 1 << PERLIN_ZWRAPB;\nvar PERLIN_SIZE = 4095;\nvar perlin_octaves = 4; // default to medium smooth\nvar perlin_amp_falloff = 0.5; // 50% reduction/octave\n\nvar scaled_cosine = function scaled_cosine(i) {\n return 0.5 * (1.0 - Math.cos(i * Math.PI));\n};\nvar perlin; // will be initialized lazily by noise() or noiseSeed()\n\n/**\n * Returns random numbers that can be tuned to feel more organic. The values\n * returned will always be between 0 and 1.\n *\n * Values returned by random() and\n * randomGaussian() can change by large\n * amounts between function calls. By contrast, values returned by `noise()`\n * can be made \"smooth\". Calls to `noise()` with similar inputs will produce\n * similar outputs. `noise()` is used to create textures, motion, shapes,\n * terrains, and so on. Ken Perlin invented `noise()` while animating the\n * original Tron film in the 1980s.\n *\n * `noise()` returns the same value for a given input while a sketch is\n * running. It produces different results each time a sketch runs. The\n * noiseSeed() function can be used to generate\n * the same sequence of Perlin noise values each time a sketch runs.\n *\n * The character of the noise can be adjusted in two ways. The first way is to\n * scale the inputs. `noise()` interprets inputs as coordinates. The sequence\n * of noise values will be smoother when the input coordinates are closer. The\n * second way is to use the noiseDetail()\n * function.\n *\n * The version of `noise()` with one parameter computes noise values in one\n * dimension. This dimension can be thought of as space, as in `noise(x)`, or\n * time, as in `noise(t)`.\n *\n * The version of `noise()` with two parameters computes noise values in two\n * dimensions. These dimensions can be thought of as space, as in\n * `noise(x, y)`, or space and time, as in `noise(x, t)`.\n *\n * The version of `noise()` with three parameters computes noise values in\n * three dimensions. These dimensions can be thought of as space, as in\n * `noise(x, y, z)`, or space and time, as in `noise(x, y, t)`.\n *\n * @method noise\n * @param {Number} x x-coordinate in noise space.\n * @param {Number} [y] y-coordinate in noise space.\n * @param {Number} [z] z-coordinate in noise space.\n * @return {Number} Perlin noise value at specified coordinates.\n * @example\n *
\n * \n * function draw() {\n * background(200);\n *\n * let x = 100 * noise(0.005 * frameCount);\n * let y = 100 * noise(0.005 * frameCount + 10000);\n *\n * strokeWeight(5);\n * point(x, y);\n *\n * describe('A black dot moves randomly on a gray square.');\n * }\n * \n *
\n *\n *
\n * \n * function draw() {\n * background(200);\n *\n * let noiseLevel = 100;\n * let noiseScale = 0.005;\n * // Scale input coordinate.\n * let nt = noiseScale * frameCount;\n * // Compute noise value.\n * let x = noiseLevel * noise(nt);\n * let y = noiseLevel * noise(nt + 10000);\n * // Render.\n * strokeWeight(5);\n * point(x, y);\n *\n * describe('A black dot moves randomly on a gray square.');\n * }\n * \n *
\n *\n *
\n * \n * function draw() {\n * let noiseLevel = 100;\n * let noiseScale = 0.02;\n * // Scale input coordinate.\n * let x = frameCount;\n * let nx = noiseScale * x;\n * // Compute noise value.\n * let y = noiseLevel * noise(nx);\n * // Render.\n * line(x, 0, x, y);\n *\n * describe('A hilly terrain drawn in gray against a black sky.');\n * }\n * \n *
\n *\n *
\n * \n * function draw() {\n * background(200);\n *\n * let noiseLevel = 100;\n * let noiseScale = 0.002;\n * for (let x = 0; x < width; x += 1) {\n * // Scale input coordinates.\n * let nx = noiseScale * x;\n * let nt = noiseScale * frameCount;\n * // Compute noise value.\n * let y = noiseLevel * noise(nx, nt);\n * // Render.\n * line(x, 0, x, y);\n * }\n *\n * describe('A calm sea drawn in gray against a black sky.');\n * }\n * \n *
\n *\n *
\n * \n * let noiseLevel = 255;\n * let noiseScale = 0.01;\n * for (let y = 0; y < height; y += 1) {\n * for (let x = 0; x < width; x += 1) {\n * // Scale input coordinates.\n * let nx = noiseScale * x;\n * let ny = noiseScale * y;\n * // Compute noise value.\n * let c = noiseLevel * noise(nx, ny);\n * // Render.\n * stroke(c);\n * point(x, y);\n * }\n * }\n *\n * describe('A gray cloudy pattern.');\n * \n *
\n *\n *
\n * \n * function draw() {\n * let noiseLevel = 255;\n * let noiseScale = 0.009;\n * for (let y = 0; y < height; y += 1) {\n * for (let x = 0; x < width; x += 1) {\n * // Scale input coordinates.\n * let nx = noiseScale * x;\n * let ny = noiseScale * y;\n * let nt = noiseScale * frameCount;\n * // Compute noise value.\n * let c = noiseLevel * noise(nx, ny, nt);\n * // Render.\n * stroke(c);\n * point(x, y);\n * }\n * }\n *\n * describe('A gray cloudy pattern that changes.');\n * }\n * \n *
\n */\n\np5.prototype.noise = function () {\n var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n if (perlin == null) {\n perlin = new Array(PERLIN_SIZE + 1);\n for (var i = 0; i < PERLIN_SIZE + 1; i++) {\n perlin[i] = Math.random();\n }\n }\n if (x < 0) {\n x = -x;\n }\n if (y < 0) {\n y = -y;\n }\n if (z < 0) {\n z = -z;\n }\n var xi = Math.floor(x),\n yi = Math.floor(y),\n zi = Math.floor(z);\n var xf = x - xi;\n var yf = y - yi;\n var zf = z - zi;\n var rxf, ryf;\n var r = 0;\n var ampl = 0.5;\n var n1, n2, n3;\n for (var o = 0; o < perlin_octaves; o++) {\n var of = xi + (yi << PERLIN_YWRAPB) + (zi << PERLIN_ZWRAPB);\n rxf = scaled_cosine(xf);\n ryf = scaled_cosine(yf);\n n1 = perlin[of & PERLIN_SIZE];\n n1 += rxf * (perlin[of + 1 & PERLIN_SIZE] - n1);\n n2 = perlin[of + PERLIN_YWRAP & PERLIN_SIZE];\n n2 += rxf * (perlin[of + PERLIN_YWRAP + 1 & PERLIN_SIZE] - n2);\n n1 += ryf * (n2 - n1);\n of += PERLIN_ZWRAP;\n n2 = perlin[of & PERLIN_SIZE];\n n2 += rxf * (perlin[of + 1 & PERLIN_SIZE] - n2);\n n3 = perlin[of + PERLIN_YWRAP & PERLIN_SIZE];\n n3 += rxf * (perlin[of + PERLIN_YWRAP + 1 & PERLIN_SIZE] - n3);\n n2 += ryf * (n3 - n2);\n n1 += scaled_cosine(zf) * (n2 - n1);\n r += n1 * ampl;\n ampl *= perlin_amp_falloff;\n xi <<= 1;\n xf *= 2;\n yi <<= 1;\n yf *= 2;\n zi <<= 1;\n zf *= 2;\n if (xf >= 1.0) {\n xi++;\n xf--;\n }\n if (yf >= 1.0) {\n yi++;\n yf--;\n }\n if (zf >= 1.0) {\n zi++;\n zf--;\n }\n }\n return r;\n};\n\n/**\n * Adjusts the character of the noise produced by the\n * noise() function.\n *\n * Perlin noise values are created by adding layers of noise together. The\n * noise layers, called octaves, are similar to harmonics in music. Lower\n * octaves contribute more to the output signal. They define the overall\n * intensity of the noise. Higher octaves create finer-grained details.\n *\n * By default, noise values are created by combining four octaves. Each higher\n * octave contributes half as much (50% less) compared to its predecessor.\n * `noiseDetail()` changes the number of octaves and the falloff amount. For\n * example, calling `noiseDetail(6, 0.25)` ensures that\n * noise() will use six octaves. Each higher octave\n * will contribute 25% as much (75% less) compared to its predecessor. Falloff\n * values between 0 and 1 are valid. However, falloff values greater than 0.5\n * might result in noise values greater than 1.\n *\n * @method noiseDetail\n * @param {Number} lod number of octaves to be used by the noise.\n * @param {Number} falloff falloff factor for each octave.\n * @example\n *
\n * \n * let noiseLevel = 255;\n * let noiseScale = 0.02;\n * for (let y = 0; y < height; y += 1) {\n * for (let x = 0; x < width / 2; x += 1) {\n * // Scale input coordinates.\n * let nx = noiseScale * x;\n * let ny = noiseScale * y;\n *\n * // Compute noise value.\n * noiseDetail(6, 0.25);\n * let c = noiseLevel * noise(nx, ny);\n * // Render left side.\n * stroke(c);\n * point(x, y);\n *\n * // Compute noise value.\n * noiseDetail(4, 0.5);\n * c = noiseLevel * noise(nx, ny);\n * // Render right side.\n * stroke(c);\n * point(x + width / 2, y);\n * }\n * }\n *\n * describe('Two gray cloudy patterns. The pattern on the right is cloudier than the pattern on the left.');\n * \n *
\n */\np5.prototype.noiseDetail = function (lod, falloff) {\n if (lod > 0) {\n perlin_octaves = lod;\n }\n if (falloff > 0) {\n perlin_amp_falloff = falloff;\n }\n};\n\n/**\n * Sets the seed value for noise(). By default,\n * noise() produces different results each time\n * a sketch is run. Calling `noiseSeed()` with a constant\n * argument, such as `noiseSeed(99)`, makes noise()\n * produce the same results each time a sketch is run.\n *\n * @method noiseSeed\n * @param {Number} seed seed value.\n * @example\n *
\n * \n * function setup() {\n * noiseSeed(99);\n * background(255);\n * }\n *\n * function draw() {\n * let noiseLevel = 100;\n * let noiseScale = 0.005;\n * // Scale input coordinate.\n * let nt = noiseScale * frameCount;\n * // Compute noise value.\n * let x = noiseLevel * noise(nt);\n * // Render.\n * line(x, 0, x, height);\n *\n * describe('A black rectangle that grows randomly, first to the right and then to the left.');\n * }\n * \n *
\n */\np5.prototype.noiseSeed = function (seed) {\n // Linear Congruential Generator\n // Variant of a Lehman Generator\n var lcg = function () {\n // Set to values from http://en.wikipedia.org/wiki/Numerical_Recipes\n // m is basically chosen to be large (as it is the max period)\n // and for its relationships to a and c\n var m = 4294967296;\n // a - 1 should be divisible by m's prime factors\n var a = 1664525;\n // c and m should be co-prime\n var c = 1013904223;\n var seed, z;\n return {\n setSeed: function setSeed(val) {\n // pick a random seed if val is undefined or null\n // the >>> 0 casts the seed to an unsigned 32-bit integer\n z = seed = (val == null ? Math.random() * m : val) >>> 0;\n },\n getSeed: function getSeed() {\n return seed;\n },\n rand: function rand() {\n // define the recurrence relationship\n z = (a * z + c) % m;\n // return a float in [0, 1)\n // if z = m then z / m = 0 therefore (z % m) / m < 1 always\n return z / m;\n }\n };\n }();\n lcg.setSeed(seed);\n perlin = new Array(PERLIN_SIZE + 1);\n for (var i = 0; i < PERLIN_SIZE + 1; i++) {\n perlin[i] = lcg.rand();\n }\n};\nvar _default = exports[\"default\"] = p5;\n\n},{}]},{},[1])(1)\n});\n"],"names":["f","exports","module","define","amd","window","global","self","this","LABY","r","e","n","t","o","i","c","require","u","a","Error","code","p","call","length","1","Object","defineProperty","value","enumerable","get","_Tile","_TileMap","_labyrinthos","utils","terrains","shapes","mazes","_interopRequireDefault","obj","__esModule","default","./lib/Tile.js","./lib/TileMap.js","./lib/labyrinthos.js","2","_typeof","Symbol","iterator","constructor","prototype","_defineProperties","target","props","descriptor","configurable","writable","toPrimitive","String","Number","TypeError","key","Biome","_ref","arguments","undefined","name","tileset","_ref$distribution","distribution","instance","Constructor","protoProps","staticProps","3","LSystem","axiom","rules","generations","tileName","tile","getTileByName","id","tileId","tileMap","resultTiles","context","_this$tileset$getTile","getTile","getTileId","bind","random","max","width","height","depth","getNeighbors","x","y","getTileAt","position","Math","floor","z","split","_this","gen","data","map","applyRule","4","_createClass","Tile","5","_generateTiledJSON","_mersenne","_noise","_toConsumableArray","arr","Array","isArray","_arrayLikeToArray","iter","from","minLen","toString","slice","test","len","arr2","TileMap","_ref$x","_ref$y","_ref$width","_ref$height","_ref$depth","_ref$tileWidth","tileWidth","_ref$tileHeight","tileHeight","is3D","mersenneTwister","Noise","noise","seedNoise","noiseSeed","initializeDataArray","defaultRogueLike","seedRandom","push","init2DArray","fill3D","fill2D","rand","seed","subMap","offsetX","offsetY","targetX","targetY","tileSetRange","heightMap","apply","min","range","normalizedHeight","round","format","asciiMasks","asciiLookup","asciiMap","_asciiMap","_asciiLookup","_y","_x","biome","noiseValues","weights","tileNames","keys","totalWeight","reduce","total","weightedRanges","index","end","sum","_loop","noiseValue","selectedTileName","find","JSON","stringify","_ref2","results","queryX","queryY","subsection","_ref3","offsetZ","queryZ","getTileIdByName","filter","positions","layer","fill","./util/generateTiledJSON.js","./util/mersenne.js","./util/noise.js","6","TileSet","_ref$tiles","tiles","7","_TileSet","_Biome","_AldousBroder","_AldousBroder3D","_BinaryTree","_CellularAutomata","_EllersAlgorithm","_GrowingTree","_RecursiveBacktrack","_RecursiveDivision","_ThomasHunter","_BeattieSchoberth","_Metroidvania","_Circle","_Square","_Triangle","_LSystem","_FaultLine","_PerlinNoise","labyrinthos","AldousBroder","AldousBroder3D","BinaryTree","CellularAutomata","EllersAlgorithm","GrowingTree","RecursiveBacktrack","RecursiveDivision","BeattieSchoberth","ThomasHunter","Metroidvania","PlatformZones","Circle","Square","Triangle","FaultLine","PerlinNoise","./Biome.js","./LSystem.js","./Tile.js","./TileMap.js","./TileSet.js","./mazes/AldousBroder.js","./mazes/AldousBroder3D.js","./mazes/BeattieSchoberth.js","./mazes/BinaryTree.js","./mazes/CellularAutomata.js","./mazes/EllersAlgorithm.js","./mazes/GrowingTree.js","./mazes/Metroidvania.js","./mazes/RecursiveBacktrack.js","./mazes/RecursiveDivision.js","./mazes/ThomasHunter.js","./shapes/Circle.js","./shapes/Square.js","./shapes/Triangle.js","./terrains/FaultLine.js","./terrains/PerlinNoise.js","8","options","visitedCells","totalCells","currentX","currentY","directions","randomDirection","newX","newY","9","currentZ","newZ","10","_createForOfIteratorHelper","allowArrayLike","normalCompletion","didErr","err","it","s","step","next","done","_e2","F","_e","_classCallCheck","BeattieSchoberthBuilder","fractional","sqrt","built","rooms","special","roomHeight","roomWidth","build","flattened","world","agg","line","concat","lcv","toCharGrid","DIR","maxRooms","maxKeys","console","error","generate","reset","NULL_KEY","KEY_COLORS","0","generated","grid","result","size","row1","row2","color","roomId","room","keyInRoom","entrance","exit","padStart","doors","MAX_X","MAX_Y","bounds","w","furthest","Map","lockPool","maxDistance","addRoom","_parentRoomId","_parentRoomId3","dir","parentRoom","newRoomId","parentRoomId","_parentRoomId2","addDoor","CHILD_THRESHOLD","roomToBeLocked","getHighestDistanceRoom","setExit","_i","ascended","findRoomParentWithAtMostChildren","removeRoomAndChildrenFromLockPool","decrementChildrenCountAllParents","roomToPutKeyIn","lock","_this$squish","squish","generateGrid","classifyRooms","terminals","deadends","children","childrenCount","parent","d","_step","xShift","yShift","_iterator","stretch","further","Set","template","distance","mostNorth","mostEast","set","mostSouth","mostWest","_step2","_iterator2","childRoomId","childRoom","doorId","orientation","add","increaseChildrenCountAllParents","registerRoomDistanceLockPool","pool","collection","values","count","decrementCount","removeFromLockPool","_step3","_iterator3","child","door","location","keyId","row","addRoomToGrid","_step4","_iterator4","TILE","Grid","str","subgrid","col","max_width","max_height","chars","join","config","adventure","maxHeight","maxWidth","opt","output","rendered","buildRoom","emptyRoom","overlay","_this2","inDoorRange","half","odd","halfRange","lines","_this3","adventureBuild","renderWorld","11","dx","neighbors","randomIndex","_neighbors$randomInde","l","dy","12","wallChance","iterations","neighborThreshold","newData","wallNeighbors","nx","ny","13","sets","findSet","cells","unionSets","x1","y1","x2","y2","set1","set2","forEach","cellId","setVisited","currentSet","_x2","14","_slicedToArray","floorTileId","nextX","_cellsStack","cellsStack","cx","cy","nextY","pop","15","maxDimension","doorDiff","roomSizeHeight","roomSizeWidth","numRoomsWide","numRoomsHigh","maxCount","minCount","maxFails","gridHeight","gridWidth","minZonesPerRoom","maxZonesPerRoom","minRoomsPerMap","maxRoomsPerMap","newDoors","roomDiff","roomDiffOdds","WALL","DOOR","OPEN","DIRECTIONS","incoming","edges","platformGenerator","roomData","MAP_WIDTH","MAP_HEIGHT","MIN_ZONES_PER_ROOM","MAX_ZONES_PER_ROOM","MIN_ROOMS_PER_MAP","MAX_ROOMS_PER_MAP","NEW_DOOR_MIN_THRESHOLD","ROOM_ID_DIFF_RANDOM_DOOR_THRESHOLD","ROOM_ID_DIFF_RANDOM_DOOR_ODDS","failCount","number_of_rooms","rangedRandom","cursor","exits","zone_id","all_room_zones","number_of_zones","zones_in_this_room","zone_number","zone","open","moveCursor","_zones_in_this_room","buildWallsForZone","loc","zones","shuffle","current_zone","newZone","buildDoorBetweenZones","new_door_count","_i2","_all_room_zones","this_room_id","comparedZone","coords","abs","_i3","_DIRECTIONS","newCursor","adjacents","direction","zonePos1","zonePos2","zone1","zone2","log","array","j","tempi","tempj","16","visited","removeWall","index1","index2","stack","startX","startY","visitCell","_stack","_neighbors$Math$floor","17","addWalls","horizontal","wx","wy","px","py","18","roomNumber","rangius","ceil","Roguelike","retry","ideal","roomCount","min_width","roomMinWidth","roomMaxWidth","min_height","roomMinHeight","DEFAULT","room_min_width","room_max_width","room_min_height","room_max_height","room_ideal_count","retry_count","want_special","walls","enter","room_id","door_id","createVoid","addStarterRoom","generateRooms","addSpecialRooms","buildWalls","door_count","room_count","dimen","getRoomDimensions","max_left","ROOM_GAP","max_top","left","randomOdd","top","retries","generateRoom","slide","randomFn","x_dir","y_dir","collides","collide_room","invalid","new_room_id","addDoorBetweenRooms","tx","addWall","ry","bx","ly","existing_room_id","existing_room","new_room","smallest","area","Infinity","deadend","indexOf","splice","exit_door","enter_room_id","randomNonEdgeInRoom","enter_door","exit_room_id","room1","room2","min_raw","max_raw","19","radius","centerX","centerY","pow","20","21","22","heightIncrease","b","applyHeightToTileMap","23","scale","24","N","UPPER_MASK","LOWER_MASK","mt","mti","unsigned32","n1","addition32","n2","multiplication32","init_genrand","init_by_array","init_key","key_length","k","dbg","mag01","genrand_int32","kk","M","genrand_int31","genrand_real1","genrand_real2","genrand_real3","genrand_res53","25","layers","flat","opacity","type","visible","parallaxoriginy","tiledJSON","compressionlevel","infinite","nextlayerid","nextobjectid","renderorder","tiledversion","tileheight","tilesets","columns","firstgid","margin","spacing","tilecount","tilewidth","version","image","imageheight","imagewidth","26","_MersenneTwister","Date","getTime","currentSeed","S","_seed","isNaN","stringToSeed","seed_array","A","hash","charCodeAt","./MersenneTwister19937.js","27","p5","scaled_cosine","cos","PI","perlin","PERLIN_SIZE","perlin_octaves","perlin_amp_falloff","n3","xi","yi","zi","xf","yf","zf","ampl","of","rxf","ryf","noiseDetail","lod","falloff","m","lcg","setSeed","val","getSeed"],"mappings":"AAAA,CAAA,SAAUA,GAAuB,UAAjB,OAAOC,SAAoC,aAAhB,OAAOC,OAAsBA,OAAOD,QAAQD,EAAE,EAA0B,YAAhB,OAAOG,QAAqBA,OAAOC,IAAKD,OAAO,GAAGH,CAAC,GAAgC,aAAhB,OAAOK,OAAwBA,OAA+B,aAAhB,OAAOC,OAAwBA,OAA6B,aAAd,OAAOC,KAAsBA,KAAYC,MAAOC,KAAOT,EAAE,CAAG,EAAE,WAAqC,OAAmB,SAASU,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEf,GAAG,GAAG,CAACY,EAAEG,GAAG,CAAC,GAAG,CAACJ,EAAEI,GAAG,CAAC,IAAIC,EAAE,YAAY,OAAOC,SAASA,QAAQ,GAAG,CAACjB,GAAGgB,EAAE,OAAOA,EAAED,EAAE,CAAA,CAAE,EAAE,GAAGG,EAAE,OAAOA,EAAEH,EAAE,CAAA,CAAE,EAAgD,MAA1CI,EAAE,IAAIC,MAAM,uBAAuBL,EAAE,GAAG,GAAUM,KAAK,mBAAmBF,CAAC,CAAKG,EAAEV,EAAEG,GAAG,CAACd,QAAQ,EAAE,EAAEU,EAAEI,GAAG,GAAGQ,KAAKD,EAAErB,QAAQ,SAASS,GAAoB,OAAOI,EAAlBH,EAAEI,GAAG,GAAGL,IAAeA,CAAC,CAAC,EAAEY,EAAEA,EAAErB,QAAQS,EAAEC,EAAEC,EAAEC,CAAC,CAAC,CAAC,OAAOD,EAAEG,GAAGd,OAAO,CAAC,IAAI,IAAIiB,EAAE,YAAY,OAAOD,SAASA,Q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EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAChB,CAAC"} \ No newline at end of file diff --git a/examples/browser/labyrinthos.js b/examples/browser/labyrinthos.js index 1c3d433..2363c40 100644 --- a/examples/browser/labyrinthos.js +++ b/examples/browser/labyrinthos.js @@ -263,7 +263,7 @@ var TileMap = exports["default"] = /*#__PURE__*/function () { this.data = this.initializeDataArray(); // ASCII representations for tiles 0-10 // TODO: Is there a better default set of ASCII characters we can use? - this.defaultRogueLike = ['-', '#', '+', '0', '<', '>', '$', '#', '@', '&', '?']; + this.defaultRogueLike = ['-', '#', '+', '0', '<', '>', '$', '⌂', '@', '&', '?']; this.seedRandom(); } _createClass(TileMap, [{ @@ -585,6 +585,22 @@ function init3DArray(width, height, depth) { return arr; } +/* default roguelike `TileSet` mappings +{ + "void": 0, + "wall": 1, + "floor": 2, + "door": 3, + "special_door": 4, + "enter": 5, + "exit": 6, + "entity": 7, + "block": 8, + "bush": 9, + "grass": 10 +} +*/ + },{"./util/generateTiledJSON.js":25,"./util/mersenne.js":26,"./util/noise.js":27}],6:[function(require,module,exports){ "use strict"; @@ -1435,8 +1451,8 @@ var BeattieSchoberth = exports.BeattieSchoberth = /*#__PURE__*/function () { }(); var TILE = { VOID: 0, - FLOOR: 1, - WALL: 2, + WALL: 1, + FLOOR: 2, DOOR: 3, SPECIAL_DOOR: 4, ENTER: 5, @@ -1904,8 +1920,8 @@ var EXIT = 'exit'; var DIRECTIONS = ['n', 'e', 's', 'w']; var TILE = { VOID: 0, - FLOOR: 1, - WALL: 2, + WALL: 1, + FLOOR: 2, DOOR: 3, SPECIAL_DOOR: 4, ENTER: 5, @@ -2500,7 +2516,7 @@ function ALGORITHM_METROIDVANIA(tileMap, options) { var generator = new Metroidvania({ roomWidth: roomSizeWidth, roomHeight: roomSizeHeight, - maxFails: 8000, + maxFails: 25000, width: numRoomsWide, // Max number of zones wide height: numRoomsWide, diff --git a/package.json b/package.json index c74abb1..dfe916a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "labyrinthos", - "version": "1.1.1", + "version": "1.1.2", "description": "A JavaScript library for procedural generation of maps, mazes, and biomes, supporting various algorithms and terrain types.", "main": "./lib/labyrinthos.js", "type": "module",