first setup map

master
Tancre 5 years ago
parent a3c6e16e0e
commit 9c9862e564

@ -0,0 +1,37 @@
Welcome to Glitch
=================
Click `Show` in the header to see your app live. Updates to your code will instantly deploy and update live.
**Glitch** is the friendly community where you'll build the app of your dreams. Glitch lets you instantly create, remix, edit, and host an app, bot or site, and you can invite collaborators or helpers to simultaneously edit code with you.
Find out more [about Glitch](https://glitch.com/about).
Your Project
------------
### ← README.md
That's this file, where you can tell people what your cool website does and how you built it.
### ← index.html
Where you'll write the content of your website.
### ← style.css
CSS files add styling rules to your content.
### ← script.js
If you're feeling fancy you can add interactivity to your site with JavaScript.
### ← assets
Drag in `assets`, like images or music, to add them to your project
Made by [Glitch](https://glitch.com/)
-------------------
\ ゜o゜)

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hello!</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- import the webpage's stylesheet -->
<link rel="stylesheet" href="/style.css">
<!-- import the webpage's javascript file -->
<script src="script.js" defer></script>
<script src="https://d3js.org/d3.v5.js"></script>
<script src="priority-queue.js"></script>
<script src="language.js"></script>
<script src="terrain.js"></script>
<style>
path, line {
fill: none;
stroke: black;
stroke-linecap: round;
}
.field {
stroke: none;
fill-opacity: 1.0;
}
.slope {
stroke-width: 1;
}
.river {
stroke-width: 2;
}
.coast {
stroke-width: 4;
}
.border {
stroke-width: 5;
stroke-dasharray: 4,4;
stroke-linecap: butt;
}
text {
font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
color: black;
stroke: white;
stroke-width: 5;
stroke-linejoin: round;
paint-order: stroke;
}
text.region {
stroke-width:10;
font-variant: small-caps;
}
svg {
float: right;
background-color: white;
}
</style>
</head>
<body>
<svg width="1000" height="1000"></svg>
</body>
</html>

@ -0,0 +1,486 @@
function shuffled(list) {
var newlist = [];
for (var i = 0; i < list.length; i++) {
newlist.push(list[i]);
}
for (var i = list.length - 1; i > 0; i--) {
var tmp = newlist[i];
var j = randrange(i);
newlist[i] = newlist[j];
newlist[j] = tmp;
}
return newlist;
}
function choose(list, exponent) {
exponent = exponent || 1;
return list[Math.floor(Math.pow(Math.random(), exponent) * list.length)];
}
function randrange(lo, hi) {
if (hi == undefined) {
hi = lo;
lo = 0;
}
return Math.floor(Math.random() * (hi - lo)) + lo;
}
function join(list, sep) {
if (list.length == 0) return '';
sep = sep || '';
var s = list[0];
for (var i = 1; i < list.length; i++) {
s += sep;
s += list[i];
}
return s;
}
function capitalize(word) {
return word[0].toUpperCase() + word.slice(1);
}
function spell(lang, syll) {
if (lang.noortho) return syll;
var s = '';
for (var i = 0; i < syll.length; i++) {
var c = syll[i];
s += lang.cortho[c] || lang.vortho[c] || defaultOrtho[c] || c;
}
return s;
}
function makeSyllable(lang) {
while (true) {
var syll = "";
for (var i = 0; i < lang.structure.length; i++) {
var ptype = lang.structure[i];
if (lang.structure[i+1] == '?') {
i++;
if (Math.random() < 0.5) {
continue;
}
}
syll += choose(lang.phonemes[ptype], lang.exponent);
}
var bad = false;
for (var i = 0; i < lang.restricts.length; i++) {
if (lang.restricts[i].test(syll)) {
bad = true;
break;
}
}
if (bad) continue;
return spell(lang, syll);
}
}
function getMorpheme(lang, key) {
if (lang.nomorph) {
return makeSyllable(lang);
}
key = key || '';
var list = lang.morphemes[key] || [];
var extras = 10;
if (key) extras = 1;
while (true) {
var n = randrange(list.length + extras);
if (list[n]) return list[n];
var morph = makeSyllable(lang);
var bad = false;
for (var k in lang.morphemes) {
if (lang.morphemes[k].includes(morph)) {
bad = true;
break;
}
}
if (bad) continue;
list.push(morph);
lang.morphemes[key] = list;
return morph;
}
}
function makeWord(lang, key) {
var nsylls = randrange(lang.minsyll, lang.maxsyll + 1);
var w = '';
var keys = [];
keys[randrange(nsylls)] = key;
for (var i = 0; i < nsylls; i++) {
w += getMorpheme(lang, keys[i]);
}
return w;
}
function getWord(lang, key) {
key = key || '';
var ws = lang.words[key] || [];
var extras = 3;
if (key) extras = 2;
while (true) {
var n = randrange(ws.length + extras);
var w = ws[n];
if (w) {
return w;
}
w = makeWord(lang, key);
var bad = false;
for (var k in lang.words) {
if (lang.words[k].includes(w)) {
bad = true;
break;
}
}
if (bad) continue;
ws.push(w);
lang.words[key] = ws;
return w;
}
}
function makeName(lang, key) {
key = key || '';
lang.genitive = lang.genitive || getMorpheme(lang, 'of');
lang.definite = lang.definite || getMorpheme(lang, 'the');
while (true) {
var name = null;
if (Math.random() < 0.5) {
name = capitalize(getWord(lang, key));
} else {
var w1 = capitalize(getWord(lang, Math.random() < 0.6 ? key : ''));
var w2 = capitalize(getWord(lang, Math.random() < 0.6 ? key : ''));
if (w1 == w2) continue;
if (Math.random() > 0.5) {
name = join([w1, w2], lang.joiner);
} else {
name = join([w1, lang.genitive, w2], lang.joiner);
}
}
if (Math.random() < 0.1) {
name = join([lang.definite, name], lang.joiner);
}
if ((name.length < lang.minchar) || (name.length > lang.maxchar)) continue;
var used = false;
for (var i = 0; i < lang.names.length; i++) {
var name2 = lang.names[i];
if ((name.indexOf(name2) != -1) || (name2.indexOf(name) != -1)) {
used = true;
break;
}
}
if (used) continue;
lang.names.push(name);
return name;
}
}
function makeBasicLanguage() {
return {
phonemes: {
C: "ptkmnls",
V: "aeiou",
S: "s",
F: "mn",
L: "rl"
},
structure: "CVC",
exponent: 2,
restricts: [],
cortho: {},
vortho: {},
noortho: true,
nomorph: true,
nowordpool: true,
minsyll: 1,
maxsyll: 1,
morphemes: {},
words: {},
names: [],
joiner: ' ',
maxchar: 12,
minchar: 5
};
}
function makeOrthoLanguage() {
var lang = makeBasicLanguage();
lang.noortho = false;
return lang;
}
function makeRandomLanguage() {
var lang = makeBasicLanguage();
lang.noortho = false;
lang.nomorph = false;
lang.nowordpool = false;
lang.phonemes.C = shuffled(choose(consets, 2).C);
lang.phonemes.V = shuffled(choose(vowsets, 2).V);
lang.phonemes.L = shuffled(choose(lsets, 2).L);
lang.phonemes.S = shuffled(choose(ssets, 2).S);
lang.phonemes.F = shuffled(choose(fsets, 2).F);
lang.structure = choose(syllstructs);
lang.restricts = ressets[2].res;
lang.cortho = choose(corthsets, 2).orth;
lang.vortho = choose(vorthsets, 2).orth;
lang.minsyll = randrange(1, 3);
if (lang.structure.length < 3) lang.minsyll++;
lang.maxsyll = randrange(lang.minsyll + 1, 7);
lang.joiner = choose(' -');
return lang;
}
var defaultOrtho = {
'ʃ': 'sh',
'ʒ': 'zh',
'ʧ': 'ch',
'ʤ': 'j',
'ŋ': 'ng',
'j': 'y',
'x': 'kh',
'ɣ': 'gh',
'ʔ': '',
A: "á",
E: "é",
I: "í",
O: "ó",
U: "ú"
};
var corthsets = [
{
name: "Default",
orth: {}
},
{
name: "Slavic",
orth: {
'ʃ': 'š',
'ʒ': 'ž',
'ʧ': 'č',
'ʤ': 'ǧ',
'j': 'j'
}
},
{
name: "German",
orth: {
'ʃ': 'sch',
'ʒ': 'zh',
'ʧ': 'tsch',
'ʤ': 'dz',
'j': 'j',
'x': 'ch'
}
},
{
name: "French",
orth: {
'ʃ': 'ch',
'ʒ': 'j',
'ʧ': 'tch',
'ʤ': 'dj',
'x': 'kh'
}
},
{
name: "Chinese (pinyin)",
orth: {
'ʃ': 'x',
'ʧ': 'q',
'ʤ': 'j',
}
}
];
var vorthsets = [
{
name: "Ácutes",
orth: {}
},
{
name: "Ümlauts",
orth: {
A: "ä",
E: "ë",
I: "ï",
O: "ö",
U: "ü"
}
},
{
name: "Welsh",
orth: {
A: "â",
E: "ê",
I: "y",
O: "ô",
U: "w"
}
},
{
name: "Diphthongs",
orth: {
A: "au",
E: "ei",
I: "ie",
O: "ou",
U: "oo"
}
},
{
name: "Doubles",
orth: {
A: "aa",
E: "ee",
I: "ii",
O: "oo",
U: "uu"
}
}
];
var consets = [
{
name: "Minimal",
C: "ptkmnls"
},
{
name: "English-ish",
C: "ptkbdgmnlrsʃzʒʧ"
},
{
name: "Pirahã (very simple)",
C: "ptkmnh"
},
{
name: "Hawaiian-ish",
C: "hklmnpwʔ"
},
{
name: "Greenlandic-ish",
C: "ptkqvsgrmnŋlj"
},
{
name: "Arabic-ish",
C: "tksʃdbqɣxmnlrwj"
},
{
name: "Arabic-lite",
C: "tkdgmnsʃ"
},
{
name: "English-lite",
C: "ptkbdgmnszʒʧhjw"
}
];
var ssets = [
{
name: "Just s",
S: "s"
},
{
name: "s ʃ",
S: "sʃ"
},
{
name: "s ʃ f",
S: "sʃf"
}
];
var lsets = [
{
name: "r l",
L: "rl"
},
{
name: "Just r",
L: "r"
},
{
name: "Just l",
L: "l"
},
{
name: "w j",
L: "wj"
},
{
name: "r l w j",
L: "rlwj"
}
];
var fsets = [
{
name: "m n",
F: "mn"
},
{
name: "s k",
F: "sk"
},
{
name: "m n ŋ",
F: "mnŋ"
},
{
name: "s ʃ z ʒ",
F: "sʃzʒ"
}
];
var vowsets = [
{
name: "Standard 5-vowel",
V: "aeiou"
},
{
name: "3-vowel a i u",
V: "aiu"
},
{
name: "Extra A E I",
V: "aeiouAEI"
},
{
name: "Extra U",
V: "aeiouU"
},
{
name: "5-vowel a i u A I",
V: "aiuAI"
},
{
name: "3-vowel e o u",
V: "eou"
},
{
name: "Extra A O U",
V: "aeiouAOU"
}
];
var syllstructs = [
"CVC",
"CVV?C",
"CVVC?", "CVC?", "CV", "VC", "CVF", "C?VC", "CVF?",
"CL?VC", "CL?VF", "S?CVC", "S?CVF", "S?CVC?",
"C?VF", "C?VC?", "C?VF?", "C?L?VC", "VC",
"CVL?C?", "C?VL?C", "C?VLC?"];
var ressets = [
{
name: "None",
res: []
},
{
name: "Double sounds",
res: [/(.)\1/]
},
{
name: "Doubles and hard clusters",
res: [/[sʃf][sʃ]/, /(.)\1/, /[rl][rl]/]
}
];

@ -0,0 +1,387 @@
(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.PriorityQueue = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
var AbstractPriorityQueue, ArrayStrategy, BHeapStrategy, BinaryHeapStrategy, PriorityQueue,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
AbstractPriorityQueue = _dereq_('./PriorityQueue/AbstractPriorityQueue');
ArrayStrategy = _dereq_('./PriorityQueue/ArrayStrategy');
BinaryHeapStrategy = _dereq_('./PriorityQueue/BinaryHeapStrategy');
BHeapStrategy = _dereq_('./PriorityQueue/BHeapStrategy');
PriorityQueue = (function(superClass) {
extend(PriorityQueue, superClass);
function PriorityQueue(options) {
options || (options = {});
options.strategy || (options.strategy = BinaryHeapStrategy);
options.comparator || (options.comparator = function(a, b) {
return (a || 0) - (b || 0);
});
PriorityQueue.__super__.constructor.call(this, options);
}
return PriorityQueue;
})(AbstractPriorityQueue);
PriorityQueue.ArrayStrategy = ArrayStrategy;
PriorityQueue.BinaryHeapStrategy = BinaryHeapStrategy;
PriorityQueue.BHeapStrategy = BHeapStrategy;
module.exports = PriorityQueue;
},{"./PriorityQueue/AbstractPriorityQueue":2,"./PriorityQueue/ArrayStrategy":3,"./PriorityQueue/BHeapStrategy":4,"./PriorityQueue/BinaryHeapStrategy":5}],2:[function(_dereq_,module,exports){
var AbstractPriorityQueue;
module.exports = AbstractPriorityQueue = (function() {
function AbstractPriorityQueue(options) {
var ref;
if ((options != null ? options.strategy : void 0) == null) {
throw 'Must pass options.strategy, a strategy';
}
if ((options != null ? options.comparator : void 0) == null) {
throw 'Must pass options.comparator, a comparator';
}
this.priv = new options.strategy(options);
this.length = (options != null ? (ref = options.initialValues) != null ? ref.length : void 0 : void 0) || 0;
}
AbstractPriorityQueue.prototype.queue = function(value) {
this.length++;
this.priv.queue(value);
return void 0;
};
AbstractPriorityQueue.prototype.dequeue = function(value) {
if (!this.length) {
throw 'Empty queue';
}
this.length--;
return this.priv.dequeue();
};
AbstractPriorityQueue.prototype.peek = function(value) {
if (!this.length) {
throw 'Empty queue';
}
return this.priv.peek();
};
AbstractPriorityQueue.prototype.clear = function() {
this.length = 0;
return this.priv.clear();
};
return AbstractPriorityQueue;
})();
},{}],3:[function(_dereq_,module,exports){
var ArrayStrategy, binarySearchForIndexReversed;
binarySearchForIndexReversed = function(array, value, comparator) {
var high, low, mid;
low = 0;
high = array.length;
while (low < high) {
mid = (low + high) >>> 1;
if (comparator(array[mid], value) >= 0) {
low = mid + 1;
} else {
high = mid;
}
}
return low;
};
module.exports = ArrayStrategy = (function() {
function ArrayStrategy(options) {
var ref;
this.options = options;
this.comparator = this.options.comparator;
this.data = ((ref = this.options.initialValues) != null ? ref.slice(0) : void 0) || [];
this.data.sort(this.comparator).reverse();
}
ArrayStrategy.prototype.queue = function(value) {
var pos;
pos = binarySearchForIndexReversed(this.data, value, this.comparator);
this.data.splice(pos, 0, value);
return void 0;
};
ArrayStrategy.prototype.dequeue = function() {
return this.data.pop();
};
ArrayStrategy.prototype.peek = function() {
return this.data[this.data.length - 1];
};
ArrayStrategy.prototype.clear = function() {
this.data.length = 0;
return void 0;
};
return ArrayStrategy;
})();
},{}],4:[function(_dereq_,module,exports){
var BHeapStrategy;
module.exports = BHeapStrategy = (function() {
function BHeapStrategy(options) {
var arr, i, j, k, len, ref, ref1, shift, value;
this.comparator = (options != null ? options.comparator : void 0) || function(a, b) {
return a - b;
};
this.pageSize = (options != null ? options.pageSize : void 0) || 512;
this.length = 0;
shift = 0;
while ((1 << shift) < this.pageSize) {
shift += 1;
}
if (1 << shift !== this.pageSize) {
throw 'pageSize must be a power of two';
}
this._shift = shift;
this._emptyMemoryPageTemplate = arr = [];
for (i = j = 0, ref = this.pageSize; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
arr.push(null);
}
this._memory = [];
this._mask = this.pageSize - 1;
if (options.initialValues) {
ref1 = options.initialValues;
for (k = 0, len = ref1.length; k < len; k++) {
value = ref1[k];
this.queue(value);
}
}
}
BHeapStrategy.prototype.queue = function(value) {
this.length += 1;
this._write(this.length, value);
this._bubbleUp(this.length, value);
return void 0;
};
BHeapStrategy.prototype.dequeue = function() {
var ret, val;
ret = this._read(1);
val = this._read(this.length);
this.length -= 1;
if (this.length > 0) {
this._write(1, val);
this._bubbleDown(1, val);
}
return ret;
};
BHeapStrategy.prototype.peek = function() {
return this._read(1);
};
BHeapStrategy.prototype.clear = function() {
this.length = 0;
this._memory.length = 0;
return void 0;
};
BHeapStrategy.prototype._write = function(index, value) {
var page;
page = index >> this._shift;
while (page >= this._memory.length) {
this._memory.push(this._emptyMemoryPageTemplate.slice(0));
}
return this._memory[page][index & this._mask] = value;
};
BHeapStrategy.prototype._read = function(index) {
return this._memory[index >> this._shift][index & this._mask];
};
BHeapStrategy.prototype._bubbleUp = function(index, value) {
var compare, indexInPage, parentIndex, parentValue;
compare = this.comparator;
while (index > 1) {
indexInPage = index & this._mask;
if (index < this.pageSize || indexInPage > 3) {
parentIndex = (index & ~this._mask) | (indexInPage >> 1);
} else if (indexInPage < 2) {
parentIndex = (index - this.pageSize) >> this._shift;
parentIndex += parentIndex & ~(this._mask >> 1);
parentIndex |= this.pageSize >> 1;
} else {
parentIndex = index - 2;
}
parentValue = this._read(parentIndex);
if (compare(parentValue, value) < 0) {
break;
}
this._write(parentIndex, value);
this._write(index, parentValue);
index = parentIndex;
}
return void 0;
};
BHeapStrategy.prototype._bubbleDown = function(index, value) {
var childIndex1, childIndex2, childValue1, childValue2, compare;
compare = this.comparator;
while (index < this.length) {
if (index > this._mask && !(index & (this._mask - 1))) {
childIndex1 = childIndex2 = index + 2;
} else if (index & (this.pageSize >> 1)) {
childIndex1 = (index & ~this._mask) >> 1;
childIndex1 |= index & (this._mask >> 1);
childIndex1 = (childIndex1 + 1) << this._shift;
childIndex2 = childIndex1 + 1;
} else {
childIndex1 = index + (index & this._mask);
childIndex2 = childIndex1 + 1;
}
if (childIndex1 !== childIndex2 && childIndex2 <= this.length) {
childValue1 = this._read(childIndex1);
childValue2 = this._read(childIndex2);
if (compare(childValue1, value) < 0 && compare(childValue1, childValue2) <= 0) {
this._write(childIndex1, value);
this._write(index, childValue1);
index = childIndex1;
} else if (compare(childValue2, value) < 0) {
this._write(childIndex2, value);
this._write(index, childValue2);
index = childIndex2;
} else {
break;
}
} else if (childIndex1 <= this.length) {
childValue1 = this._read(childIndex1);
if (compare(childValue1, value) < 0) {
this._write(childIndex1, value);
this._write(index, childValue1);
index = childIndex1;
} else {
break;
}
} else {
break;
}
}
return void 0;
};
return BHeapStrategy;
})();
},{}],5:[function(_dereq_,module,exports){
var BinaryHeapStrategy;
module.exports = BinaryHeapStrategy = (function() {
function BinaryHeapStrategy(options) {
var ref;
this.comparator = (options != null ? options.comparator : void 0) || function(a, b) {
return a - b;
};
this.length = 0;
this.data = ((ref = options.initialValues) != null ? ref.slice(0) : void 0) || [];
this._heapify();
}
BinaryHeapStrategy.prototype._heapify = function() {
var i, j, ref;
if (this.data.length > 0) {
for (i = j = 1, ref = this.data.length; 1 <= ref ? j < ref : j > ref; i = 1 <= ref ? ++j : --j) {
this._bubbleUp(i);
}
}
return void 0;
};
BinaryHeapStrategy.prototype.queue = function(value) {
this.data.push(value);
this._bubbleUp(this.data.length - 1);
return void 0;
};
BinaryHeapStrategy.prototype.dequeue = function() {
var last, ret;
ret = this.data[0];
last = this.data.pop();
if (this.data.length > 0) {
this.data[0] = last;
this._bubbleDown(0);
}
return ret;
};
BinaryHeapStrategy.prototype.peek = function() {
return this.data[0];
};
BinaryHeapStrategy.prototype.clear = function() {
this.length = 0;
this.data.length = 0;
return void 0;
};
BinaryHeapStrategy.prototype._bubbleUp = function(pos) {
var parent, x;
while (pos > 0) {
parent = (pos - 1) >>> 1;
if (this.comparator(this.data[pos], this.data[parent]) < 0) {
x = this.data[parent];
this.data[parent] = this.data[pos];
this.data[pos] = x;
pos = parent;
} else {
break;
}
}
return void 0;
};
BinaryHeapStrategy.prototype._bubbleDown = function(pos) {
var last, left, minIndex, right, x;
last = this.data.length - 1;
while (true) {
left = (pos << 1) + 1;
right = left + 1;
minIndex = pos;
if (left <= last && this.comparator(this.data[left], this.data[minIndex]) < 0) {
minIndex = left;
}
if (right <= last && this.comparator(this.data[right], this.data[minIndex]) < 0) {
minIndex = right;
}
if (minIndex !== pos) {
x = this.data[minIndex];
this.data[minIndex] = this.data[pos];
this.data[pos] = x;
pos = minIndex;
} else {
break;
}
}
return void 0;
};
return BinaryHeapStrategy;
})();
},{}]},{},[1])(1)
});

