about summary refs log tree commit diff stats
path: root/js
diff options
context:
space:
mode:
authorelioat <hi@eli.li>2023-12-30 11:18:19 -0500
committerelioat <hi@eli.li>2023-12-30 11:18:19 -0500
commitbb9e44f9ec52bc14c7547da861ba3ae9bf9ab632 (patch)
tree6a8532b9c0b129a831e41f2d9e6512ccf74e3d67 /js
parent098ec8c6104086f3c5e18e6903e2c5e59c3b8bba (diff)
downloadtour-bb9e44f9ec52bc14c7547da861ba3ae9bf9ab632.tar.gz
*
Diffstat (limited to 'js')
-rw-r--r--js/bird-words/adjectives.txt72
-rw-r--r--js/bird-words/beak.js36
-rw-r--r--js/bird-words/nouns.txt6
-rw-r--r--js/bird-words/places.txt4
4 files changed, 117 insertions, 1 deletions
diff --git a/js/bird-words/adjectives.txt b/js/bird-words/adjectives.txt
new file mode 100644
index 0000000..d046fd1
--- /dev/null
+++ b/js/bird-words/adjectives.txt
@@ -0,0 +1,72 @@
+adorable
+adventurous
+aggressive
+agreeable
+alert
+alive
+amused
+angry
+annoyed
+annoying
+anxious
+arrogant
+ashamed
+attractive
+average
+awful
+bad
+beautiful
+better
+bewildered
+black
+bloody
+blue
+blue-eyed
+blushing
+bored
+brainy
+brave
+breakable
+bright
+busy
+calm
+careful
+cautious
+charming
+cheerful
+clean
+clear
+clever
+cloudy
+clumsy
+colorful
+combative
+comfortable
+concerned
+condemned
+confused
+cooperative
+courageous
+crazy
+creepy
+crowded
+cruel
+curious
+cute
+dangerous
+dark
+dead
+defeated
+defiant
+delightful
+depressed
+determined
+different
+difficult
+disgusted
+distinct
+disturbed
+dizzy
+doubtful
+drab
+dul
\ No newline at end of file
diff --git a/js/bird-words/beak.js b/js/bird-words/beak.js
index 38a2584..12c6a79 100644
--- a/js/bird-words/beak.js
+++ b/js/bird-words/beak.js
@@ -43,4 +43,38 @@ for (let i = 0; i < storyLength; i++) {
     story += " " + randomPair.split(' ')[1];
 }
 
-console.log(wrap(prettyItUp(story), 40));
+// console.log(wrap(prettyItUp(story), 40));
+
+
+
+let nouns = fs.readFileSync('nouns.txt', 'utf8').split('\n');
+let adjectives = fs.readFileSync('adjectives.txt', 'utf8').split('\n');
+let places = fs.readFileSync('places.txt', 'utf8').split('\n');
+
+function fillGaps(script) {
+    let parts = script.split('@');
+    for (let i = 0; i < parts.length; i++) {
+        if (parts[i].startsWith('NOUN')) {
+            parts[i] = nouns[Math.floor(Math.random() * nouns.length)];
+        } else if (parts[i].startsWith('ADJECTIVE')) {
+            parts[i] = adjectives[Math.floor(Math.random() * adjectives.length)];
+        } else if (parts[i].startsWith('PLACE')) {
+            parts[i] = places[Math.floor(Math.random() * places.length)];
+        } else if (parts[i].startsWith('MARKOV')) {
+            let length = parseInt(parts[i].split(' ')[1]);
+            let chain = '';
+            let pair = pairs[Math.floor(Math.random() * pairs.length)];
+            for (let j = 0; j < length; j++) {
+                let nextWords = markovChain.get(pair);
+                let nextWord = nextWords[Math.floor(Math.random() * nextWords.length)];
+                chain += ' ' + nextWord;
+                pair = pair.split(' ')[1] + ' ' + nextWord;
+            }
+            parts[i] = chain;
+        }
+    }
+    return parts.join('');
+}
+
+let script = 'The @NOUN@ of @ADJECTIVE@ @NOUN@ was found in @PLACE@, where there was a partial inscription that read, @MARKOV 22@';
+console.log(fillGaps(script));
\ No newline at end of file
diff --git a/js/bird-words/nouns.txt b/js/bird-words/nouns.txt
new file mode 100644
index 0000000..e08fe98
--- /dev/null
+++ b/js/bird-words/nouns.txt
@@ -0,0 +1,6 @@
+Banana
+Rocket ship
+Tyrannosaurus Rex
+Wheel
+Lambda
+Gord
\ No newline at end of file
diff --git a/js/bird-words/places.txt b/js/bird-words/places.txt
new file mode 100644
index 0000000..7433bde
--- /dev/null
+++ b/js/bird-words/places.txt
@@ -0,0 +1,4 @@
+outer space
+grey citadel
+tokyo
+desert canyon
\ No newline at end of file