Skip to content

Commit bd5361c

Browse files
committedFeb 1, 2024
Updates ReadMe
Rebuilds dist
1 parent 4c68d22 commit bd5361c

8 files changed

+32
-28
lines changed
 

‎ReadMe.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h3 align="center">
22

33
<a href="https://yantra.gg/labyrinthos">
4-
<img src="https://github.com/yantra-core/Labyrinthos.js/blob/master/examples/browser/labyrinthos-logo.png" width="512">
4+
<img src="https://github.com/yantra-core/Labyrinthos.js/blob/master/examples/browser/img/labyrinthos-speaks.gif" width="512">
55
</a>
66

77
</h3>

‎dist/labyrinthos.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ var TileMap = exports["default"] = /*#__PURE__*/function () {
264264
// ASCII representations for tiles 0-10
265265
// TODO: Is there a better default set of ASCII characters we can use?
266266
this.defaultRogueLike = ['-', '#', '+', '0', '<', '>', '$', '#', '@', '&', '?'];
267+
this.seedRandom();
267268
}
268269
_createClass(TileMap, [{
269270
key: "initializeDataArray",
@@ -311,7 +312,7 @@ var TileMap = exports["default"] = /*#__PURE__*/function () {
311312
key: "seed",
312313
value: function seed(value) {
313314
if (typeof value === 'undefined') {
314-
value = this.random();
315+
value = this.random(6400000000);
315316
}
316317
this.mersenneTwister.seed(value);
317318
this.seedNoise(value);
@@ -320,7 +321,7 @@ var TileMap = exports["default"] = /*#__PURE__*/function () {
320321
}, {
321322
key: "seedRandom",
322323
value: function seedRandom() {
323-
this.seed(this.random());
324+
this.seed(this.random(6400000000));
324325
}
325326
}, {
326327
key: "use",
@@ -1878,7 +1879,7 @@ function generateGrowingTreeAlgorithmMap(tileMap, options) {
18781879
Object.defineProperty(exports, "__esModule", {
18791880
value: true
18801881
});
1881-
exports["default"] = ALGORITHM_PLATFORM_ZONES;
1882+
exports["default"] = ALGORITHM_METROIDVANIA;
18821883
function _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; } } }; }
18831884
function _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); }
18841885
function _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; }
@@ -2480,7 +2481,7 @@ function initialize(width, height) {
24802481
}
24812482
return map;
24822483
}
2483-
function ALGORITHM_PLATFORM_ZONES(tileMap, options) {
2484+
function ALGORITHM_METROIDVANIA(tileMap, options) {
24842485
tileMap.fill(0); // Fill with walls
24852486
var maxDimension = Math.max(tileMap.width, tileMap.height);
24862487
if (maxDimension <= 5) {
@@ -3797,16 +3798,16 @@ function Mersenne() {
37973798
this.seed = function (S) {
37983799
// check incoming value of seed and coherce to number
37993800
// try to convert seed to number, if not number, consider as string
3800-
var seed = Number(S);
3801-
if (isNaN(seed)) {
3801+
var _seed = Number(S);
3802+
if (isNaN(_seed)) {
38023803
// convert into hash
3803-
seed = this.stringToSeed(S);
3804+
_seed = this.stringToSeed(S);
38043805
}
3805-
if (typeof seed != 'number') {
3806+
if (typeof _seed != 'number') {
38063807
throw new Error("seed(S) must take numeric argument; is " + _typeof(S));
38073808
}
3808-
this.currentSeed = seed;
3809-
gen.init_genrand(seed);
3809+
this.currentSeed = _seed;
3810+
gen.init_genrand(_seed);
38103811
};
38113812
this.seed_array = function (A) {
38123813
if (_typeof(A) != 'object') {

‎dist/labyrinthos.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/labyrinthos.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎examples/browser/demo.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ $(document).ready(function () {
131131
if (generator.includes('3D')) {
132132
continue;
133133
}
134+
if (generator.includes('PlatformZones')) {
135+
continue;
136+
}
134137
$('#generatorType').append(new Option(generator, generator));
135138
}
136139

@@ -412,7 +415,6 @@ $(document).ready(function () {
412415
updateMapDisplay(map);
413416
}
414417

415-
416418
function tryGenerate(generatorType, map) {
417419
try {
418420
generators[generatorType](map, {});
@@ -421,16 +423,16 @@ $(document).ready(function () {
421423
}
422424
updateMapDisplay(map);
423425
} catch (err) {
424-
console.log('try again');
425-
map.seed(); // new seed
426+
// console.log(err)
427+
//console.log('try again');
428+
map.seedRandom(); // new seed
426429
setTimeout(function(){
427430
tryGenerate(generatorType, map);
428431
}, 10)
429432
}
430433

431434
}
432435

433-
434436
function updateMapDisplay(map) {
435437
let mask = map.mask();
436438
if (typeof mask === 'string') {
1.22 MB
Loading

‎examples/browser/labyrinthos.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ var TileMap = exports["default"] = /*#__PURE__*/function () {
264264
// ASCII representations for tiles 0-10
265265
// TODO: Is there a better default set of ASCII characters we can use?
266266
this.defaultRogueLike = ['-', '#', '+', '0', '<', '>', '$', '#', '@', '&', '?'];
267+
this.seedRandom();
267268
}
268269
_createClass(TileMap, [{
269270
key: "initializeDataArray",
@@ -311,7 +312,7 @@ var TileMap = exports["default"] = /*#__PURE__*/function () {
311312
key: "seed",
312313
value: function seed(value) {
313314
if (typeof value === 'undefined') {
314-
value = this.random();
315+
value = this.random(6400000000);
315316
}
316317
this.mersenneTwister.seed(value);
317318
this.seedNoise(value);
@@ -320,7 +321,7 @@ var TileMap = exports["default"] = /*#__PURE__*/function () {
320321
}, {
321322
key: "seedRandom",
322323
value: function seedRandom() {
323-
this.seed(this.random());
324+
this.seed(this.random(6400000000));
324325
}
325326
}, {
326327
key: "use",
@@ -1878,7 +1879,7 @@ function generateGrowingTreeAlgorithmMap(tileMap, options) {
18781879
Object.defineProperty(exports, "__esModule", {
18791880
value: true
18801881
});
1881-
exports["default"] = ALGORITHM_PLATFORM_ZONES;
1882+
exports["default"] = ALGORITHM_METROIDVANIA;
18821883
function _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; } } }; }
18831884
function _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); }
18841885
function _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; }
@@ -2480,7 +2481,7 @@ function initialize(width, height) {
24802481
}
24812482
return map;
24822483
}
2483-
function ALGORITHM_PLATFORM_ZONES(tileMap, options) {
2484+
function ALGORITHM_METROIDVANIA(tileMap, options) {
24842485
tileMap.fill(0); // Fill with walls
24852486
var maxDimension = Math.max(tileMap.width, tileMap.height);
24862487
if (maxDimension <= 5) {
@@ -3797,16 +3798,16 @@ function Mersenne() {
37973798
this.seed = function (S) {
37983799
// check incoming value of seed and coherce to number
37993800
// try to convert seed to number, if not number, consider as string
3800-
var seed = Number(S);
3801-
if (isNaN(seed)) {
3801+
var _seed = Number(S);
3802+
if (isNaN(_seed)) {
38023803
// convert into hash
3803-
seed = this.stringToSeed(S);
3804+
_seed = this.stringToSeed(S);
38043805
}
3805-
if (typeof seed != 'number') {
3806+
if (typeof _seed != 'number') {
38063807
throw new Error("seed(S) must take numeric argument; is " + _typeof(S));
38073808
}
3808-
this.currentSeed = seed;
3809-
gen.init_genrand(seed);
3809+
this.currentSeed = _seed;
3810+
gen.init_genrand(_seed);
38103811
};
38113812
this.seed_array = function (A) {
38123813
if (_typeof(A) != 'object') {

‎examples/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ <h2>A JavaScript procedural generator for Mazes, Terrains, and Biomes</h2>
534534

535535
<iframe src="docs/index.html" style="width:100%;height:100vh;border:none;"></iframe>
536536
<a href="https://github.com/yantra-core/Labyrinthos.js">
537-
<img class="logo logoStatic" src="https://yantra.gg/labyrinthos/browser/labyrinthos-logo.png" />
537+
<img class="logo logoStatic" src="https://yantra.gg/labyrinthos/browser/img/labyrinthos-speaks.gif" />
538538
</a>
539539

540540
<style>

0 commit comments

Comments
 (0)
Please sign in to comment.