@ -0,0 +1,21 @@
/* If you're feeling fancy you can add interactivity
to your site with Javascript */
// prints "hi" in the browser's dev tools console
console.log("hi");
var svg = d3.select("svg");
var params = {
extent: defaultExtent,
generator: generateCoast,
npts: 1684,
ncities: 15,
nterrs: 5,
fontsizes: {
region: 40,
city: 25,
town: 20
}
}
doMap(svg, defaultParams);

@ -0,0 +1,11 @@
/* CSS files add styling rules to your content */
body {
font-family: helvetica, arial, sans-serif;
margin: 2em;
}
h1 {
font-style: italic;
color: #373fff;
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

18525
main/map2_files/d3.js vendored

File diff suppressed because it is too large Load Diff

@ -0,0 +1,486 @@
function shuffled(list) {
var newlist = [];
for (var i = 0; i < list.length; i++) {
newlist.push(list[i]);
}
for (var i = list.length - 1; i > 0; i--) {
var tmp = newlist[i];
var j = randrange(i);
newlist[i] = newlist[j];
newlist[j] = tmp;
}
return newlist;
}
function choose(list, exponent) {
exponent = exponent || 1;
return list[Math.floor(Math.pow(Math.random(), exponent) * list.length)];
}
function randrange(lo, hi) {
if (hi == undefined) {
hi = lo;
lo = 0;
}
return Math.floor(Math.random() * (hi - lo)) + lo;
}
function join(list, sep) {
if (list.length == 0) return '';
sep = sep || '';
var s = list[0];
for (var i = 1; i < list.length; i++) {
s += sep;
s += list[i];
}
return s;
}
function capitalize(word) {
return word[0].toUpperCase() + word.slice(1);
}
function spell(lang, syll) {
if (lang.noortho) return syll;
var s = '';
for (var i = 0; i < syll.length; i++) {
var c = syll[i];
s += lang.cortho[c] || lang.vortho[c] || defaultOrtho[c] || c;
}
return s;
}
function makeSyllable(lang) {
while (true) {
var syll = "";
for (var i = 0; i < lang.structure.length; i++) {
var ptype = lang.structure[i];
if (lang.structure[i+1] == '?') {
i++;
if (Math.random() < 0.5) {
continue;
}
}
syll += choose(lang.phonemes[ptype], lang.exponent);
}
var bad = false;
for (var i = 0; i < lang.restricts.length; i++) {
if (lang.restricts[i].test(syll)) {
bad = true;
break;
}
}
if (bad) continue;
return spell(lang, syll);
}
}
function getMorpheme(lang, key) {
if (lang.nomorph) {
return makeSyllable(lang);
}
key = key || '';
var list = lang.morphemes[key] || [];
var extras = 10;
if (key) extras = 1;
while (true) {
var n = randrange(list.length + extras);
if (list[n]) return list[n];
var morph = makeSyllable(lang);
var bad = false;
for (var k in lang.morphemes) {
if (lang.morphemes[k].includes(morph)) {
bad = true;
break;
}
}
if (bad) continue;
list.push(morph);
lang.morphemes[key] = list;
return morph;
}
}
function makeWord(lang, key) {
var nsylls = randrange(lang.minsyll, lang.maxsyll + 1);
var w = '';
var keys = [];
keys[randrange(nsylls)] = key;
for (var i = 0; i < nsylls; i++) {
w += getMorpheme(lang, keys[i]);
}
return w;
}
function getWord(lang, key) {
key = key || '';
var ws = lang.words[key] || [];
var extras = 3;
if (key) extras = 2;
while (true) {
var n = randrange(ws.length + extras);
var w = ws[n];
if (w) {
return w;
}
w = makeWord(lang, key);
var bad = false;
for (var k in lang.words) {
if (lang.words[k].includes(w)) {
bad = true;
break;
}
}
if (bad) continue;
ws.push(w);
lang.words[key] = ws;
return w;
}
}
function makeName(lang, key) {
key = key || '';
lang.genitive = lang.genitive || getMorpheme(lang, 'of');
lang.definite = lang.definite || getMorpheme(lang, 'the');
while (true) {
var name = null;
if (Math.random() < 0.5) {
name = capitalize(getWord(lang, key));
} else {
var w1 = capitalize(getWord(lang, Math.random() < 0.6 ? key : ''));
var w2 = capitalize(getWord(lang, Math.random() < 0.6 ? key : ''));
if (w1 == w2) continue;
if (Math.random() > 0.5) {
name = join([w1, w2], lang.joiner);
} else {
name = join([w1, lang.genitive, w2], lang.joiner);
}
}
if (Math.random() < 0.1) {
name = join([lang.definite, name], lang.joiner);
}
if ((name.length < lang.minchar) || (name.length > lang.maxchar)) continue;
var used = false;
for (var i = 0; i < lang.names.length; i++) {
var name2 = lang.names[i];
if ((name.indexOf(name2) != -1) || (name2.indexOf(name) != -1)) {
used = true;
break;
}
}
if (used) continue;
lang.names.push(name);
return name;
}
}
function makeBasicLanguage() {
return {
phonemes: {
C: "ptkmnls",
V: "aeiou",
S: "s",
F: "mn",
L: "rl"
},
structure: "CVC",
exponent: 2,
restricts: [],
cortho: {},
vortho: {},
noortho: true,
nomorph: true,
nowordpool: true,
minsyll: 1,
maxsyll: 1,
morphemes: {},
words: {},
names: [],
joiner: ' ',
maxchar: 12,
minchar: 5
};
}
function makeOrthoLanguage() {
var lang = makeBasicLanguage();
lang.noortho = false;
return lang;
}
function makeRandomLanguage() {
var lang = makeBasicLanguage();
lang.noortho = false;
lang.nomorph = false;
lang.nowordpool = false;
lang.phonemes.C = shuffled(choose(consets, 2).C);
lang.phonemes.V = shuffled(choose(vowsets, 2).V);
lang.phonemes.L = shuffled(choose(lsets, 2).L);
lang.phonemes.S = shuffled(choose(ssets, 2).S);
lang.phonemes.F = shuffled(choose(fsets, 2).F);
lang.structure = choose(syllstructs);
lang.restricts = ressets[2].res;
lang.cortho = choose(corthsets, 2).orth;
lang.vortho = choose(vorthsets, 2).orth;
lang.minsyll = randrange(1, 3);
if (lang.structure.length < 3) lang.minsyll++;
lang.maxsyll = randrange(lang.minsyll + 1, 7);
lang.joiner = choose(' -');
return lang;
}
var defaultOrtho = {
'ʃ': 'sh',
'ʒ': 'zh',
'ʧ': 'ch',
'ʤ': 'j',
'ŋ': 'ng',
'j': 'y',
'x': 'kh',
'ɣ': 'gh',
'ʔ': '',
A: "á",
E: "é",
I: "í",
O: "ó",
U: "ú"
};
var corthsets = [
{
name: "Default",
orth: {}
},
{
name: "Slavic",
orth: {
'ʃ': 'š',
'ʒ': 'ž',
'ʧ': 'č',
'ʤ': 'ǧ',
'j': 'j'
}
},
{
name: "German",
orth: {
'ʃ': 'sch',
'ʒ': 'zh',
'ʧ': 'tsch',
'ʤ': 'dz',
'j': 'j',
'x': 'ch'
}
},
{
name: "French",
orth: {
'ʃ': 'ch',
'ʒ': 'j',
'ʧ': 'tch',
'ʤ': 'dj',
'x': 'kh'
}
},
{
name: "Chinese (pinyin)",
orth: {
'ʃ': 'x',
'ʧ': 'q',
'ʤ': 'j',
}
}
];
var vorthsets = [
{
name: "Ácutes",
orth: {}
},
{
name: "Ümlauts",
orth: {
A: "ä",
E: "ë",
I: "ï",
O: "ö",
U: "ü"
}
},
{
name: "Welsh",
orth: {
A: "â",
E: "ê",
I: "y",
O: "ô",
U: "w"
}
},
{
name: "Diphthongs",
orth: {
A: "au",
E: "ei",
I: "ie",
O: "ou",
U: "oo"
}
},
{
name: "Doubles",
orth: {
A: "aa",
E: "ee",
I: "ii",
O: "oo",
U: "uu"
}
}
];
var consets = [
{
name: "Minimal",
C: "ptkmnls"
},
{
name: "English-ish",
C: "ptkbdgmnlrsʃzʒʧ"
},
{
name: "Pirahã (very simple)",
C: "ptkmnh"
},
{
name: "Hawaiian-ish",
C: "hklmnpwʔ"
},
{
name: "Greenlandic-ish",
C: "ptkqvsgrmnŋlj"
},
{
name: "Arabic-ish",
C: "tksʃdbqɣxmnlrwj"
},
{
name: "Arabic-lite",
C: "tkdgmnsʃ"
},
{
name: "English-lite",
C: "ptkbdgmnszʒʧhjw"
}
];
var ssets = [
{
name: "Just s",
S: "s"
},
{
name: "s ʃ",
S: "sʃ"
},
{
name: "s ʃ f",
S: "sʃf"
}
];
var lsets = [
{
name: "r l",
L: "rl"
},
{
name: "Just r",
L: "r"
},
{
name: "Just l",
L: "l"
},
{
name: "w j",
L: "wj"
},
{
name: "r l w j",
L: "rlwj"
}
];
var fsets = [
{
name: "m n",
F: "mn"
},
{
name: "s k",
F: "sk"
},
{
name: "m n ŋ",
F: "mnŋ"
},
{
name: "s ʃ z ʒ",
F: "sʃzʒ"
}
];
var vowsets = [
{
name: "Standard 5-vowel",
V: "aeiou"
},
{
name: "3-vowel a i u",
V: "aiu"
},
{
name: "Extra A E I",
V: "aeiouAEI"
},
{
name: "Extra U",
V: "aeiouU"
},
{
name: "5-vowel a i u A I",
V: "aiuAI"
},
{
name: "3-vowel e o u",
V: "eou"
},
{
name: "Extra A O U",
V: "aeiouAOU"
}
];
var syllstructs = [
"CVC",
"CVV?C",
"CVVC?", "CVC?", "CV", "VC", "CVF", "C?VC", "CVF?",
"CL?VC", "CL?VF", "S?CVC", "S?CVF", "S?CVC?",
"C?VF", "C?VC?", "C?VF?", "C?L?VC", "VC",
"CVL?C?", "C?VL?C", "C?VLC?"];
var ressets = [
{
name: "None",
res: []
},
{
name: "Double sounds",
res: [/(.)\1/]
},
{
name: "Doubles and hard clusters",
res: [/[sʃf][sʃ]/, /(.)\1/, /[rl][rl]/]
}
];

@ -0,0 +1,387 @@
(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.PriorityQueue = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
var AbstractPriorityQueue, ArrayStrategy, BHeapStrategy, BinaryHeapStrategy, PriorityQueue,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
AbstractPriorityQueue = _dereq_('./PriorityQueue/AbstractPriorityQueue');
ArrayStrategy = _dereq_('./PriorityQueue/ArrayStrategy');
BinaryHeapStrategy = _dereq_('./PriorityQueue/BinaryHeapStrategy');
BHeapStrategy = _dereq_('./PriorityQueue/BHeapStrategy');
PriorityQueue = (function(superClass) {
extend(PriorityQueue, superClass);
function PriorityQueue(options) {
options || (options = {});
options.strategy || (options.strategy = BinaryHeapStrategy);
options.comparator || (options.comparator = function(a, b) {
return (a || 0) - (b || 0);
});
PriorityQueue.__super__.constructor.call(this, options);
}
return PriorityQueue;
})(AbstractPriorityQueue);
PriorityQueue.ArrayStrategy = ArrayStrategy;
PriorityQueue.BinaryHeapStrategy = BinaryHeapStrategy;
PriorityQueue.BHeapStrategy = BHeapStrategy;
module.exports = PriorityQueue;
},{"./PriorityQueue/AbstractPriorityQueue":2,"./PriorityQueue/ArrayStrategy":3,"./PriorityQueue/BHeapStrategy":4,"./PriorityQueue/BinaryHeapStrategy":5}],2:[function(_dereq_,module,exports){
var AbstractPriorityQueue;
module.exports = AbstractPriorityQueue = (function() {
function AbstractPriorityQueue(options) {
var ref;
if ((options != null ? options.strategy : void 0) == null) {
throw 'Must pass options.strategy, a strategy';
}
if ((options != null ? options.comparator : void 0) == null) {
throw 'Must pass options.comparator, a comparator';
}
this.priv = new options.strategy(options);
this.length = (options != null ? (ref = options.initialValues) != null ? ref.length : void 0 : void 0) || 0;
}
AbstractPriorityQueue.prototype.queue = function(value) {
this.length++;
this.priv.queue(value);
return void 0;
};
AbstractPriorityQueue.prototype.dequeue = function(value) {
if (!this.length) {
throw 'Empty queue';
}
this.length--;
return this.priv.dequeue();
};
AbstractPriorityQueue.prototype.peek = function(value) {
if (!this.length) {
throw 'Empty queue';
}
return this.priv.peek();
};
AbstractPriorityQueue.prototype.clear = function() {
this.length = 0;
return this.priv.clear();
};
return AbstractPriorityQueue;
})();
},{}],3:[function(_dereq_,module,exports){
var ArrayStrategy, binarySearchForIndexReversed;
binarySearchForIndexReversed = function(array, value, comparator) {
var high, low, mid;
low = 0;
high = array.length;
while (low < high) {
mid = (low + high) >>> 1;
if (comparator(array[mid], value) >= 0) {
low = mid + 1;
} else {
high = mid;
}
}
return low;
};
module.exports = ArrayStrategy = (function() {
function ArrayStrategy(options) {
var ref;
this.options = options;
this.comparator = this.options.comparator;
this.data = ((ref = this.options.initialValues) != null ? ref.slice(0) : void 0) || [];
this.data.sort(this.comparator).reverse();
}
ArrayStrategy.prototype.queue = function(value) {
var pos;
pos = binarySearchForIndexReversed(this.data, value, this.comparator);
this.data.splice(pos, 0, value);
return void 0;
};
ArrayStrategy.prototype.dequeue = function() {
return this.data.pop();
};
ArrayStrategy.prototype.peek = function() {
return this.data[this.data.length - 1];
};
ArrayStrategy.prototype.clear = function() {
this.data.length = 0;
return void 0;
};
return ArrayStrategy;
})();
},{}],4:[function(_dereq_,module,exports){
var BHeapStrategy;
module.exports = BHeapStrategy = (function() {
function BHeapStrategy(options) {
var arr, i, j, k, len, ref, ref1, shift, value;
this.comparator = (options != null ? options.comparator : void 0) || function(a, b) {
return a - b;
};
this.pageSize = (options != null ? options.pageSize : void 0) || 512;
this.length = 0;
shift = 0;
while ((1 << shift) < this.pageSize) {
shift += 1;
}
if (1 << shift !== this.pageSize) {
throw 'pageSize must be a power of two';
}
this._shift = shift;
this._emptyMemoryPageTemplate = arr = [];
for (i = j = 0, ref = this.pageSize; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
arr.push(null);
}
this._memory = [];
this._mask = this.pageSize - 1;
if (options.initialValues) {
ref1 = options.initialValues;
for (k = 0, len = ref1.length; k < len; k++) {
value = ref1[k];
this.queue(value);
}
}
}
BHeapStrategy.prototype.queue = function(value) {
this.length += 1;
this._write(this.length, value);
this._bubbleUp(this.length, value);
return void 0;
};
BHeapStrategy.prototype.dequeue = function() {
var ret, val;
ret = this._read(1);
val = this._read(this.length);
this.length -= 1;
if (this.length > 0) {
this._write(1, val);
this._bubbleDown(1, val);
}
return ret;
};
BHeapStrategy.prototype.peek = function() {
return this._read(1);
};
BHeapStrategy.prototype.clear = function() {
this.length = 0;
this._memory.length = 0;
return void 0;
};
BHeapStrategy.prototype._write = function(index, value) {
var page;
page = index >> this._shift;
while (page >= this._memory.length) {
this._memory.push(this._emptyMemoryPageTemplate.slice(0));
}
return this._memory[page][index & this._mask] = value;
};
BHeapStrategy.prototype._read = function(index) {
return this._memory[index >> this._shift][index & this._mask];
};
BHeapStrategy.prototype._bubbleUp = function(index, value) {
var compare, indexInPage, parentIndex, parentValue;
compare = this.comparator;
while (index > 1) {
indexInPage = index & this._mask;
if (index < this.pageSize || indexInPage > 3) {
parentIndex = (index & ~this._mask) | (indexInPage >> 1);
} else if (indexInPage < 2) {
parentIndex = (index - this.pageSize) >> this._shift;
parentIndex += parentIndex & ~(this._mask >> 1);
parentIndex |= this.pageSize >> 1;
} else {
parentIndex = index - 2;
}
parentValue = this._read(parentIndex);
if (compare(parentValue, value) < 0) {
break;
}
this._write(parentIndex, value);
this._write(index, parentValue);
index = parentIndex;
}
return void 0;
};
BHeapStrategy.prototype._bubbleDown = function(index, value) {
var childIndex1, childIndex2, childValue1, childValue2, compare;
compare = this.comparator;
while (index < this.length) {
if (index > this._mask && !(index & (this._mask - 1))) {
childIndex1 = childIndex2 = index + 2;
} else if (index & (this.pageSize >> 1)) {
childIndex1 = (index & ~this._mask) >> 1;
childIndex1 |= index & (this._mask >> 1);
childIndex1 = (childIndex1 + 1) << this._shift;
childIndex2 = childIndex1 + 1;
} else {
childIndex1 = index + (index & this._mask);
childIndex2 = childIndex1 + 1;
}
if (childIndex1 !== childIndex2 && childIndex2 <= this.length) {
childValue1 = this._read(childIndex1);
childValue2 = this._read(childIndex2);
if (compare(childValue1, value) < 0 && compare(childValue1, childValue2) <= 0) {
this._write(childIndex1, value);
this._write(index, childValue1);
index = childIndex1;
} else if (compare(childValue2, value) < 0) {
this._write(childIndex2, value);
this._write(index, childValue2);
index = childIndex2;
} else {
break;
}
} else if (childIndex1 <= this.length) {
childValue1 = this._read(childIndex1);
if (compare(childValue1, value) < 0) {
this._write(childIndex1, value);
this._write(index, childValue1);
index = childIndex1;
} else {
break;
}
} else {
break;
}
}
return void 0;
};
return BHeapStrategy;
})();
},{}],5:[function(_dereq_,module,exports){
var BinaryHeapStrategy;
module.exports = BinaryHeapStrategy = (function() {
function BinaryHeapStrategy(options) {
var ref;
this.comparator = (options != null ? options.comparator : void 0) || function(a, b) {
return a - b;
};
this.length = 0;
this.data = ((ref = options.initialValues) != null ? ref.slice(0) : void 0) || [];
this._heapify();
}
BinaryHeapStrategy.prototype._heapify = function() {
var i, j, ref;
if (this.data.length > 0) {
for (i = j = 1, ref = this.data.length; 1 <= ref ? j < ref : j > ref; i = 1 <= ref ? ++j : --j) {
this._bubbleUp(i);
}
}
return void 0;
};
BinaryHeapStrategy.prototype.queue = function(value) {
this.data.push(value);
this._bubbleUp(this.data.length - 1);
return void 0;
};
BinaryHeapStrategy.prototype.dequeue = function() {
var last, ret;
ret = this.data[0];
last = this.data.pop();
if (this.data.length > 0) {
this.data[0] = last;
this._bubbleDown(0);
}
return ret;
};
BinaryHeapStrategy.prototype.peek = function() {
return this.data[0];
};
BinaryHeapStrategy.prototype.clear = function() {
this.length = 0;
this.data.length = 0;
return void 0;
};
BinaryHeapStrategy.prototype._bubbleUp = function(pos) {
var parent, x;
while (pos > 0) {
parent = (pos - 1) >>> 1;
if (this.comparator(this.data[pos], this.data[parent]) < 0) {
x = this.data[parent];
this.data[parent] = this.data[pos];
this.data[pos] = x;
pos = parent;
} else {
break;
}
}
return void 0;
};
BinaryHeapStrategy.prototype._bubbleDown = function(pos) {
var last, left, minIndex, right, x;
last = this.data.length - 1;
while (true) {
left = (pos << 1) + 1;
right = left + 1;
minIndex = pos;
if (left <= last && this.comparator(this.data[left], this.data[minIndex]) < 0) {
minIndex = left;
}
if (right <= last && this.comparator(this.data[right], this.data[minIndex]) < 0) {
minIndex = right;
}
if (minIndex !== pos) {
x = this.data[minIndex];
this.data[minIndex] = this.data[pos];
this.data[pos] = x;
pos = minIndex;
} else {
break;
}
}
return void 0;
};
return BinaryHeapStrategy;
})();
},{}]},{},[1])(1)
});

