nickm.com > poems | interactive fiction & e-lit

ppg256 series

Perl Poetry Generators in 256 characters, by Nick Montfort

These are the current versions of these programs as of June 2012, updated to work on the stable version of Perl at that point (5.14). Changes between Perl 5.10 and 5.12 broke some of the original versions, namely ppg256-2 and ppg256-4; these have been revised. The first six programs have all been further compacted, so some sort of comment (in two cases, just a "#" by itself) appears at the end of the program and in the case of ppg256-4 the comment that is there has been lengthened. A record of the originally posted versions of all of these programs is online.

ppg256-1

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} #Rev2'

File version, e.g. for Windows with ActivePerl: ppg256-1.pl. Discussion of a preliminary version of ppg256-1, originally posted on Grand Text Auto.

ppg256-2

perl -le 'sub p{@_=split/_/,pop;$_[rand@_]}{$_=p("sw_-aw_&w_saw"."_ "x$i);s//p(aw_w)/e;s// /g;$_="\n\nthe s\n"if!$i;s/s/ws/;s/a/p(a_the_to_of)/e;s/w/p(b_ch_f_gr_k_p_sh_s_sk_sp_tw).i.p(ll_n_t)/eg;s/(b|p|f)i/$1.p(a_i)/e;print;$i=0if$i++>6+rand 9;sleep 1;redo} #On 5.12'

File version, e.g. for Windows with ActivePerl: ppg256-2.pl. Full instructions for ppg256-2.

ppg256-3

perl -le 'sub p{(unpack"(A3)*",pop)[rand 18]}sub w{p("apebotboyelfgodmannunorcgunhateel"x2)}sub n{p("theone"x8)._.p(bigdimdunfathiplitredwanwax)._.w.w."\n"}{print"\n".n."and\n".n.p("cutgothitjammetputransettop"x2)._.p("herhimin it offon outup us "x2);sleep 4;redo} #'

File version, e.g. for Windows with ActivePerl: ppg256-3.pl.

ppg256-4

perl -le 'sub c{@_=split/_/,pop;$_[rand@_]}sub w{c(b_br_d_f_fl_l_m_p_s_tr_w).c(ad_ag_ap_at_ay_ip_on_ot_ow)}{print"\n".c(be_de_mis_re_pre_).w." ".c(a_on_the_that_)." ".w.w.", ".c(boss_bro_buddy_dogg_dude_guy_man_pal_vato);sleep 4;redo} #No LED sign version, Perl 5.12'

LED sign version: ppg256-4 for LED sign. File version, e.g. for Windows with ActivePerl: ppg256-4.pl.

ppg256-5

perl -le '@a=split/_/,conceptual_digit_flarf_maximal_modern_pixel_quiet_real;sub f{pop if rand>.5}sub w{$a[rand@a]}{print f(post).w."ism ".w."s ".f("the ").w."\n".(" "x45)."WHAT DOES ppg DO?";$a[rand@a]=~s/[aeio]/substr(aeio,rand 4,1)/e if $l++>5;sleep 5;redo} #Rev2'

File version, e.g. for Windows with ActivePerl: ppg256-5.pl.

ppg256-6

perl -le '@d=split/_/,eros_won_to_tree_for_fire_sex_sever_ate_nice_tin_elfin_wealth;@t=split//,"_bhlmnpstw";{$_=localtime;/(..):(.)(.):(.)(.)/;print"\n$t[$3]".($4%2)."ck $t[$4]".($3%2)."ck\n"if!$5;print"\\"x$5." $d[$1%12] $d[$2] $d[$3] $d[$4] $d[$5]";sleep 1;redo} #'

File version, e.g. for Windows with ActivePerl: ppg256-6.pl.

ppg256-7

perl -le '$_="a literal_a0a special01n array_1 hash";s/0/ variable_/g;s/1/an element of a/g;@_=split/_/;$;=concatenat;for(1..4){$a="\tSometimes he assigned to @_[$_]";for$i(0..4){$a.=" $_[$i], or",map{$a.=" $_[$i] $;ed with $_, or"}@_}print"$a some longer $;ion.\n"}' | more

File version, e.g. for Windows with ActivePerl: ppg256-7.pl.