April 14, 2009

New Version of ppg256-1

by Nick Montfort · , 7:52 am

I had long wanted to incorporate an extra revision step in ppg256-1, my first 256-character poetry generator, to make strings such as “maar” and “bued” into words (specifically, “mar” and “bad”). Also, it annoyed me that in ppg256-1, the code to delay the output is in a separate perl program; the generator must be piped to it. In ppg256-2 this delay is integrated into the generator. So, I revisited the first program and rewrote it so that it does the additional revision and now produces output at a human pace:

perl -le 'sub b{@_=unpack"(A2)*",pop;$_[rand@_]}sub w{" ".b("cococacamamadebapabohamolaburatamihopodito").b("estsnslldsckregspsstedbsnelengkemsattewsntarshnknd")}{$_="\n\nthe".w."\n";$_=w." ".b("attoonnoof").w if$l;s/[au][ae]/a/;print;$l=0if$l++>rand 9;sleep 1;redo}'

Here’s the page for the series of generators.