@ -0,0 +1,21 @@
/* If you're feeling fancy you can add interactivity
to your site with Javascript */
// prints "hi" in the browser's dev tools console
console.log("hi");
var svg = d3.select("svg");
var params = {
extent: defaultExtent,
generator: generateCoast,
npts: 1684,
ncities: 15,
nterrs: 5,
fontsizes: {
region: 40,
city: 25,
town: 20
}
}
doMap(svg, defaultParams);

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

18525
main/map3_files/d3.js vendored

File diff suppressed because it is too large Load Diff

@ -0,0 +1,486 @@
function shuffled(list) {
var newlist = [];
for (var i = 0; i < list.length; i++) {
newlist.push(list[i]);
}
for (var i = list.length - 1; i > 0; i--) {
var tmp = newlist[i];
var j = randrange(i);
newlist[i] = newlist[j];
newlist[j] = tmp;
}
return newlist;
}
function choose(list, exponent) {
exponent = exponent || 1;
return list[Math.floor(Math.pow(Math.random(), exponent) * list.length)];
}
function randrange(lo, hi) {
if (hi == undefined) {
hi = lo;
lo = 0;
}
return Math.floor(Math.random() * (hi - lo)) + lo;
}
function join(list, sep) {
if (list.length == 0) return '';
sep = sep || '';
var s = list[0];
for (var i = 1; i < list.length; i++) {
s += sep;
s += list[i];
}
return s;
}
function capitalize(word) {
return word[0].toUpperCase() + word.slice(1);
}
function spell(lang, syll) {
if (lang.noortho) return syll;
var s = '';
for (var i = 0; i < syll.length; i++) {
var c = syll[i];
s += lang.cortho[c] || lang.vortho[c] || defaultOrtho[c] || c;
}
return s;
}
function makeSyllable(lang) {
while (true) {
var syll = "";
for (var i = 0; i < lang.structure.length; i++) {
var ptype = lang.structure[i];
if (lang.structure[i+1] == '?') {
i++;
if (Math.random() < 0.5) {
continue;
}
}
syll += choose(lang.phonemes[ptype], lang.exponent);
}
var bad = false;
for (var i = 0; i < lang.restricts.length; i++) {
if (lang.restricts[i].test(syll)) {
bad = true;
break;
}
}
if (bad) continue;
return spell(lang, syll);
}
}
function getMorpheme(lang, key) {
if (lang.nomorph) {
return makeSyllable(lang);
}
key = key || '';
var list = lang.morphemes[key] || [];
var extras = 10;
if (key) extras = 1;
while (true) {
var n = randrange(list.length + extras);
if (list[n]) return list[n];
var morph = makeSyllable(lang);
var bad = false;
for (var k in lang.morphemes) {
if (lang.morphemes[k].includes(morph)) {
bad = true;
break;
}
}
if (bad) continue;
list.push(morph);
lang.morphemes[key] = list;
return morph;
}
}
function makeWord(lang, key) {
var nsylls = randrange(lang.minsyll, lang.maxsyll + 1);
var w = '';
var keys = [];
keys[randrange(nsylls)] = key;
for (var i = 0; i < nsylls; i++) {
w += getMorpheme(lang, keys[i]);
}
return w;
}
function getWord(lang, key) {
key = key || '';
var ws = lang.words[key] || [];
var extras = 3;
if (key) extras = 2;
while (true) {
var n = randrange(ws.length + extras);
var w = ws[n];
if (w) {
return w;
}
w = makeWord(lang, key);
var bad = false;
for (var k in lang.words) {
if (lang.words[k].includes(w)) {
bad = true;
break;
}
}
if (bad) continue;
ws.push(w);
lang.words[key] = ws;
return w;
}
}
function makeName(lang, key) {
key = key || '';
lang.genitive = lang.genitive || getMorpheme(lang, 'of');
lang.definite = lang.definite || getMorpheme(lang, 'the');
while (true) {
var name = null;
if (Math.random() < 0.5) {
name = capitalize(getWord(lang, key));
} else {
var w1 = capitalize(getWord(lang, Math.random() < 0.6 ? key : ''));
var w2 = capitalize(getWord(lang, Math.random() < 0.6 ? key : ''));
if (w1 == w2) continue;
if (Math.random() > 0.5) {
name = join([w1, w2], lang.joiner);
} else {
name = join([w1, lang.genitive, w2], lang.joiner);
}
}
if (Math.random() < 0.1) {
name = join([lang.definite, name], lang.joiner);
}
if ((name.length < lang.minchar) || (name.length > lang.maxchar)) continue;
var used = false;
for (var i = 0; i < lang.names.length; i++) {
var name2 = lang.names[i];
if ((name.indexOf(name2) != -1) || (name2.indexOf(name) != -1)) {
used = true;
break;
}
}
if (used) continue;
lang.names.push(name);
return name;
}
}
function makeBasicLanguage() {
return {
phonemes: {
C: "ptkmnls",
V: "aeiou",
S: "s",
F: "mn",
L: "rl"
},
structure: "CVC",
exponent: 2,
restricts: [],
cortho: {},
vortho: {},
noortho: true,
nomorph: true,
nowordpool: true,
minsyll: 1,
maxsyll: 1,
morphemes: {},
words: {},
names: [],
joiner: ' ',
maxchar: 12,
minchar: 5
};
}
function makeOrthoLanguage() {
var lang = makeBasicLanguage();
lang.noortho = false;
return lang;
}
function makeRandomLanguage() {
var lang = makeBasicLanguage();
lang.noortho = false;
lang.nomorph = false;
lang.nowordpool = false;
lang.phonemes.C = shuffled(choose(consets, 2).C);
lang.phonemes.V = shuffled(choose(vowsets, 2).V);
lang.phonemes.L = shuffled(choose(lsets, 2).L);
lang.phonemes.S = shuffled(choose(ssets, 2).S);
lang.phonemes.F = shuffled(choose(fsets, 2).F);
lang.structure = choose(syllstructs);
lang.restricts = ressets[2].res;
lang.cortho = choose(corthsets, 2).orth;
lang.vortho = choose(vorthsets, 2).orth;
lang.minsyll = randrange(1, 3);
if (lang.structure.length < 3) lang.minsyll++;
lang.maxsyll = randrange(lang.minsyll + 1, 7);
lang.joiner = choose(' -');
return lang;
}
var defaultOrtho = {
'ʃ': 'sh',
'ʒ': 'zh',
'ʧ': 'ch',
'ʤ': 'j',
'ŋ': 'ng',
'j': 'y',
'x': 'kh',
'ɣ': 'gh',
'ʔ': '',
A: "á",
E: "é",
I: "í",
O: "ó",
U: "ú"
};
var corthsets = [
{
name: "Default",
orth: {}
},
{
name: "Slavic",
orth: {
'ʃ': 'š',
'ʒ': 'ž',
'ʧ': 'č',
'ʤ': 'ǧ',
'j': 'j'
}
},
{
name: "German",
orth: {
'ʃ': 'sch',
'ʒ': 'zh',
'ʧ': 'tsch',
'ʤ': 'dz',
'j': 'j',
'x': 'ch'
}
},
{
name: "French",
orth: {
'ʃ': 'ch',
'ʒ': 'j',
'ʧ': 'tch',
'ʤ': 'dj',
'x': 'kh'
}
},
{
name: "Chinese (pinyin)",
orth: {
'ʃ': 'x',
'ʧ': 'q',
'ʤ': 'j',
}
}
];
var vorthsets = [
{
name: "Ácutes",
orth: {}
},
{
name: "Ümlauts",
orth: {
A: "ä",
E: "ë",
I: "ï",
O: "ö",
U: "ü"
}
},
{
name: "Welsh",
orth: {
A: "â",
E: "ê",
I: "y",
O: "ô",
U: "w"
}
},
{
name: "Diphthongs",
orth: {
A: "au",
E: "ei",
I: "ie",
O: "ou",
U: "oo"
}
},
{
name: "Doubles",
orth: {
A: "aa",
E: "ee",
I: "ii",
O: "oo",
U: "uu"
}
}
];
var consets = [
{
name: "Minimal",
C: "ptkmnls"
},
{
name: "English-ish",
C: "ptkbdgmnlrsʃzʒʧ"
},
{
name: "Pirahã (very simple)",
C: "ptkmnh"
},
{
name: "Hawaiian-ish",
C: "hklmnpwʔ"
},
{
name: "Greenlandic-ish",
C: "ptkqvsgrmnŋlj"
},
{
name: "Arabic-ish",
C: "tksʃdbqɣxmnlrwj"
},
{
name: "Arabic-lite",
C: "tkdgmnsʃ"
},
{
name: "English-lite",
C: "ptkbdgmnszʒʧhjw"
}
];
var ssets = [
{
name: "Just s",
S: "s"
},
{
name: "s ʃ",
S: "sʃ"
},
{
name: "s ʃ f",
S: "sʃf"
}
];
var lsets = [
{
name: "r l",
L: "rl"
},
{
name: "Just r",
L: "r"
},
{
name: "Just l",
L: "l"
},
{
name: "w j",
L: "wj"
},
{
name: "r l w j",
L: "rlwj"
}
];
var fsets = [
{
name: "m n",
F: "mn"
},
{
name: "s k",
F: "sk"
},
{
name: "m n ŋ",
F: "mnŋ"
},
{
name: "s ʃ z ʒ",
F: "sʃzʒ"
}
];
var vowsets = [
{
name: "Standard 5-vowel",
V: "aeiou"
},
{
name: "3-vowel a i u",
V: "aiu"
},
{
name: "Extra A E I",
V: "aeiouAEI"
},
{
name: "Extra U",
V: "aeiouU"
},
{
name: "5-vowel a i u A I",
V: "aiuAI"
},
{
name: "3-vowel e o u",
V: "eou"
},
{
name: "Extra A O U",
V: "aeiouAOU"
}
];
var syllstructs = [
"CVC",
"CVV?C",
"CVVC?", "CVC?", "CV", "VC", "CVF", "C?VC", "CVF?",
"CL?VC", "CL?VF", "S?CVC", "S?CVF", "S?CVC?",
"C?VF", "C?VC?", "C?VF?", "C?L?VC", "VC",
"CVL?C?", "C?VL?C", "C?VLC?"];
var ressets = [
{
name: "None",
res: []
},
{
name: "Double sounds",
res: [/(.)\1/]
},
{
name: "Doubles and hard clusters",
res: [/[sʃf][sʃ]/, /(.)\1/, /[rl][rl]/]
}
];

