names - remove 3 consonants rule

This commit is contained in:
Azgaar 2021-08-23 18:21:53 +03:00
parent f5cbb05f71
commit ad1a8cf17e
2 changed files with 1 additions and 3 deletions

View file

@ -1397,7 +1397,7 @@ function defineBiomes() {
// assign biome id to a cell // assign biome id to a cell
function getBiomeId(moisture, temperature, height) { function getBiomeId(moisture, temperature, height) {
if (height < 20) return 0; // marine biome: liquid water cells if (height < 20) return 0; // marine biome: all water cells
if (temperature < -5) return 11; // permafrost biome if (temperature < -5) return 11; // permafrost biome
if (moisture > 40 && temperature > -2 && (height < 25 || (moisture > 24 && height > 24))) return 12; // wetland biome if (moisture > 40 && temperature > -2 && (height < 25 || (moisture > 24 && height > 24))) return 12; // wetland biome

View file

@ -99,7 +99,6 @@ window.Names = (function () {
// parse word to get a final name // parse word to get a final name
const l = last(w); // last letter const l = last(w); // last letter
if (l === "'" || l === " " || l === "-") w = w.slice(0, -1); // not allow some characters at the end if (l === "'" || l === " " || l === "-") w = w.slice(0, -1); // not allow some characters at the end
const basic = !/[^\u0000-\u007f]/.test(w); // true if word has only basic characters
let name = [...w].reduce(function (r, c, i, d) { let name = [...w].reduce(function (r, c, i, d) {
if (c === d[i + 1] && !dupl.includes(c)) return r; // duplication is not allowed if (c === d[i + 1] && !dupl.includes(c)) return r; // duplication is not allowed
@ -108,7 +107,6 @@ window.Names = (function () {
if (r.slice(-1) === " ") return r + c.toUpperCase(); // capitalize letter after space if (r.slice(-1) === " ") return r + c.toUpperCase(); // capitalize letter after space
if (r.slice(-1) === "-") return r + c.toUpperCase(); // capitalize letter after hyphen if (r.slice(-1) === "-") return r + c.toUpperCase(); // capitalize letter after hyphen
if (c === "a" && d[i + 1] === "e") return r; // "ae" => "e" if (c === "a" && d[i + 1] === "e") return r; // "ae" => "e"
if (basic && i + 1 < d.length && !vowel(c) && !vowel(d[i - 1]) && !vowel(d[i + 1])) return r; // remove consonant between 2 consonants
if (i + 2 < d.length && c === d[i + 1] && c === d[i + 2]) return r; // remove three same letters in a row if (i + 2 < d.length && c === d[i + 1] && c === d[i + 2]) return r; // remove three same letters in a row
return r + c; return r + c;
}, ""); }, "");