about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorelioat <hi@eli.li>2023-12-30 16:32:09 -0500
committerelioat <hi@eli.li>2023-12-30 16:32:09 -0500
commit619383d6bcf717444d042b099e7cc534e55a96b8 (patch)
tree08834e3b95cdb6673c6798d37bf39aff7acbaae7
parentc65877874732ba263f7dfc5eec6368af2a85cc41 (diff)
downloadtour-619383d6bcf717444d042b099e7cc534e55a96b8.tar.gz
*
-rw-r--r--js/bird-words/beak.js13
-rw-r--r--js/bird-words/script.txt1
2 files changed, 8 insertions, 6 deletions
diff --git a/js/bird-words/beak.js b/js/bird-words/beak.js
index a87bc0d..eca0067 100644
--- a/js/bird-words/beak.js
+++ b/js/bird-words/beak.js
@@ -72,10 +72,11 @@ const fillGaps = (script, nouns, adjectives, places, markovChain, pairs) => {
     }).join('');
 };
 
-const script = 'The @NOUN@ of @ADJECTIVE@ @NOUN@ was found in @PLACE@ where there was a partial inscription that read, @MARKOV 22@';
+const scriptFile = process.argv[2];
 
-// example of how to use fillGaps to generate a story
-console.log(wrap(prettyItUp(fillGaps(script, nouns, adjectives, places, markovChain, pairs)), 40));
-
-// example of how to just use markov chain to generate a story
-console.log(wrap(prettyItUp(story), 40));
\ No newline at end of file
+if (!scriptFile) {
+    console.log(wrap(prettyItUp(story), 40));
+} else {
+    const script = fs.readFileSync(scriptFile, 'utf8');
+    console.log(wrap(prettyItUp(fillGaps(script, nouns, adjectives, places, markovChain, pairs)), 40));
+}
\ No newline at end of file
diff --git a/js/bird-words/script.txt b/js/bird-words/script.txt
new file mode 100644
index 0000000..e3e4105
--- /dev/null
+++ b/js/bird-words/script.txt
@@ -0,0 +1 @@
+The @NOUN@ of @ADJECTIVE@ @NOUN@ was found in @PLACE@ where there was a partial inscription that read, @MARKOV 22@
\ No newline at end of file