@ -0,0 +1,387 @@
(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.PriorityQueue = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
var AbstractPriorityQueue, ArrayStrategy, BHeapStrategy, BinaryHeapStrategy, PriorityQueue,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
AbstractPriorityQueue = _dereq_('./PriorityQueue/AbstractPriorityQueue');
ArrayStrategy = _dereq_('./PriorityQueue/ArrayStrategy');
BinaryHeapStrategy = _dereq_('./PriorityQueue/BinaryHeapStrategy');
BHeapStrategy = _dereq_('./PriorityQueue/BHeapStrategy');
PriorityQueue = (function(superClass) {
extend(PriorityQueue, superClass);
function PriorityQueue(options) {
options || (options = {});
options.strategy || (options.strategy = BinaryHeapStrategy);
options.comparator || (options.comparator = function(a, b) {
return (a || 0) - (b || 0);
});
PriorityQueue.__super__.constructor.call(this, options);
}
return PriorityQueue;
})(AbstractPriorityQueue);
PriorityQueue.ArrayStrategy = ArrayStrategy;
PriorityQueue.BinaryHeapStrategy = BinaryHeapStrategy;
PriorityQueue.BHeapStrategy = BHeapStrategy;
module.exports = PriorityQueue;
},{"./PriorityQueue/AbstractPriorityQueue":2,"./PriorityQueue/ArrayStrategy":3,"./PriorityQueue/BHeapStrategy":4,"./PriorityQueue/BinaryHeapStrategy":5}],2:[function(_dereq_,module,exports){
var AbstractPriorityQueue;
module.exports = AbstractPriorityQueue = (function() {
function AbstractPriorityQueue(options) {
var ref;
if ((options != null ? options.strategy : void 0) == null) {
throw 'Must pass options.strategy, a strategy';
}
if ((options != null ? options.comparator : void 0) == null) {
throw 'Must pass options.comparator, a comparator';
}
this.priv = new options.strategy(options);
this.length = (options != null ? (ref = options.initialValues) != null ? ref.length : void 0 : void 0) || 0;
}
AbstractPriorityQueue.prototype.queue = function(value) {
this.length++;
this.priv.queue(value);
return void 0;
};
AbstractPriorityQueue.prototype.dequeue = function(value) {
if (!this.length) {
throw 'Empty queue';
}
this.length--;
return this.priv.dequeue();
};
AbstractPriorityQueue.prototype.peek = function(value) {
if (!this.length) {
throw 'Empty queue';
}
return this.priv.peek();
};
AbstractPriorityQueue.prototype.clear = function() {
this.length = 0;
return this.priv.clear();
};
return AbstractPriorityQueue;
})();
},{}],3:[function(_dereq_,module,exports){
var ArrayStrategy, binarySearchForIndexReversed;
binarySearchForIndexReversed = function(array, value, comparator) {
var high, low, mid;
low = 0;
high = array.length;
while (low < high) {
mid = (low + high) >>> 1;
if (comparator(array[mid], value) >= 0) {
low = mid + 1;
} else {
high = mid;
}
}
return low;
};
module.exports = ArrayStrategy = (function() {
function ArrayStrategy(options) {
var ref;
this.options = options;
this.comparator = this.options.comparator;
this.data = ((ref = this.options.initialValues) != null ? ref.slice(0) : void 0) || [];
this.data.sort(this.comparator).reverse();
}
ArrayStrategy.prototype.queue = function(value) {
var pos;
pos = binarySearchForIndexReversed(this.data, value, this.comparator);
this.data.splice(pos, 0, value);
return void 0;
};
ArrayStrategy.prototype.dequeue = function() {
return this.data.pop();
};
ArrayStrategy.prototype.peek = function() {
return this.data[this.data.length - 1];
};
ArrayStrategy.prototype.clear = function() {
this.data.length = 0;
return void 0;
};
return ArrayStrategy;
})();
},{}],4:[function(_dereq_,module,exports){
var BHeapStrategy;
module.exports = BHeapStrategy = (function() {
function BHeapStrategy(options) {
var arr, i, j, k, len, ref, ref1, shift, value;
this.comparator = (options != null ? options.comparator : void 0) || function(a, b) {
return a - b;
};
this.pageSize = (options != null ? options.pageSize : void 0) || 512;
this.length = 0;
shift = 0;
while ((1 << shift) < this.pageSize) {
shift += 1;
}
if (1 << shift !== this.pageSize) {
throw 'pageSize must be a power of two';
}
this._shift = shift;
this._emptyMemoryPageTemplate = arr = [];
for (i = j = 0, ref = this.pageSize; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
arr.push(null);
}
this._memory = [];
this._mask = this.pageSize - 1;
if (options.initialValues) {
ref1 = options.initialValues;
for (k = 0, len = ref1.length; k < len; k++) {
value = ref1[k];
this.queue(value);
}
}
}
BHeapStrategy.prototype.queue = function(value) {
this.length += 1;
this._write(this.length, value);
this._bubbleUp(this.length, value);
return void 0;
};
BHeapStrategy.prototype.dequeue = function() {
var ret, val;
ret = this._read(1);
val = this._read(this.length);
this.length -= 1;
if (this.length > 0) {
this._write(1, val);
this._bubbleDown(1, val);
}
return ret;
};
BHeapStrategy.prototype.peek = function() {
return this._read(1);
};
BHeapStrategy.prototype.clear = function() {
this.length = 0;
this._memory.length = 0;
return void 0;
};
BHeapStrategy.prototype._write = function(index, value) {
var page;
page = index >> this._shift;
while (page >= this._memory.length) {
this._memory.push(this._emptyMemoryPageTemplate.slice(0));
}
return this._memory[page][index & this._mask] = value;
};
BHeapStrategy.prototype._read = function(index) {
return this._memory[index >> this._shift][index & this._mask];
};
BHeapStrategy.prototype._bubbleUp = function(index, value) {
var compare, indexInPage, parentIndex, parentValue;
compare = this.comparator;
while (index > 1) {
indexInPage = index & this._mask;
if (index < this.pageSize || indexInPage > 3) {
parentIndex = (index & ~this._mask) | (indexInPage >> 1);
} else if (indexInPage < 2) {
parentIndex = (index - this.pageSize) >> this._shift;
parentIndex += parentIndex & ~(this._mask >> 1);
parentIndex |= this.pageSize >> 1;
} else {
parentIndex = index - 2;
}
parentValue = this._read(parentIndex);
if (compare(parentValue, value) < 0) {
break;
}
this._write(parentIndex, value);
this._write(index, parentValue);
index = parentIndex;
}
return void 0;
};
BHeapStrategy.prototype._bubbleDown = function(index, value) {
var childIndex1, childIndex2, childValue1, childValue2, compare;
compare = this.comparator;
while (index < this.length) {
if (index > this._mask && !(index & (this._mask - 1))) {
childIndex1 = childIndex2 = index + 2;
} else if (index & (this.pageSize >> 1)) {
childIndex1 = (index & ~this._mask) >> 1;
childIndex1 |= index & (this._mask >> 1);
childIndex1 = (childIndex1 + 1) << this._shift;
childIndex2 = childIndex1 + 1;
} else {
childIndex1 = index + (index & this._mask);
childIndex2 = childIndex1 + 1;
}
if (childIndex1 !== childIndex2 && childIndex2 <= this.length) {
childValue1 = this._read(childIndex1);
childValue2 = this._read(childIndex2);
if (compare(childValue1, value) < 0 && compare(childValue1, childValue2) <= 0) {
this._write(childIndex1, value);
this._write(index, childValue1);
index = childIndex1;
} else if (compare(childValue2, value) < 0) {
this._write(childIndex2, value);
this._write(index, childValue2);
index = childIndex2;
} else {
break;
}
} else if (childIndex1 <= this.length) {
childValue1 = this._read(childIndex1);
if (compare(childValue1, value) < 0) {
this._write(childIndex1, value);
this._write(index, childValue1);
index = childIndex1;
} else {
break;
}
} else {
break;
}
}
return void 0;
};
return BHeapStrategy;
})();
},{}],5:[function(_dereq_,module,exports){
var BinaryHeapStrategy;
module.exports = BinaryHeapStrategy = (function() {
function BinaryHeapStrategy(options) {
var ref;
this.comparator = (options != null ? options.comparator : void 0) || function(a, b) {
return a - b;
};
this.length = 0;
this.data = ((ref = options.initialValues) != null ? ref.slice(0) : void 0) || [];
this._heapify();
}
BinaryHeapStrategy.prototype._heapify = function() {
var i, j, ref;
if (this.data.length > 0) {
for (i = j = 1, ref = this.data.length; 1 <= ref ? j < ref : j > ref; i = 1 <= ref ? ++j : --j) {
this._bubbleUp(i);
}
}
return void 0;
};
BinaryHeapStrategy.prototype.queue = function(value) {
this.data.push(value);
this._bubbleUp(this.data.length - 1);
return void 0;
};
BinaryHeapStrategy.prototype.dequeue = function() {
var last, ret;
ret = this.data[0];
last = this.data.pop();
if (this.data.length > 0) {
this.data[0] = last;
this._bubbleDown(0);
}
return ret;
};
BinaryHeapStrategy.prototype.peek = function() {
return this.data[0];
};
BinaryHeapStrategy.prototype.clear = function() {
this.length = 0;
this.data.length = 0;
return void 0;
};
BinaryHeapStrategy.prototype._bubbleUp = function(pos) {
var parent, x;
while (pos > 0) {
parent = (pos - 1) >>> 1;
if (this.comparator(this.data[pos], this.data[parent]) < 0) {
x = this.data[parent];
this.data[parent] = this.data[pos];
this.data[pos] = x;
pos = parent;
} else {
break;
}
}
return void 0;
};
BinaryHeapStrategy.prototype._bubbleDown = function(pos) {
var last, left, minIndex, right, x;
last = this.data.length - 1;
while (true) {
left = (pos << 1) + 1;
right = left + 1;
minIndex = pos;
if (left <= last && this.comparator(this.data[left], this.data[minIndex]) < 0) {
minIndex = left;
}
if (right <= last && this.comparator(this.data[right], this.data[minIndex]) < 0) {
minIndex = right;
}
if (minIndex !== pos) {
x = this.data[minIndex];
this.data[minIndex] = this.data[pos];
this.data[pos] = x;
pos = minIndex;
} else {
break;
}
}
return void 0;
};
return BinaryHeapStrategy;
})();
},{}]},{},[1])(1)
});

