diff options
author | elioat <hi@eli.li> | 2023-12-30 16:32:09 -0500 |
---|---|---|
committer | elioat <hi@eli.li> | 2023-12-30 16:32:09 -0500 |
commit | 619383d6bcf717444d042b099e7cc534e55a96b8 (patch) | |
tree | 08834e3b95cdb6673c6798d37bf39aff7acbaae7 /js/bird-words | |
parent | c65877874732ba263f7dfc5eec6368af2a85cc41 (diff) | |
download | tour-619383d6bcf717444d042b099e7cc534e55a96b8.tar.gz |
*
Diffstat (limited to 'js/bird-words')
-rw-r--r-- | js/bird-words/beak.js | 13 | ||||
-rw-r--r-- | js/bird-words/script.txt | 1 |
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 |