{"id":4804,"date":"2019-11-16T18:47:27","date_gmt":"2019-11-16T23:47:27","guid":{"rendered":"https:\/\/nickm.com\/post\/?p=4804"},"modified":"2019-11-16T18:50:38","modified_gmt":"2019-11-16T23:50:38","slug":"nano-nanogenmo-or-nnngm","status":"publish","type":"post","link":"https:\/\/nickm.com\/post\/2019\/11\/nano-nanogenmo-or-nnngm\/","title":{"rendered":"Nano-NaNoGenMo or #NNNGM"},"content":{"rendered":"<blockquote><p>Ah, distinctly I remember it was in the bleak November;<br \/>\nAnd each separate bit and pixel wrought a novel on GitHub.<\/p><\/blockquote>\n<p>April may be the cruelest month, and now the month associated with poetry, but November is the month associated with novel-writing, via NaNoWriMo, National Novel Writing Month. Now, thanks to an offhand comment by Darius Kazemi and the work of Hugo van Kemenade, November is also associated with the computer-generation of novels, broadly speaking. Any computer program and its 50,000 word+ output qualifies as an entry in <a href=\"https:\/\/nanogenmo.github.io\/\">NaNoGenMo, National Novel Generation Month.<\/a><\/p>\n<p>NaNoGenMo does have a sort of barrier to entry: People often think they have to do something elaborate, despite anyone being explicitly allowed to produce a novel consisting <a href=\"https:\/\/github.com\/hugovk\/meow.py\">entirely of meows.<\/a> Those new to NaNoGenMo may look up to, for instance, the amazingly talented Ross Goodwin. In his own attempt to further climate change, he decided to code up <a href=\"https:\/\/github.com\/NaNoGenMo\/2019\/issues\/46\">an energy-intensive GPT-2 text generator <i>while flying on a commercial jet.<\/i><\/a> You\u2019d think that for his next trick this guy might hop in a car, take a road trip, and generate a novel using a LSTM RNN! Those who look up so such efforts \u2014 and it\u2019s hard not to, when they\u2019re conducted at 30,000 feet and also quite clever \u2014 might end up thinking that computer-generated novels <i>must<\/i> use complex code and masses of data.<\/p>\n<p>And yet, there is so much that can be done with simple programs that consume very little energy and can be fully understood by their programmers and others.<\/p>\n<p>Because of this, I have recently announced Nano-NaNoGenMo. On Mastodon and Twitter (using #NNNGM) I have declared that November will <i>also<\/i> be the month in which people write computer programs that are at most 256 characters, and which generate 50,000 word or more novels. These can use Project Gutenberg files, as they are named on that site, as input. Or, they can run without using any input.<\/p>\n<p>I have produced three Nano-NaNoGenMo (or #NNNGM) entries for 2019. In addition to being not very taxing computationally, one of these happens to have been written on an extremely energy-efficient electric train. Here they are. I won&#8217;t gloss each one, but I will provide a few comments on each, along with the <i>full code<\/i> for you to look at right in this blog post, and with <i>links<\/i> to both bash shell script files and the final output.<\/p>\n<h3 id=\"ob-dck\">OB-DCK; or, THE (SELFLESS) WHALE<\/h3>\n<p><code><br \/>\nperl -0pe 's\/.<em>?K\/**<\/em><em>\/s;s\/MOBY(.)DI\/OB$1D\/g;s\/D.<\/em>r\/Nick Montfort\/;s\/E W\/E (SELFLESS) W\/g;s\/\\b(I ?|me|my|myself|am|us|we|our|ourselves)\\b\/\/gi;s\/\\r\\n\\r\\n\/<\/code><code>\/g;s\/\\r\\n\/ \/g;s\/<\/code>\/\\n\\n\/g;s\/ +\/ \/g;s\/(&#8220;?) ([,.;:]?)\/$1$2\/g;s\/\\nEnd .\/\/s&#8217; 2701-0.txt #NNNGM<\/p>\n<p><b>WordPress has mangled this code despite it being in a code element; Use the following link to obtain a runnable version of it:<\/b><\/p>\n<p><a href=\"https:\/\/nickm.com\/code\/ob-dck.sh\"><i>OB-DCK; or, THE (SELFLESS) WHALE<\/i> code<\/a><\/p>\n<p><a href=\"https:\/\/nickm.com\/poems\/ob-dck.txt\"><i>OB DCK; or, THE (SELFLESS) WHALE,<\/i> the novel<\/a><\/p>\n<p>The program, performing a simple regular expression substitution, removes all first-person pronouns from <i>Moby-Dick.<\/i> Indeed, <i>OB-DCK<\/i> is \u201cMOBY-DICK\u201d with \u201cMY\u201d removed from MOBY and \u201cI\u201d from DICK. Chapter 1 begins:<\/p>\n<blockquote><p>Call Ishmael. Some years ago\u2014never mind how long precisely\u2014having little or no money in purse, and nothing particular to interest on shore, thought would sail about a little and see the watery part of the world. It is a way have of driving off the spleen and regulating the circulation. Whenever find growing grim about the mouth; whenever it is a damp, drizzly November in soul; whenever find involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral meet; and especially whenever hypos get such an upper hand of , that it requires a strong moral principle to prevent from deliberately stepping into the street, and methodically knocking people\u2019s hats off\u2014then, account it high time to get to sea as soon as can. This is substitute for pistol and ball. With a philosophical flourish Cato throws himself upon his sword; quietly take to the ship. There is nothing surprising in this. If they but knew it, almost all men in their degree, some time or other, cherish very nearly the same feelings towards the ocean with .<\/p><\/blockquote>\n<p>Because Ishmael is removed as the \u201cI\u201d of the story, on a <i>grammatical<\/i> level there is (spoiler alert!) no human at all left at the end of book.<\/p>\n<h3 id=\"consequence\">consequence<\/h3>\n<p><code><br \/>\nperl -e 'sub n{(unpack\"(A4)*\",\"backbodybookcasedoorfacefacthandheadhomelifenamepartplayroomsidetimeweekwordworkyear\")[rand 21]}print\"consequence\\nNick Montfort\\n\\na beginning\";for(;$i&lt;12500;$i++){print\" &amp; so a \".n;if(rand()&lt;.6){print n}}print\".\\n\"' #NNNGM<br \/>\n<\/code><\/p>\n<p><a href=\"https:\/\/nickm.com\/code\/consequence.sh\"><i>consequence<\/i> code<\/a><\/p>\n<p><a href=\"https:\/\/nickm.com\/poems\/consequence.txt\"><i>consequence,<\/i> the novel<\/a><\/p>\n<p>Using compounding of the sort found in my computer-generated long poem <a href=\"http:\/\/counterpathpress.org\/the-truelist-nick-montfort\"><i>The Truelist<\/i><\/a> and my <a href=\"https:\/\/nickm.com\/poems\/ppg256.html\">\u201cppg 256-3,\u201d<\/a> this presents a sequence of things \u2014 sometimes formed from a single very common four-letter word, sometimes from two combined \u2014 that, it is stated, somehow follow from each other:<\/p>\n<blockquote><p>a beginning &amp; so a name &amp; so a fact &amp; so a case &amp; so a bookdoor &amp; so a head &amp; so a factwork &amp; so a sidelife &amp; so a door &amp; so a door &amp; so a factback &amp; so a backplay &amp; so a name &amp; so a facebook &amp; so a lifecase &amp; so a partpart &amp; so a hand &amp; so a bookname &amp; so a face &amp; so a homeyear &amp; so a bookfact &amp; so a book &amp; so a hand &amp; so a head &amp; so a headhead &amp; so a book &amp; so a face &amp; so a namename &amp; so a life &amp; so a hand &amp; so a side &amp; so a time &amp; so a yearname &amp; so a backface &amp; so a headface &amp; so a headweek &amp; so a headside &amp; so a bookface &amp; so a bookhome &amp; so a lifedoor &amp; so a bookyear &amp; so a workback &amp; so a room &amp; so a face &amp; so a body &amp; so a faceweek &amp; so a sidecase &amp; so a time &amp; so a body &amp; so a fact [&#8230;]<\/p><\/blockquote>\n<h3 id=\"too_much_help\">Too Much Help at Once<\/h3>\n<p><code><br \/>\npython -c \"help('topics')\" | python -c \"import sys;print('Too Much Help at Once\\nNick Montfort');[i for i in sorted(''.join(sys.stdin.readlines()[3:]).split()) if print('\\n'+i+'\\n') or help(i)]\" #NNNGM<br \/>\n<\/code><\/p>\n<p><a href=\"https:\/\/nickm.com\/code\/too_much_help.sh\"><i>Too Much Help at Once<\/i> code<\/a><\/p>\n<p><a href=\"https:\/\/nickm.com\/poems\/too_much_help.txt\"><i>Too Much Help at Once,<\/i> the novel<\/a><\/p>\n<p>The program looks up all the help topics provided within the (usually interactive) help system inside Python itself. Then, it asks for help on <i>everything,<\/i> in alphabetical order, producing 70k+ words of text, according the GNU utility wc. The novel that results is, of course, an appropriation of text others have written; it arranges but doesn\u2019t even transform that text. To me, however, it does have some meaning. <i>Too Much Help at Once<\/i> models one classic mistake that beginning programmers can make: Thinking that it\u2019s somehow useful to read comprehensively about programming, or about a programming language, rather than actually using that programming language and writing some programs. Here\u2019s the very beginning:<\/p>\n<blockquote><p>Too Much Help at Once<br \/>\nNick Montfort<\/p>\n<p>ASSERTION<\/p>\n<p>The &#8220;assert&#8221; statement<br \/>\n**********************<\/p>\n<p>Assert statements are a convenient way to insert debugging assertions<br \/>\ninto a program:<\/p>\n<p>assert_stmt ::= &#8220;assert&#8221; expression [&#8220;,&#8221; expression]<\/p><\/blockquote>\n<h3 id=\"a_plot\">A plot<\/h3>\n<p>So far I have noted one other #NNNGM entry, <a href=\"https:\/\/twitter.com\/onwhatthereis\/status\/1195542029234819072\"><i>A plot<\/i> by Milton L\u00e4ufer,<\/a> which I am reproducing here in corrected form, according to the author\u2019s note:<\/p>\n<p><code><br \/>\nperl -e 'sub n{(split\/ \/,\"wedding murder suspicion birth hunt jealousy death party tension banishment trial verdict treason fight crush friendship trip loss\")[rand 17]}print\"A plot\\nMilton L\u00e4ufer\\n\\n\";for(;$i&lt;12500;$i++){print\" and then a \".n}print\".\\n\"'<br \/>\n<\/code><\/p>\n<p>Related in structure to <i>consequence,<\/i> but with words of varying length that do not compound, L\u00e4ufer\u2019s novel winds through not four weddings and a funeral, but about, in expectation, 735 weddings and 735 murders in addition to 735 deaths, leaving us to ponder the meaning of \u201ca crush\u201d when it occurs in different contexts:<\/p>\n<blockquote><p> and then a wedding and then a murder and then a trip and then a hunt and then a crush and then a trip and then a death and then a murder and then a trip and then a fight and then a treason and then a fight and then a crush and then a fight and then a friendship and then a murder and then a wedding and then a friendship and then a suspicion and then a party and then a treason and then a birth and then a treason and then a tension and then a birth and then a hunt and then a friendship and then a trip and then a wedding and then a birth and then a death and then a death and then a wedding and then a treason and then a suspicion and then a birth and then a jealousy and then a trip and then a jealousy and then a party and then a tension and then a tension and then a trip and then a treason and then a crush and then a death and then a banishment [&#8230;]<\/p><\/blockquote>\n<p>Share, enjoy, and please participate by adding your Nano-NaNoGenMo entries as NaNoGenMo entries <a href=\"https:\/\/nanogenmo.github.io\/\">(via the GitHub site)<\/a> and by tooting &amp; tweeting them!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ah, distinctly I remember it was in the bleak November; And each separate bit and pixel wrought a novel on GitHub. April may be the cruelest month, and now the month associated with poetry, but November is the month associated with novel-writing, via NaNoWriMo, National Novel Writing Month. Now, thanks to an offhand comment by &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/nickm.com\/post\/2019\/11\/nano-nanogenmo-or-nnngm\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Nano-NaNoGenMo or #NNNGM&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[44,60,59,74,138,168,104,15,30],"class_list":["post-4804","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-competitions","tag-computational","tag-computational-art","tag-creative-computing","tag-generation","tag-nanogenmo","tag-narrative","tag-programming","tag-story-generation"],"_links":{"self":[{"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/posts\/4804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/comments?post=4804"}],"version-history":[{"count":13,"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/posts\/4804\/revisions"}],"predecessor-version":[{"id":4818,"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/posts\/4804\/revisions\/4818"}],"wp:attachment":[{"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/media?parent=4804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/categories?post=4804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nickm.com\/post\/wp-json\/wp\/v2\/tags?post=4804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}