@ -0,0 +1,21 @@
/* If you're feeling fancy you can add interactivity
to your site with Javascript */
// prints "hi" in the browser's dev tools console
console.log("hi");
var svg = d3.select("svg");
var params = {
extent: defaultExtent,
generator: generateCoast,
npts: 1684,
ncities: 15,
nterrs: 5,
fontsizes: {
region: 40,
city: 25,
town: 20
}
}
doMap(svg, defaultParams);

File diff suppressed because it is too large Load Diff

18525
main/map_files/d3.js vendored

File diff suppressed because it is too large Load Diff

@ -0,0 +1,486 @@
function shuffled(list) {
var newlist = [];
for (var i = 0; i < list.length; i++) {
newlist.push(list[i]);
}
for (var i = list.length - 1; i > 0; i--) {
var tmp = newlist[i];
var j = randrange(i);
newlist[i] = newlist[j];
newlist[j] = tmp;
}
return newlist;
}
function choose(list, exponent) {
exponent = exponent || 1;
return list[Math.floor(Math.pow(Math.random(), exponent) * list.length)];
}
function randrange(lo, hi) {
if (hi == undefined) {
hi = lo;
lo = 0;
}
return Math.floor(Math.random() * (hi - lo)) + lo;
}
function join(list, sep) {
if (list.length == 0) return '';
sep = sep || '';
var s = list[0];
for (var i = 1; i < list.length; i++) {
s += sep;
s += list[i];
}
return s;
}
function capitalize(word) {
return word[0].toUpperCase() + word.slice(1);
}
function spell(lang, syll) {
if (lang.noortho) return syll;
var s = '';
for (var i = 0; i < syll.length; i++) {
var c = syll[i];
s += lang.cortho[c] || lang.vortho[c] || defaultOrtho[c] || c;
}
return s;
}
function makeSyllable(lang) {
while (true) {
var syll = "";
for (var i = 0; i < lang.structure.length; i++) {
var ptype = lang.structure[i];
if (lang.structure[i+1] == '?') {
i++;
if (Math.random() < 0.5) {
continue;
}
}
syll += choose(lang.phonemes[ptype], lang.exponent);
}
var bad = false;
for (var i = 0; i < lang.restricts.length; i++) {
if (lang.restricts[i].test(syll)) {
bad = true;
break;
}
}
if (bad) continue;
return spell(lang, syll);
}
}
function getMorpheme(lang, key) {
if (lang.nomorph) {
return makeSyllable(lang);
}
key = key || '';
var list = lang.morphemes[key] || [];
var extras = 10;
if (key) extras = 1;
while (true) {
var n = randrange(list.length + extras);
if (list[n]) return list[n];
var morph = makeSyllable(lang);
var bad = false;
for (var k in lang.morphemes) {
if (lang.morphemes[k].includes(morph)) {
bad = true;
break;
}
}
if (bad) continue;
list.push(morph);
lang.morphemes[key] = list;
return morph;
}
}
function makeWord(lang, key) {
var nsylls = randrange(lang.minsyll, lang.maxsyll + 1);
var w = '';
var keys = [];
keys[randrange(nsylls)] = key;
for (var i = 0; i < nsylls; i++) {
w += getMorpheme(lang, keys[i]);
}
return w;
}
function getWord(lang, key) {
key = key || '';
var ws = lang.words[key] || [];
var extras = 3;
if (key) extras = 2;
while (true) {
var n = randrange(ws.length + extras);
var w = ws[n];
if (w) {
return w;
}
w = makeWord(lang, key);
var bad = false;
for (var k in lang.words) {
if (lang.words[k].includes(w)) {
bad = true;
break;
}
}
if (bad) continue;
ws.push(w);
lang.words[key] = ws;
return w;
}
}
function makeName(lang, key) {
key = key || '';
lang.genitive = lang.genitive || getMorpheme(lang, 'of');
lang.definite = lang.definite || getMorpheme(lang, 'the');
while (true) {
var name = null;
if (Math.random() < 0.5) {
name = capitalize(getWord(lang, key));
} else {
var w1 = capitalize(getWord(lang, Math.random() < 0.6 ? key : ''));
var w2 = capitalize(getWord(lang, Math.random() < 0.6 ? key : ''));
if (w1 == w2) continue;
if (Math.random() > 0.5) {
name = join([w1, w2], lang.joiner);
} else {
name = join([w1, lang.genitive, w2], lang.joiner);
}
}
if (Math.random() < 0.1) {
name = join([lang.definite, name], lang.joiner);
}
if ((name.length < lang.minchar) || (name.length > lang.maxchar)) continue;
var used = false;
for (var i = 0; i < lang.names.length; i++) {
var name2 = lang.names[i];
if ((name.indexOf(name2) != -1) || (name2.indexOf(name) != -1)) {
used = true;
break;
}
}
if (used) continue;
lang.names.push(name);
return name;
}
}
function makeBasicLanguage() {
return {
phonemes: {
C: "ptkmnls",
V: "aeiou",
S: "s",
F: "mn",
L: "rl"
},
structure: "CVC",
exponent: 2,
restricts: [],
cortho: {},
vortho: {},
noortho: true,
nomorph: true,
nowordpool: true,
minsyll: 1,
maxsyll: 1,
morphemes: {},
words: {},
names: [],
joiner: ' ',
maxchar: 12,
minchar: 5
};
}
function makeOrthoLanguage() {
var lang = makeBasicLanguage();
lang.noortho = false;
return lang;
}
function makeRandomLanguage() {
var lang = makeBasicLanguage();
lang.noortho = false;
lang.nomorph = false;
lang.nowordpool = false;
lang.phonemes.C = shuffled(choose(consets, 2).C);
lang.phonemes.V = shuffled(choose(vowsets, 2).V);
lang.phonemes.L = shuffled(choose(lsets, 2).L);
lang.phonemes.S = shuffled(choose(ssets, 2).S);
lang.phonemes.F = shuffled(choose(fsets, 2).F);
lang.structure = choose(syllstructs);
lang.restricts = ressets[2].res;
lang.cortho = choose(corthsets, 2).orth;
lang.vortho = choose(vorthsets, 2).orth;
lang.minsyll = randrange(1, 3);
if (lang.structure.length < 3) lang.minsyll++;
lang.maxsyll = randrange(lang.minsyll + 1, 7);
lang.joiner = choose(' -');
return lang;
}
var defaultOrtho = {
'ʃ': 'sh',
'ʒ': 'zh',
'ʧ': 'ch',
'ʤ': 'j',
'ŋ': 'ng',
'j': 'y',
'x': 'kh',
'ɣ': 'gh',
'ʔ': '',
A: "á",
E: "é",
I: "í",
O: "ó",
U: "ú"
};
var corthsets = [
{
name: "Default",
orth: {}
},
{
name: "Slavic",
orth: {
'ʃ': 'š',
'ʒ': 'ž',
'ʧ': 'č',
'ʤ': 'ǧ',
'j': 'j'
}
},
{
name: "German",
orth: {
'ʃ': 'sch',
'ʒ': 'zh',
'ʧ': 'tsch',
'ʤ': 'dz',
'j': 'j',
'x': 'ch'
}
},
{
name: "French",
orth: {
'ʃ': 'ch',
'ʒ': 'j',
'ʧ': 'tch',
'ʤ': 'dj',
'x': 'kh'
}
},
{
name: "Chinese (pinyin)",
orth: {
'ʃ': 'x',
'ʧ': 'q',
'ʤ': 'j',
}
}
];
var vorthsets = [
{
name: "Ácutes",
orth: {}
},
{
name: "Ümlauts",
orth: {
A: "ä",
E: "ë",
I: "ï",
O: "ö",
U: "ü"
}
},
{
name: "Welsh",
orth: {
A: "â",
E: "ê",
I: "y",
O: "ô",
U: "w"
}
},
{
name: "Diphthongs",
orth: {
A: "au",
E: "ei",
I: "ie",
O: "ou",
U: "oo"
}
},
{
name: "Doubles",
orth: {
A: "aa",
E: "ee",
I: "ii",
O: "oo",
U: "uu"
}
}
];
var consets = [
{
name: "Minimal",
C: "ptkmnls"
},
{
name: "English-ish",
C: "ptkbdgmnlrsʃzʒʧ"
},
{
name: "Pirahã (very simple)",
C: "ptkmnh"
},
{
name: "Hawaiian-ish",
C: "hklmnpwʔ"
},
{
name: "Greenlandic-ish",
C: "ptkqvsgrmnŋlj"
},
{
name: "Arabic-ish",
C: "tksʃdbqɣxmnlrwj"
},
{
name: "Arabic-lite",
C: "tkdgmnsʃ"
},
{
name: "English-lite",
C: "ptkbdgmnszʒʧhjw"
}
];
var ssets = [
{
name: "Just s",
S: "s"
},
{
name: "s ʃ",
S: "sʃ"
},
{
name: "s ʃ f",
S: "sʃf"
}
];
var lsets = [
{
name: "r l",
L: "rl"
},
{
name: "Just r",
L: "r"
},
{
name: "Just l",
L: "l"
},
{
name: "w j",
L: "wj"
},
{
name: "r l w j",
L: "rlwj"
}
];
var fsets = [
{
name: "m n",
F: "mn"
},
{
name: "s k",
F: "sk"
},
{
name: "m n ŋ",
F: "mnŋ"
},
{
name: "s ʃ z ʒ",
F: "sʃzʒ"
}
];
var vowsets = [
{
name: "Standard 5-vowel",
V: "aeiou"
},
{
name: "3-vowel a i u",
V: "aiu"
},
{
name: "Extra A E I",
V: "aeiouAEI"
},
{
name: "Extra U",
V: "aeiouU"
},
{
name: "5-vowel a i u A I",
V: "aiuAI"
},
{
name: "3-vowel e o u",
V: "eou"
},
{
name: "Extra A O U",
V: "aeiouAOU"
}
];
var syllstructs = [
"CVC",
"CVV?C",
"CVVC?", "CVC?", "CV", "VC", "CVF", "C?VC", "CVF?",
"CL?VC", "CL?VF", "S?CVC", "S?CVF", "S?CVC?",
"C?VF", "C?VC?", "C?VF?", "C?L?VC", "VC",
"CVL?C?", "C?VL?C", "C?VLC?"];
var ressets = [
{
name: "None",
res: []
},
{
name: "Double sounds",
res: [/(.)\1/]
},
{
name: "Doubles and hard clusters",
res: [/[sʃf][sʃ]/, /(.)\1/, /[rl][rl]/]
}
];

@ -0,0 +1,387 @@
(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.PriorityQueue = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
var AbstractPriorityQueue, ArrayStrategy, BHeapStrategy, BinaryHeapStrategy, PriorityQueue,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
AbstractPriorityQueue = _dereq_('./PriorityQueue/AbstractPriorityQueue');
ArrayStrategy = _dereq_('./PriorityQueue/ArrayStrategy');
BinaryHeapStrategy = _dereq_('./PriorityQueue/BinaryHeapStrategy');
BHeapStrategy = _dereq_('./PriorityQueue/BHeapStrategy');
PriorityQueue = (function(superClass) {
extend(PriorityQueue, superClass);
function PriorityQueue(options) {
options || (options = {});
options.strategy || (options.strategy = BinaryHeapStrategy);
options.comparator || (options.comparator = function(a, b) {
return (a || 0) - (b || 0);
});
PriorityQueue.__super__.constructor.call(this, options);
}
return PriorityQueue;
})(AbstractPriorityQueue);
PriorityQueue.ArrayStrategy = ArrayStrategy;
PriorityQueue.BinaryHeapStrategy = BinaryHeapStrategy;
PriorityQueue.BHeapStrategy = BHeapStrategy;
module.exports = PriorityQueue;
},{"./PriorityQueue/AbstractPriorityQueue":2,"./PriorityQueue/ArrayStrategy":3,"./PriorityQueue/BHeapStrategy":4,"./PriorityQueue/BinaryHeapStrategy":5}],2:[function(_dereq_,module,exports){
var AbstractPriorityQueue;
module.exports = AbstractPriorityQueue = (function() {
function AbstractPriorityQueue(options) {
var ref;
if ((options != null ? options.strategy : void 0) == null) {
throw 'Must pass options.strategy, a strategy';
}
if ((options != null ? options.comparator : void 0) == null) {
throw 'Must pass options.comparator, a comparator';
}
this.priv = new options.strategy(options);
this.length = (options != null ? (ref = options.initialValues) != null ? ref.length : void 0 : void 0) || 0;
}
AbstractPriorityQueue.prototype.queue = function(value) {
this.length++;
this.priv.queue(value);
return void 0;
};
AbstractPriorityQueue.prototype.dequeue = function(value) {
if (!this.length) {
throw 'Empty queue';
}
this.length--;
return this.priv.dequeue();
};
AbstractPriorityQueue.prototype.peek = function(value) {
if (!this.length) {
throw 'Empty queue';
}
return this.priv.peek();
};
AbstractPriorityQueue.prototype.clear = function() {
this.length = 0;
return this.priv.clear();
};
return AbstractPriorityQueue;
})();
},{}],3:[function(_dereq_,module,exports){
var ArrayStrategy, binarySearchForIndexReversed;
binarySearchForIndexReversed = function(array, value, comparator) {
var high, low, mid;
low = 0;
high = array.length;
while (low < high) {
mid = (low + high) >>> 1;
if (comparator(array[mid], value) >= 0) {
low = mid + 1;
} else {
high = mid;
}
}
return low;
};
module.exports = ArrayStrategy = (function() {
function ArrayStrategy(options) {
var ref;
this.options = options;
this.comparator = this.options.comparator;
this.data = ((ref = this.options.initialValues) != null ? ref.slice(0) : void 0) || [];
this.data.sort(this.comparator).reverse();
}
ArrayStrategy.prototype.queue = function(value) {
var pos;
pos = binarySearchForIndexReversed(this.data, value, this.comparator);
this.data.splice(pos, 0, value);
return void 0;
};
ArrayStrategy.prototype.dequeue = function() {
return this.data.pop();
};
ArrayStrategy.prototype.peek = function() {
return this.data[this.data.length - 1];
};
ArrayStrategy.prototype.clear = function() {
this.data.length = 0;
return void 0;
};
return ArrayStrategy;
})();
},{}],4:[function(_dereq_,module,exports){
var BHeapStrategy;
module.exports = BHeapStrategy = (function() {
function BHeapStrategy(options) {
var arr, i, j, k, len, ref, ref1, shift, value;
this.comparator = (options != null ? options.comparator : void 0) || function(a, b) {
return a - b;
};
this.pageSize = (options != null ? options.pageSize : void 0) || 512;
this.length = 0;
shift = 0;
while ((1 << shift) < this.pageSize) {
shift += 1;
}
if (1 << shift !== this.pageSize) {
throw 'pageSize must be a power of two';
}
this._shift = shift;
this._emptyMemoryPageTemplate = arr = [];
for (i = j = 0, ref = this.pageSize; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
arr.push(null);
}
this._memory = [];
this._mask = this.pageSize - 1;
if (options.initialValues) {
ref1 = options.initialValues;
for (k = 0, len = ref1.length; k < len; k++) {
value = ref1[k];
this.queue(value);
}
}
}
BHeapStrategy.prototype.queue = function(value) {
this.length += 1;
this._write(this.length, value);
this._bubbleUp(this.length, value);
return void 0;
};
BHeapStrategy.prototype.dequeue = function() {
var ret, val;
ret = this._read(1);
val = this._read(this.length);
this.length -= 1;
if (this.length > 0) {
this._write(1, val);
this._bubbleDown(1, val);
}
return ret;
};
BHeapStrategy.prototype.peek = function() {
return this._read(1);
};
BHeapStrategy.prototype.clear = function() {
this.length = 0;
this._memory.length = 0;
return void 0;
};
BHeapStrategy.prototype._write = function(index, value) {
var page;
page = index >> this._shift;
while (page >= this._memory.length) {
this._memory.push(this._emptyMemoryPageTemplate.slice(0));
}
return this._memory[page][index & this._mask] = value;
};
BHeapStrategy.prototype._read = function(index) {
return this._memory[index >> this._shift][index & this._mask];
};
BHeapStrategy.prototype._bubbleUp = function(index, value) {
var compare, indexInPage, parentIndex, parentValue;
compare = this.comparator;
while (index > 1) {
indexInPage = index & this._mask;
if (index < this.pageSize || indexInPage > 3) {
parentIndex = (index & ~this._mask) | (indexInPage >> 1);
} else if (indexInPage < 2) {
parentIndex = (index - this.pageSize) >> this._shift;
parentIndex += parentIndex & ~(this._mask >> 1);
parentIndex |= this.pageSize >> 1;
} else {
parentIndex = index - 2;
}
parentValue = this._read(parentIndex);
if (compare(parentValue, value) < 0) {
break;
}
this._write(parentIndex, value);
this._write(index, parentValue);
index = parentIndex;
}
return void 0;
};
BHeapStrategy.prototype._bubbleDown = function(index, value) {
var childIndex1, childIndex2, childValue1, childValue2, compare;
compare = this.comparator;
while (index < this.length) {
if (index > this._mask && !(index & (this._mask - 1))) {
childIndex1 = childIndex2 = index + 2;
} else if (index & (this.pageSize >> 1)) {
childIndex1 = (index & ~this._mask) >> 1;
childIndex1 |= index & (this._mask >> 1);
childIndex1 = (childIndex1 + 1) << this._shift;
childIndex2 = childIndex1 + 1;
} else {
childIndex1 = index + (index & this._mask);
childIndex2 = childIndex1 + 1;
}
if (childIndex1 !== childIndex2 && childIndex2 <= this.length) {
childValue1 = this._read(childIndex1);
childValue2 = this._read(childIndex2);
if (compare(childValue1, value) < 0 && compare(childValue1, childValue2) <= 0) {
this._write(childIndex1, value);
this._write(index, childValue1);
index = childIndex1;
} else if (compare(childValue2, value) < 0) {
this._write(childIndex2, value);
this._write(index, childValue2);
index = childIndex2;
} else {
break;
}
} else if (childIndex1 <= this.length) {
childValue1 = this._read(childIndex1);
if (compare(childValue1, value) < 0) {
this._write(childIndex1, value);
this._write(index, childValue1);
index = childIndex1;
} else {
break;
}
} else {
break;
}
}
return void 0;
};
return BHeapStrategy;
})();
},{}],5:[function(_dereq_,module,exports){
var BinaryHeapStrategy;
module.exports = BinaryHeapStrategy = (function() {
function BinaryHeapStrategy(options) {
var ref;
this.comparator = (options != null ? options.comparator : void 0) || function(a, b) {
return a - b;
};
this.length = 0;
this.data = ((ref = options.initialValues) != null ? ref.slice(0) : void 0) || [];
this._heapify();
}
BinaryHeapStrategy.prototype._heapify = function() {
var i, j, ref;
if (this.data.length > 0) {
for (i = j = 1, ref = this.data.length; 1 <= ref ? j < ref : j > ref; i = 1 <= ref ? ++j : --j) {
this._bubbleUp(i);
}
}
return void 0;
};
BinaryHeapStrategy.prototype.queue = function(value) {
this.data.push(value);
this._bubbleUp(this.data.length - 1);
return void 0;
};
BinaryHeapStrategy.prototype.dequeue = function() {
var last, ret;
ret = this.data[0];
last = this.data.pop();
if (this.data.length > 0) {
this.data[0] = last;
this._bubbleDown(0);
}
return ret;
};
BinaryHeapStrategy.prototype.peek = function() {
return this.data[0];
};
BinaryHeapStrategy.prototype.clear = function() {
this.length = 0;
this.data.length = 0;
return void 0;
};
BinaryHeapStrategy.prototype._bubbleUp = function(pos) {
var parent, x;
while (pos > 0) {
parent = (pos - 1) >>> 1;
if (this.comparator(this.data[pos], this.data[parent]) < 0) {
x = this.data[parent];
this.data[parent] = this.data[pos];
this.data[pos] = x;
pos = parent;
} else {
break;
}
}
return void 0;
};
BinaryHeapStrategy.prototype._bubbleDown = function(pos) {
var last, left, minIndex, right, x;
last = this.data.length - 1;
while (true) {
left = (pos << 1) + 1;
right = left + 1;
minIndex = pos;
if (left <= last && this.comparator(this.data[left], this.data[minIndex]) < 0) {
minIndex = left;
}
if (right <= last && this.comparator(this.data[right], this.data[minIndex]) < 0) {
minIndex = right;
}
if (minIndex !== pos) {
x = this.data[minIndex];
this.data[minIndex] = this.data[pos];
this.data[pos] = x;
pos = minIndex;
} else {
break;
}
}
return void 0;
};
return BinaryHeapStrategy;
})();
},{}]},{},[1])(1)
});

@ -0,0 +1,21 @@
/* If you're feeling fancy you can add interactivity
to your site with Javascript */
// prints "hi" in the browser's dev tools console
console.log("hi");
var svg = d3.select("svg");
var params = {
extent: defaultExtent,
generator: generateCoast,
npts: 1684,
ncities: 15,
nterrs: 5,
fontsizes: {
region: 40,
city: 25,
town: 20
}
}
doMap(svg, defaultParams);

File diff suppressed because it is too large Load Diff

@ -0,0 +1,37 @@
Welcome to Glitch
=================
Click `Show` in the header to see your app live. Updates to your code will instantly deploy and update live.
**Glitch** is the friendly community where you'll build the app of your dreams. Glitch lets you instantly create, remix, edit, and host an app, bot or site, and you can invite collaborators or helpers to simultaneously edit code with you.
Find out more [about Glitch](https://glitch.com/about).
Your Project
------------
### ← README.md
That's this file, where you can tell people what your cool website does and how you built it.
### ← index.html
Where you'll write the content of your website.
### ← style.css
CSS files add styling rules to your content.
### ← script.js
If you're feeling fancy you can add interactivity to your site with JavaScript.
### ← assets
Drag in `assets`, like images or music, to add them to your project
Made by [Glitch](https://glitch.com/)
-------------------
\ ゜o゜)

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hello!</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- import the webpage's stylesheet -->
<link rel="stylesheet" href="/style.css">
<!-- import the webpage's javascript file -->
<script src="script.js" defer></script>
<script src="https://d3js.org/d3.v5.js"></script>
<script src="priority-queue.js"></script>
<script src="language.js"></script>
<script src="terrain.js"></script>
<style>
path, line {
fill: none;
stroke: black;
stroke-linecap: round;
}
.field {
stroke: none;
fill-opacity: 1.0;
}
.slope {
stroke-width: 1;
}
.river {
stroke-width: 2;
}
.coast {
stroke-width: 4;
}
.border {
stroke-width: 5;
stroke-dasharray: 4,4;
stroke-linecap: butt;
}
text {
font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
color: black;
stroke: white;
stroke-width: 5;
stroke-linejoin: round;
paint-order: stroke;
}
text.region {
stroke-width:10;
font-variant: small-caps;
}
svg {
float: right;
background-color: white;
}
</style>
</head>
<body>
<svg width="1000" height="1000"></svg>
</body>
</html>

@ -0,0 +1,486 @@
function shuffled(list) {
var newlist = [];
for (var i = 0; i < list.length; i++) {
newlist.push(list[i]);
}
for (var i = list.length - 1; i > 0; i--) {
var tmp = newlist[i];
var j = randrange(i);
newlist[i] = newlist[j];
newlist[j] = tmp;
}
return newlist;
}
function choose(list, exponent) {
exponent = exponent || 1;
return list[Math.floor(Math.pow(Math.random(), exponent) * list.length)];
}
function randrange(lo, hi) {
if (hi == undefined) {
hi = lo;
lo = 0;
}
return Math.floor(Math.random() * (hi - lo)) + lo;
}
function join(list, sep) {
if (list.length == 0) return '';
sep = sep || '';
var s = list[0];
for (var i = 1; i < list.length; i++) {
s += sep;
s += list[i];
}
return s;
}
function capitalize(word) {
return word[0].toUpperCase() + word.slice(1);
}
function spell(lang, syll) {
if (lang.noortho) return syll;
var s = '';
for (var i = 0; i < syll.length; i++) {
var c = syll[i];
s += lang.cortho[c] || lang.vortho[c] || defaultOrtho[c] || c;
}
return s;
}
function makeSyllable(lang) {
while (true) {
var syll = "";
for (var i = 0; i < lang.structure.length; i++) {
var ptype = lang.structure[i];
if (lang.structure[i+1] == '?') {
i++;
if (Math.random() < 0.5) {
continue;
}
}
syll += choose(lang.phonemes[ptype], lang.exponent);
}
var bad = false;
for (var i = 0; i < lang.restricts.length; i++) {
if (lang.restricts[i].test(syll)) {
bad = true;
break;
}
}
if (bad) continue;
return spell(lang, syll);
}
}
function getMorpheme(lang, key) {
if (lang.nomorph) {
return makeSyllable(lang);
}
key = key || '';
var list = lang.morphemes[key] || [];
var extras = 10;
if (key) extras = 1;
while (true) {
var n = randrange(list.length + extras);
if (list[n]) return list[n];
var morph = makeSyllable(lang);
var bad = false;
for (var k in lang.morphemes) {
if (lang.morphemes[k].includes(morph)) {
bad = true;
break;
}
}
if (bad) continue;
list.push(morph);
lang.morphemes[key] = list;
return morph;
}
}
function makeWord(lang, key) {
var nsylls = randrange(lang.minsyll, lang.maxsyll + 1);
var w = '';
var keys = [];
keys[randrange(nsylls)] = key;
for (var i = 0; i < nsylls; i++) {
w += getMorpheme(lang, keys[i]);
}
return w;
}
function getWord(lang, key) {
key = key || '';
var ws = lang.words[key] || [];
var extras = 3;
if (key) extras = 2;
while (true) {
var n = randrange(ws.length + extras);
var w = ws[n];
if (w) {
return w;
}
w = makeWord(lang, key);
var bad = false;
for (var k in lang.words) {
if (lang.words[k].includes(w)) {
bad = true;
break;
}
}
if (bad) continue;
ws.push(w);
lang.words[key] = ws;
return w;
}
}
function makeName(lang, key) {
key = key || '';
lang.genitive = lang.genitive || getMorpheme(lang, 'of');
lang.definite = lang.definite || getMorpheme(lang, 'the');
while (true) {
var name = null;
if (Math.random() < 0.5) {
name = capitalize(getWord(lang, key));
} else {
var w1 = capitalize(getWord(lang, Math.random() < 0.6 ? key : ''));
var w2 = capitalize(getWord(lang, Math.random() < 0.6 ? key : ''));
if (w1 == w2) continue;
if (Math.random() > 0.5) {
name = join([w1, w2], lang.joiner);
} else {
name = join([w1, lang.genitive, w2], lang.joiner);
}
}
if (Math.random() < 0.1) {
name = join([lang.definite, name], lang.joiner);
}
if ((name.length < lang.minchar) || (name.length > lang.maxchar)) continue;
var used = false;
for (var i = 0; i < lang.names.length; i++) {
var name2 = lang.names[i];
if ((name.indexOf(name2) != -1) || (name2.indexOf(name) != -1)) {
used = true;
break;
}
}
if (used) continue;
lang.names.push(name);
return name;
}
}
function makeBasicLanguage() {
return {
phonemes: {
C: "ptkmnls",
V: "aeiou",
S: "s",
F: "mn",
L: "rl"
},
structure: "CVC",
exponent: 2,
restricts: [],
cortho: {},
vortho: {},
noortho: true,
nomorph: true,
nowordpool: true,
minsyll: 1,
maxsyll: 1,
morphemes: {},
words: {},
names: [],
joiner: ' ',
maxchar: 12,
minchar: 5
};
}
function makeOrthoLanguage() {
var lang = makeBasicLanguage();
lang.noortho = false;
return lang;
}
function makeRandomLanguage() {
var lang = makeBasicLanguage();
lang.noortho = false;
lang.nomorph = false;
lang.nowordpool = false;
lang.phonemes.C = shuffled(choose(consets, 2).C);
lang.phonemes.V = shuffled(choose(vowsets, 2).V);
lang.phonemes.L = shuffled(choose(lsets, 2).L);
lang.phonemes.S = shuffled(choose(ssets, 2).S);
lang.phonemes.F = shuffled(choose(fsets, 2).F);
lang.structure = choose(syllstructs);
lang.restricts = ressets[2].res;
lang.cortho = choose(corthsets, 2).orth;
lang.vortho = choose(vorthsets, 2).orth;
lang.minsyll = randrange(1, 3);
if (lang.structure.length < 3) lang.minsyll++;
lang.maxsyll = randrange(lang.minsyll + 1, 7);
lang.joiner = choose(' -');
return lang;
}
var defaultOrtho = {
'ʃ': 'sh',
'ʒ': 'zh',
'ʧ': 'ch',
'ʤ': 'j',
'ŋ': 'ng',
'j': 'y',
'x': 'kh',
'ɣ': 'gh',
'ʔ': '',
A: "á",
E: "é",
I: "í",
O: "ó",
U: "ú"
};
var corthsets = [
{
name: "Default",
orth: {}
},
{
name: "Slavic",
orth: {
'ʃ': 'š',
'ʒ': 'ž',
'ʧ': 'č',
'ʤ': 'ǧ',
'j': 'j'
}
},
{
name: "German",
orth: {
'ʃ': 'sch',
'ʒ': 'zh',
'ʧ': 'tsch',
'ʤ': 'dz',
'j': 'j',
'x': 'ch'
}
},
{
name: "French",
orth: {
'ʃ': 'ch',
'ʒ': 'j',
'ʧ': 'tch',
'ʤ': 'dj',
'x': 'kh'
}
},
{
name: "Chinese (pinyin)",
orth: {
'ʃ': 'x',
'ʧ': 'q',
'ʤ': 'j',
}
}
];
var vorthsets = [
{
name: "Ácutes",
orth: {}
},
{
name: "Ümlauts",
orth: {
A: "ä",
E: "ë",
I: "ï",
O: "ö",
U: "ü"
}
},
{
name: "Welsh",
orth: {
A: "â",
E: "ê",
I: "y",
O: "ô",
U: "w"
}
},
{
name: "Diphthongs",
orth: {
A: "au",
E: "ei",
I: "ie",
O: "ou",
U: "oo"
}
},
{
name: "Doubles",
orth: {
A: "aa",
E: "ee",
I: "ii",
O: "oo",
U: "uu"
}
}
];
var consets = [
{
name: "Minimal",
C: "ptkmnls"
},
{
name: "English-ish",
C: "ptkbdgmnlrsʃzʒʧ"
},
{
name: "Pirahã (very simple)",
C: "ptkmnh"
},
{
name: "Hawaiian-ish",
C: "hklmnpwʔ"
},
{
name: "Greenlandic-ish",
C: "ptkqvsgrmnŋlj"
},
{
name: "Arabic-ish",
C: "tksʃdbqɣxmnlrwj"
},
{
name: "Arabic-lite",
C: "tkdgmnsʃ"
},
{
name: "English-lite",
C: "ptkbdgmnszʒʧhjw"
}
];
var ssets = [
{
name: "Just s",
S: "s"
},
{
name: "s ʃ",
S: "sʃ"
},
{
name: "s ʃ f",
S: "sʃf"
}
];
var lsets = [
{
name: "r l",
L: "rl"
},
{
name: "Just r",
L: "r"
},
{
name: "Just l",
L: "l"
},
{
name: "w j",
L: "wj"
},
{
name: "r l w j",
L: "rlwj"
}
];
var fsets = [
{
name: "m n",
F: "mn"
},
{
name: "s k",
F: "sk"
},
{
name: "m n ŋ",
F: "mnŋ"
},
{
name: "s ʃ z ʒ",
F: "sʃzʒ"
}
];
var vowsets = [
{
name: "Standard 5-vowel",
V: "aeiou"
},
{
name: "3-vowel a i u",
V: "aiu"
},
{
name: "Extra A E I",
V: "aeiouAEI"
},
{
name: "Extra U",
V: "aeiouU"
},
{
name: "5-vowel a i u A I",
V: "aiuAI"
},
{
name: "3-vowel e o u",
V: "eou"
},
{
name: "Extra A O U",
V: "aeiouAOU"
}
];
var syllstructs = [
"CVC",
"CVV?C",
"CVVC?", "CVC?", "CV", "VC", "CVF", "C?VC", "CVF?",
"CL?VC", "CL?VF", "S?CVC", "S?CVF", "S?CVC?",
"C?VF", "C?VC?", "C?VF?", "C?L?VC", "VC",
"CVL?C?", "C?VL?C", "C?VLC?"];
var ressets = [
{
name: "None",
res: []
},
{
name: "Double sounds",
res: [/(.)\1/]
},
{
name: "Doubles and hard clusters",
res: [/[sʃf][sʃ]/, /(.)\1/, /[rl][rl]/]
}
];

@ -0,0 +1,387 @@
(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.PriorityQueue = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
var AbstractPriorityQueue, ArrayStrategy, BHeapStrategy, BinaryHeapStrategy, PriorityQueue,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
AbstractPriorityQueue = _dereq_('./PriorityQueue/AbstractPriorityQueue');
ArrayStrategy = _dereq_('./PriorityQueue/ArrayStrategy');
BinaryHeapStrategy = _dereq_('./PriorityQueue/BinaryHeapStrategy');
BHeapStrategy = _dereq_('./PriorityQueue/BHeapStrategy');
PriorityQueue = (function(superClass) {
extend(PriorityQueue, superClass);
function PriorityQueue(options) {
options || (options = {});
options.strategy || (options.strategy = BinaryHeapStrategy);
options.comparator || (options.comparator = function(a, b) {
return (a || 0) - (b || 0);
});
PriorityQueue.__super__.constructor.call(this, options);
}
return PriorityQueue;
})(AbstractPriorityQueue);
PriorityQueue.ArrayStrategy = ArrayStrategy;
PriorityQueue.BinaryHeapStrategy = BinaryHeapStrategy;
PriorityQueue.BHeapStrategy = BHeapStrategy;
module.exports = PriorityQueue;
},{"./PriorityQueue/AbstractPriorityQueue":2,"./PriorityQueue/ArrayStrategy":3,"./PriorityQueue/BHeapStrategy":4,"./PriorityQueue/BinaryHeapStrategy":5}],2:[function(_dereq_,module,exports){
var AbstractPriorityQueue;
module.exports = AbstractPriorityQueue = (function() {
function AbstractPriorityQueue(options) {
var ref;
if ((options != null ? options.strategy : void 0) == null) {
throw 'Must pass options.strategy, a strategy';
}
if ((options != null ? options.comparator : void 0) == null) {
throw 'Must pass options.comparator, a comparator';
}
this.priv = new options.strategy(options);
this.length = (options != null ? (ref = options.initialValues) != null ? ref.length : void 0 : void 0) || 0;
}
AbstractPriorityQueue.prototype.queue = function(value) {
this.length++;
this.priv.queue(value);
return void 0;
};
AbstractPriorityQueue.prototype.dequeue = function(value) {
if (!this.length) {
throw 'Empty queue';
}
this.length--;
return this.priv.dequeue();
};
AbstractPriorityQueue.prototype.peek = function(value) {
if (!this.length) {
throw 'Empty queue';
}
return this.priv.peek();
};
AbstractPriorityQueue.prototype.clear = function() {
this.length = 0;
return this.priv.clear();
};
return AbstractPriorityQueue;
})();
},{}],3:[function(_dereq_,module,exports){
var ArrayStrategy, binarySearchForIndexReversed;
binarySearchForIndexReversed = function(array, value, comparator) {
var high, low, mid;
low = 0;
high = array.length;
while (low < high) {
mid = (low + high) >>> 1;
if (comparator(array[mid], value) >= 0) {
low = mid + 1;
} else {
high = mid;
}
}
return low;
};
module.exports = ArrayStrategy = (function() {
function ArrayStrategy(options) {
var ref;
this.options = options;
this.comparator = this.options.comparator;
this.data = ((ref = this.options.initialValues) != null ? ref.slice(0) : void 0) || [];
this.data.sort(this.comparator).reverse();
}
ArrayStrategy.prototype.queue = function(value) {
var pos;
pos = binarySearchForIndexReversed(this.data, value, this.comparator);
this.data.splice(pos, 0, value);
return void 0;
};
ArrayStrategy.prototype.dequeue = function() {
return this.data.pop();
};
ArrayStrategy.prototype.peek = function() {
return this.data[this.data.length - 1];
};
ArrayStrategy.prototype.clear = function() {
this.data.length = 0;
return void 0;
};
return ArrayStrategy;
})();
},{}],4:[function(_dereq_,module,exports){
var BHeapStrategy;
module.exports = BHeapStrategy = (function() {
function BHeapStrategy(options) {
var arr, i, j, k, len, ref, ref1, shift, value;
this.comparator = (options != null ? options.comparator : void 0) || function(a, b) {
return a - b;
};
this.pageSize = (options != null ? options.pageSize : void 0) || 512;
this.length = 0;
shift = 0;
while ((1 << shift) < this.pageSize) {
shift += 1;
}
if (1 << shift !== this.pageSize) {
throw 'pageSize must be a power of two';
}
this._shift = shift;
this._emptyMemoryPageTemplate = arr = [];
for (i = j = 0, ref = this.pageSize; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
arr.push(null);
}
this._memory = [];
this._mask = this.pageSize - 1;
if (options.initialValues) {
ref1 = options.initialValues;
for (k = 0, len = ref1.length; k < len; k++) {
value = ref1[k];
this.queue(value);
}
}
}
BHeapStrategy.prototype.queue = function(value) {
this.length += 1;
this._write(this.length, value);
this._bubbleUp(this.length, value);
return void 0;
};
BHeapStrategy.prototype.dequeue = function() {
var ret, val;
ret = this._read(1);
val = this._read(this.length);
this.length -= 1;
if (this.length > 0) {
this._write(1, val);
this._bubbleDown(1, val);
}
return ret;
};
BHeapStrategy.prototype.peek = function() {
return this._read(1);
};
BHeapStrategy.prototype.clear = function() {
this.length = 0;
this._memory.length = 0;
return void 0;
};
BHeapStrategy.prototype._write = function(index, value) {
var page;
page = index >> this._shift;
while (page >= this._memory.length) {
this._memory.push(this._emptyMemoryPageTemplate.slice(0));
}
return this._memory[page][index & this._mask] = value;
};
BHeapStrategy.prototype._read = function(index) {
return this._memory[index >> this._shift][index & this._mask];
};
BHeapStrategy.prototype._bubbleUp = function(index, value) {
var compare, indexInPage, parentIndex, parentValue;
compare = this.comparator;
while (index > 1) {
indexInPage = index & this._mask;
if (index < this.pageSize || indexInPage > 3) {
parentIndex = (index & ~this._mask) | (indexInPage >> 1);
} else if (indexInPage < 2) {
parentIndex = (index - this.pageSize) >> this._shift;
parentIndex += parentIndex & ~(this._mask >> 1);
parentIndex |= this.pageSize >> 1;
} else {
parentIndex = index - 2;
}
parentValue = this._read(parentIndex);
if (compare(parentValue, value) < 0) {
break;
}
this._write(parentIndex, value);
this._write(index, parentValue);
index = parentIndex;
}
return void 0;
};
BHeapStrategy.prototype._bubbleDown = function(index, value) {
var childIndex1, childIndex2, childValue1, childValue2, compare;
compare = this.comparator;
while (index < this.length) {
if (index > this._mask && !(index & (this._mask - 1))) {
childIndex1 = childIndex2 = index + 2;
} else if (index & (this.pageSize >> 1)) {
childIndex1 = (index & ~this._mask) >> 1;
childIndex1 |= index & (this._mask >> 1);
childIndex1 = (childIndex1 + 1) << this._shift;
childIndex2 = childIndex1 + 1;
} else {
childIndex1 = index + (index & this._mask);
childIndex2 = childIndex1 + 1;
}
if (childIndex1 !== childIndex2 && childIndex2 <= this.length) {
childValue1 = this._read(childIndex1);
childValue2 = this._read(childIndex2);
if (compare(childValue1, value) < 0 && compare(childValue1, childValue2) <= 0) {
this._write(childIndex1, value);
this._write(index, childValue1);
index = childIndex1;
} else if (compare(childValue2, value) < 0) {
this._write(childIndex2, value);
this._write(index, childValue2);
index = childIndex2;
} else {
break;
}
} else if (childIndex1 <= this.length) {
childValue1 = this._read(childIndex1);
if (compare(childValue1, value) < 0) {
this._write(childIndex1, value);
this._write(index, childValue1);
index = childIndex1;
} else {
break;
}
} else {
break;
}
}
return void 0;
};
return BHeapStrategy;
})();
},{}],5:[function(_dereq_,module,exports){
var BinaryHeapStrategy;
module.exports = BinaryHeapStrategy = (function() {
function BinaryHeapStrategy(options) {
var ref;
this.comparator = (options != null ? options.comparator : void 0) || function(a, b) {
return a - b;
};
this.length = 0;
this.data = ((ref = options.initialValues) != null ? ref.slice(0) : void 0) || [];
this._heapify();
}
BinaryHeapStrategy.prototype._heapify = function() {
var i, j, ref;
if (this.data.length > 0) {
for (i = j = 1, ref = this.data.length; 1 <= ref ? j < ref : j > ref; i = 1 <= ref ? ++j : --j) {
this._bubbleUp(i);
}
}
return void 0;
};
BinaryHeapStrategy.prototype.queue = function(value) {
this.data.push(value);
this._bubbleUp(this.data.length - 1);
return void 0;
};
BinaryHeapStrategy.prototype.dequeue = function() {
var last, ret;
ret = this.data[0];
last = this.data.pop();
if (this.data.length > 0) {
this.data[0] = last;
this._bubbleDown(0);
}
return ret;
};
BinaryHeapStrategy.prototype.peek = function() {
return this.data[0];
};
BinaryHeapStrategy.prototype.clear = function() {
this.length = 0;
this.data.length = 0;
return void 0;
};
BinaryHeapStrategy.prototype._bubbleUp = function(pos) {
var parent, x;
while (pos > 0) {
parent = (pos - 1) >>> 1;
if (this.comparator(this.data[pos], this.data[parent]) < 0) {
x = this.data[parent];
this.data[parent] = this.data[pos];
this.data[pos] = x;
pos = parent;
} else {
break;
}
}
return void 0;
};
BinaryHeapStrategy.prototype._bubbleDown = function(pos) {
var last, left, minIndex, right, x;
last = this.data.length - 1;
while (true) {
left = (pos << 1) + 1;
right = left + 1;
minIndex = pos;
if (left <= last && this.comparator(this.data[left], this.data[minIndex]) < 0) {
minIndex = left;
}
if (right <= last && this.comparator(this.data[right], this.data[minIndex]) < 0) {
minIndex = right;
}
if (minIndex !== pos) {
x = this.data[minIndex];
this.data[minIndex] = this.data[pos];
this.data[pos] = x;
pos = minIndex;
} else {
break;
}
}
return void 0;
};
return BinaryHeapStrategy;
})();
},{}]},{},[1])(1)
});

@ -0,0 +1,21 @@
/* If you're feeling fancy you can add interactivity
to your site with Javascript */
// prints "hi" in the browser's dev tools console
console.log("hi");
var svg = d3.select("svg");
var params = {
extent: defaultExtent,
generator: generateCoast,
npts: 1684,
ncities: 15,
nterrs: 5,
fontsizes: {
region: 40,
city: 25,
town: 20
}
}
doMap(svg, defaultParams);

@ -0,0 +1,11 @@
/* CSS files add styling rules to your content */
body {
font-family: helvetica, arial, sans-serif;
margin: 2em;
}
h1 {
font-style: italic;
color: #373fff;
}

File diff suppressed because it is too large Load Diff

@ -1,16 +1,17 @@
body{ font-family: "Lucida Console", Monaco, monospace; text-align: center;} body{ font-family: "Lucida Console", Monaco, monospace;
overflow: hidden;}
p { font-size: 20px; } p { font-size: 20px; }
a{ text-decoration: none; } a{ text-decoration: none; }
#space-time{ #space-time{
z-index: 101;
position: relative; position: relative;
width: 600px; width: 600px;
height: 500px; height: 500px;
margin-left: auto; top: 1158px;
margin-right: auto; left: 853px;
margin-top: 160px;
} }
#ilinx{ #ilinx{
@ -48,7 +49,7 @@ top: 420px;
} }
a.island:link{color:white;} a.island:link{color:blue;}
a.island:hover{color: red; a.island:hover{color: red;
-webkit-animation: breathe 3s linear infinite; -webkit-animation: breathe 3s linear infinite;
-moz-animation: breathe 3s linear infinite; -moz-animation: breathe 3s linear infinite;
@ -56,7 +57,7 @@ a.island:hover{color: red;
-o-animation: breathe 3s linear infinite; -o-animation: breathe 3s linear infinite;
animation: breathe 3s linear infinite; animation: breathe 3s linear infinite;
} }
a.island:visited{color: white;} a.island:visited{color: black;}
#lemuria { #lemuria {
position: absolute; position: absolute;
@ -85,6 +86,90 @@ a.island:visited{color: white;}
top:322px; top:322px;
} }
#sea {
position: relative;
width: 2500px;
height: 2500px;
border-style: dotted;
border-width: 2px;
top: -990px;
left: -145px;
background-image: url('./img/grid3.png');
background-repeat: repeat;
}
#iper{
position: relative;
left: -27px;
top: -47px;
}
#m {
position: relative;
left: -632px;
top: -48px;
}
#thl{
position: relative;
left: -30px;
top: -38px;
}
#lmr{
position: relative;
left: -532px;
top: -28px;
}
/* SVG */
text {
font-family: "Lucida Console", Monaco, monospace;
color: black;
stroke: white;
stroke-width: 6;
stroke-linejoin: round;
paint-order: stroke;
}
text.region {
stroke-width:6;
font-variant: small-caps;
}
svg {
float: right;
}
path, line {
fill: none;
stroke: black;
stroke-linecap: round;
}
.field {
stroke: none;
fill-opacity: 1.0;
}
.slope {
stroke-width: 1;
}
.river {
stroke-width: 2;
}
.coast {
stroke-width: 4;
}
.border {
stroke-width: 5;
stroke-dasharray: 4,4;
stroke-linecap: butt;
}

@ -0,0 +1,38 @@
# Notes project
* develop symbology
** spiral
** island symbols, calendar (arrow, monkey, mu, fish)
** mayan (ah pook is here)
** aoe (owl of athena)
** labyrinth acephale
** mystical object kant
* cosmic owl & hypnotoad
* (c(i(a(o()))))
* noving with audio (or others)
* objects of the space made physical
----------- list cities
* THULE
castalia
phantom group related to some philosopher I dont remember
* HYPERBOREA
* LEMURIA
* MU
Miskatonic virtual university
-----others
* reverse mimesis
* Burroughs biblio ccru
** Ah Pook is Here
Loading…
Cancel
Save