Skip to content

Instantly share code, notes, and snippets.

@markcmarino
Created February 20, 2020 22:35
Show Gist options
  • Save markcmarino/c3516ab708885f322af94dfec89a5fd5 to your computer and use it in GitHub Desktop.
Save markcmarino/c3516ab708885f322af94dfec89a5fd5 to your computer and use it in GitHub Desktop.
Argot Ogre, OK! by Andrew Plotkin
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html manifest="argot-ogre-ok.manifest">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="apple-touch-icon" sizes="57x57" href="argot-ogre-ok-icon-57x57.png">
<link rel="apple-touch-icon" sizes="114x114" href="argot-ogre-ok-icon-114x114.png">
<!--
Argot Ogre, OK!
(Andrew Plotkin, Sept 27, 2011)
http://eblong.com/zarf/argot-ogre-ok.html
This code is public domain. Text is by the authors attributed below.
"Does it have a monkey?"
"Yes, the monkey is 'taboo'."
- Nick Montfort and Flourish Klink, Sept 26, at dinner
All of the prior remixes of Nick Montfort's _Taroko Gorge_ rewrote the
text, while leaving Nick's code unchanged or almost so. I thought that
was a shame. I also thought it was an opportunity! Since they all
essentially consisted of word-lists plugged into a schema, I was able
to remix them together on two axes at the same time:
* Combining the word-lists of any two poems;
* Mutating the stanza schema.
I also took the opportunity to randomize the color schemes of the
pages. (But not the font choices or the background imagery that some
of the poems indulged in. Optima for everybody, I'm afraid.)
Nick's original poem generates a constant ABBA-C pattern, with some
extra B's thrown in. This page essentially invents a new pattern (for
example A-, or BC-BA, or CCC, or so on) for each block. The code for
the pattern is on the left, and the generated output is on the right.
To answer the obvious question: Yes, this page really does execute the
code that's displayed in the left column, and it really does generate
the text in the right column.
The most entertaining part of this project was inventing a way to mutate
Nick's original code, while still having it *look* distinctly like Nick's
original code. If you're not painfully familiar with that code - e.g, if
you're neither Nick nor me - go to http://nickm.com/poems/taroko_gorge.html
and select "View Source" in your browser, and look near the bottom. You'll
recognize the form of the "do_line()" routine. Some of mine are simpler
than his; some are more complex.
The *complete* code for this page is of course much more involved than
Nick's (because it has to *generate* Nick's code, plus a lot more).
But I tried to stick to Nick's coding style wherever I could.
The blocks strictly alternate between a single poem (with a mutated
schema, but the original word lists) and a mix of two poems. I thought
that would be the best lead-in for someone familiar with the original
poems.
A (perhaps interesting) result of my mixing is that some poems
dominate others. Yoko Engorged has the longest word-lists, Fred and
George has the shortest; so if they get mixed together, the randomizer
selects many more Beatles references than Potter ones. I could have
adjusted for this, but I didn't.
-->
<style type="text/css">
/* <![CDATA[ */
body {
background: white;
color: black;
margin: 0;
font-family: Optima, sans-serif;
font-size: 13pt;
line-height: 16pt;
overflow: scroll; /* vertical scrollbar is mandatory */
overflow-x: hidden; /* but horizontal scrollbar is forbidden */
}
#header {
background: #EEE;
}
#headersub {
padding: 1pt 24pt 1pt 24pt;
}
#main {
margin: 0 24pt 0 24pt;
}
a {
color: #11A;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.Right {
text-align: right;
}
.Sidebar {
float: right;
overflow: hidden;
background: #EEE;
font-size: 10pt;
line-height: 13pt;
width: 50%;
height: 260pt;
padding-left: 8pt;
}
.Clear {
clear: both;
text-align: right;
padding-top: 13pt;
}
/* ]]> */
</style>
<script language="JavaScript" type="text/javascript">
var TarokoGorge = {
title: 'Taroko;Gorge'.split(';'),
above: 'brow,mist,shape,layer,the crag,stone,forest,height'.split(','),
below: 'flow,basin,shape,vein,rippling,stone,cove,rock'.split(','),
trans: 'command,pace,roam,trail,frame,sweep,exercise,range'.split(','),
imper: 'track,shade,translate,stamp,progress through,direct,run,enter'.split(','),
intrans: 'linger,dwell,rest,relax,hold,dream,hum'.split(','),
texture: 'rough,fine'.split(','),
adjs: 'encompassing,sinuous,straight,objective,arched,cool,clear,dim,driven'.split(','),
s: 's,'.split(','),
the: 'the',
monkeysee: 'forest',
monkeydo: 'monkeys'
};
var TokyoGarage = {
title: 'Tokyo;Garage'.split(';'),
above: 'punk rocker,public servant,prostitute,poet,war widow,addict,movie star,tourist,teenager,zombie,goth girl,schoolboy,driver,night,stockbroker,siren,saxaphonist,spokesmodel,rat,translator,rock star,retiree,prostitute,dawn,protagonist,neon sign,traffic jam,bicycle messenger,drummer,godzilla,costumed mascot,vending machine,samurai,private dick,massively multiplayer game,chat client,devout worshiper,shrine,buddha,jesus freak,traveler,cat,dragon,puppeteer,hallucination,shrine,chauffeur,mute,technicolor nightmare,private security agent,temple,student,supercomputer,ninja,cultist,scholar,speed racer,undercover cop,earthquake,fish monger,contortionist,microchip,gamer,yakuza,freeter,aristocrat,shogun warrior,gambler,surveillance camera,watcher,pirate,occidental,computer scientist,monk,space invader,talk show host,noh enthusiast,juggler,cowboy,cosplayer,blogger,hacker,detective,alternative medicine specialist,smoker,atomic bomb,thug,architect,technocrat'.split(','),
below: 'Roppongi drunk,Shibuya shopper,gaijin,geisha,manga,pachinko parlor,cherry blossom,sumo,kanji,nose ring,whale,supermodel,pickpocket,flower arrangement,villian,speedwalker,designer,dancer,teacher,sailor,banker,kabuki dancer,clown,magician,virtual pet,correspondent,dog,kung-fu fighter,cleric,bureaucrat,freak,robot,fruitseller,author,dreamer,panda bear,stranger,hip cat,dealer,automaton,mystic,kid,pink kitten,monster,soldier,diplomat,nun,subway,machine,market,politician,host,transvestite,cigarette,subject,sushi joint,ingenue,shadow,lantern,cuisine,black widow,libation,scandal,pain,processor,routine,motorcycle gang,vintage cadillac,mobile phone,casino,rocketeer,fund,altruist,embezzler,spiritual seeker,DJ,other'.split(','),
trans: 'warm,warn,forgive,pick,hustle,trail,frame,sweep,smell,grope,arrange,fondle,adore,confuse,covet,regret,endure,suffer,feel,scold,subdue,hassle,orient,dream,hate,jam,transform,transport,reorient,bribe,remove,chill,educate,inform,deceive,rescue,simulate,stimulate,eroticize,follow,assault,serenade,become,enlist,corrupt,shadow,smoke,shake,frighten,swindle,skin,critique,rearrange,preserve,freak,grok,liquidate,fund,comfort,welcome,greet,eye,love,detest,test,unsettle,arrest,defend,expose,profile,ceremonialize,proselytize,purchase,drain,contaminate'.split(','),
imper: 'watch,beat,translate,caress,go to,stumble through,run,enter,defeat,promote,finger,elucidate,explain,paint,command,direct,revivify,sing,sing damn you sing,script,remember,disregard,concantenate,suffer,recall,absorb,forgive,scramble,rattle,harmonize,synthesize,pardon,excuse,explore,digest,apologize for,process,consider,embellish,forget,signify,deconstruct,protect,endure,sculpt,eliminate,forego,imagine,curse,bless,waste'.split(','),
intrans: 'fall,dwell,rock,circle,clamor,dream,sing,imitate,debate,evacuate,harass,twist,reverse,pay,expire,sing,recover,destroy,investigate,fail,succeed,win,drop,burn,explode,rest,regenerate,halt,perspire,conspire,walk'.split(','),
texture: 'smooth,waxy,rough,slick,silken,gummy,squishy,scaly,bumpy,wet'.split(','),
adjs: 'overwhelming,lithe,uptight,nervous,smoke-filled,dizzy,drunken,sated,dim,foggy,electric,blazing,artificial,curvy,inhospitable,welcome,jazzy,confused,disorganized,shabby,ancient,modern,digital,cacophonous,seedy,elegant,strangely quiet,incoherent,puzzling,troubling,disconcerting,awkwardly familiar,shining,new,odiferous,unyielding,chaotic,disoriented,infantile,blessed,futuristic,mysterious,bizarre,banal,chilling,definitive,translucent,opaque,glowing,noisy,silent,sexist,amazing,robotic,dreamy,floating,alien,paranoid,blinking,scantily clad,robust,misty,romantic,techno,noir,epic,tragic,comic,aimless,scattered,binary,metallic,plasticine,all-absorbing,stinking,insanely electic,multitudinous,endless,abbreviated,repressed,oversexed,cheap,expensive,cruel,forgiving,electric,peripheral'.split(','),
s: 's,'.split(','),
the: 'the',
monkeysee: 'pachinko parlor',
monkeydo: 'mobile phone'
};
var Gorge = {
title: 'Gorge'.split(';'),
above: 'appetite,brain,craving,desire,digestive juice,digestive tract,enzyme,gaze,glaze,gorge,gullet,head,incisor,intellect,jaw,knowledge,language,maw,mandible,mind,molar,muscle,mouth,nose,sight,smell,spit,sweat,spirit,thirst,throat'.split(','),
below: 'aroma,bladder,blood vessel,bowl,bowel,crust,dip,dressing,film,gut,lip,lower lip,proffered finger,finger tip,flared nostril,flushed cheek,meal,membrane,morsel,most intimate odour,palm,persistent scent,pore,sauce,soft pocket,slightest sliver,stomach,surface,thick spread,tongue,taste bud,vein,vinaigrette'.split(','),
trans: 'agitate,attract,bite,boil,braise,burn,carve,char,chew,coat,consume,crack,cultivate,devour,digest,direct,dissect,distil,dominate,drink,drive,engage,engorge,fill,grate,grind,incise,ink,ingest,julienne,melt,nibble,pare,peel,pick,pluck,ripen,repel,separate,sever,singe,skim,skin,split,stuff,stimulate,stain,stir,strain,strengthen,strike,style,swallow,tear,texture,weaken,whip,wilt,yield'.split(','),
imper: 'become,confuse,cut,decant,enter,examine,gorge on,inhabit,inspect,note,observe,obliterate,read,release,translate,write,savour,scrutinize,slice,sip,study'.split(','),
intrans: 'absorb,age,assimilate,balance,blend,brew,cool,concentrate,complement,cream,cure,dissolve,encrust,evaporate,ferment,heat,incorporate,infuse,layer,marinate,mature,perfume,permeate,reduce,ripen,round,steam,steep,soak,savour,sip,simmer,stew,warm'.split(','),
texture: 'acrid,barely perceptible,cautious,complex,dense,delicate,elegant,faint,fragrant,hint of,heady,powerful,pungent,rich,sickly,smoky,supple,velvety'.split(','),
adjs: 'almond,berry,blackstrap,burnt,cassis,cardamom,cinnamon,citrus,colourful,cordial,damson,ginger,herbaceous,liquorice,liquor,aftertaste'.split(','),
s: 's,'.split(','),
the: 'the',
monkeysee: 'forest',
monkeydo: 'monkeys'
};
var ToyGarbage = {
title: 'Toy;Garbage'.split(';'),
above: 'RAGGEDY ANN,SHRINKY DINK,EASY-BAKE OVEN,HAND PUPPET,SUPER MARIO,OUIJA BOARD,CABBAGE PATCH KID,MR. POTATOHEAD,FURBY,PLUSH PINKACHU,BARBIE,BABY ALIVE,ACTION FIGURE'.split(','),
below: 'VENTRILOQUIST DUMMY,SLINKY,DOLLY,CHIA PET,SIPPY CUP,PACIFIER,TIN-TOY ROBOT,DIAPER,LAWN DART,POGO STICK,BOUNCE HOUSE,DOLLHOUSE,RATTLE,MECHANICAL TRAPEZE CLOWN,VIEWMASTER,TEDDY BEAR,RAGGEDY ANDY'.split(','),
trans: 'HIDE,SEEK,KICK,TAG'.split(','),
imper: 'CRAWL TOWARD,SPIT-UP ON,GAG ON,CHOKE ON,TEETHE ON,ROLE-PLAY AS,PLAY WITH,DUCK DUCK GOOSE,TAKE ONE BABY STEP TOWARD,TAKE ONE GIANT STEP TOWARD'.split(','),
intrans: 'DESTROY,REVOLT,CUDDLE,CONTEMPLATE'.split(','),
texture: 'PLASTIC,PLUSH,PLIABLE,DIE-CAST,RUBBER,TINKER-TOY,NON-TOXIC,VINYL,REMOTE CONTROL'.split(','),
adjs: 'FLAMMABLE,TOXIC,INFLATABLE,BATTERY OPERATED,DISPOSABLE,HAZARDOUS'.split(','),
s: 'S,'.split(','),
the: 'THE',
monkeysee: 'BABY ALIVE',
monkeydo: 'MOTHER MAY I'
};
var YokoEngorged = {
title: 'Yoko;Engorged'.split(';'),
above: 'fat old mother hen,John,Lennon,the audience volunteer,the generator'.split(','),
below: 'appendage,breast,fat old mother hen,grapefruit,hip,intimate part,lip,nipple,opening,pie,thigh,waste line,Yoko'.split(','),
trans: 'command,cup,exercise,explore,finger,flog,fondle,graze,grope,imagine,lick,manipulate,massage,plow,poke,pucker,range,reveal,ride,roam,rub,smear,soften,squeeze,stroke,suck,stimulate,tease,tickle,tongue,trail'.split(','),
imper: 'absentmindedly fondle,approach the bed with,boldly explore,bottle and bootleg,breathe in,capture,conduct,consider,croon to,curse while savouring,delight in,discover in the seat of your loins,distil every ounce of,draw a map of,drink from,drunkenly extol,enter,entertain a partner with,feel,fill a bag with frozen peas and,frame,gently blow,imagine,indulge,kiss kiss kiss,kiss kiss kiss,let her gradually melt,let her shine for one hour,light a match and watch,listen to her pulse,lovingly engorge,make her paint her face and dance,make up sex positions that bring to mind,meticulously reconstruct,mount,mouth,never forget,observe closely,penetrate,play rummy with,plow,plumb,pursue,recall,reimagine as a piece for orchestra,release,resist for as long as you can,roam,rub up against,seal,take a tape of the sound of,throw open the bedroom window,touch,trace,undress with your eye,waltz along to'.split(','),
intrans: 'climax,dream,flux,frollic,fuck,hum,linger,moan,rest,swell,thrust,whisper'.split(','),
texture: 'achey,arched,beady,beating,clenched,creamy,curved,delicate,damp,dewy,dirty,enfolded,enticing,erect,fragile,glistening,hard,juicy,limp,moist,pert,ripe,rock hard,scented,supple,swollen,tautened,tender,unshaven,wet'.split(','),
adjs: 'aching,akimbo,arthouse,bare,beckoning,caressed,carnal,cavernous,climactic,cocky,curvy,dimpled,disarming,discharged,dishevelled,dripping,all-encompassing,erect,ethereal,exposed,extended,fearless,fleshy,floating,flowering,flushed,fluttering,four-poster,fucking,fucking,full frontal,full-voiced,furtive,hairy,hushed,improvised,intimate,insatiable,intangible,intermingling,kneeling,lewd,lightly oiled,lingering,louche,mechanical,mid-afternoon,moaning,mute,obligatory,obscene,orgasmic,overeager,oversexed,paper-thin,pent-up,perfunctory,perky,perverse,pillow-like,pleasing,pornographic,pricked,prurient,pungent,randy,reclining,repeated,resistive,rhythmic,rippling,saffron,shivering,smutty,soft,spumy,streaming,stripped,subliminal,subterranean,sunbeamed,suppressed,sweetbitter,sweetbitter,teeming,thrusting,unadulterated,unexpected,unkempt,untamed,whispered,would-be,XXX,XXX,zipless,1087 Madison Avenue bedroom,almost dawn,alternating stanzas,edge of,back row of the Soho movie house,begonia,Bodhi Tree,cami knickers,Carnegie Hall recital,ceiling mirror,cha-cha,cheeks,cherry blossom,coming suddenly to climax,coitus,crescendo,crevice,crisis point,curves,demimonde,desire,dirty talk,down to the ankles,draped stockings,erection,Falu red,fan video,farmhand,fetish,firmness,floating poem,floating poem,fluxing,foreplay,from behind,from within a Kabukicho apartment,fronds,fucking,fucking,gash,gasping for breath,Geisha fetish,grapefruit,guitarist,haiku,in and out,in and out,in and out,inside of an abandoned Kyoto garage,legs,love nest,lust,manifestation,momentary trick,museum piece,nakedness,non-stop,oh oh oh,oh oh oh,oh Yoko,oh Yoko,oh Yoko,oh Yoko,oh Yoko,oh Yoko,oh Yoko,oh Yoko oh Yoko,on stage,outside in the MOMA sculpture garden,overtones,parting shots of the body,pubic hairs,quim,sex,shaft,sheath,skies,skies between her thighs,sky between your own thighs,songmaking,spasms,stoic,striptease,strokes,tango,tremor,unexplored gorges,up and down,valley,vis a tergo,wet patches'.split(','),
s: 's,'.split(','),
the: 'the',
monkeysee: ' ',
monkeydo: ''
};
var TakeiGeorge = {
title: 'Takei,;George'.split(';'),
above: 'lieutenant,9\" action figure,yellow shirted officer,gay activist,role model,Asian American actor,openly gay Japanese American,Sulu\'s smile,long-time partner,married gay couple,international star,American citizen,concentration camp detainee,voiceover artist,television star,political activist,closeted star'.split(','),
below: 'government,resettlement program,final frontier,voyage,barbed wire enclosure,Arkansas swamp,red shirt,blue shirt,tricorder,alien life form,international crew,Executive Order,Prime Directive,Star Trek franchise,race prejudice,starship,Enterprise,Starfleet\'s rule,phaser,warp factor,Vulcan,Romulan,Klingon,transporter beam,dilithium crystal,commander,chief science officer,chief medical officer,theme song,relocation camp,homophobe,wartime misdeed,paranoia,xenophobic official,fan,Tribble,antimatter cloud,television screen,television network,episode,stereotype,galactic war,sharpened rapier'.split(','),
trans: 'support,fight,repair,criticize,attack,overpower,stun,cheat,outwit,teleport,control,discover,salute,call,email,hate,love,fear,report,imprison,win,lose'.split(','),
imper: 'trash,watch,read,play,dream,write,sleep through,pay money for,sell the rights to'.split(','),
intrans: 'incarcerate Japanese American children,queer the census,set phasers on stun,lost the fifth crewman,beam me up,take the helm,boldly go where no man has gone before,get married in California,come out of the closet,had a recurring role on Heroes,are rounded up like illegal aliens,are ruthlessly parodied on The Family Guy,seek out new life and new civilization,explore strange new worlds,received a star on Hollywood Boulevard,made in studio appearances on the Howard Stern Show'.split(','),
texture: 'rebooted,original'.split(','),
adjs: 'online,real life,slash lit,fanfic,fan mail,videogame,novel,movie,TV show'.split(','),
s: 's,'.split(','),
the: 'the',
monkeysee: 'Sulu\'s smile',
monkeydo: 'Kirk smolders and Sulu vows to'
};
var AloneEngaged = {
title: 'Alone;Engaged'.split(';'),
above: 'tramp,girl,student,black homeless guy,Southern driver,SUV bitch,creepy little dog,wasp,hornet,young runner,skinny size 0 jeans whore,rich white girl,rival,Southern belle,intellectual,dreamboy,ballroom dancer,lesbian couple,sick girl,loner'.split(','),
below: 'runner,jazz lover,strong lesbian,dyke,other,bike,academic,driver,bartender,server,hillbilly,Georgian,tramp,hobo,older lover,gray bearded professor,bald guy,fighter,blond college girl,teenager,destitute,saxophonist,jazz musician,gay guy,Swede,Dane,digital media theorist,coder,programmer,engineer,mathematician,feminist,American,comp-sci geek,builder,freak,Conservative,Republican,fascist,procrastinator,loner'.split(','),
trans: 'love,kiss,forget,take,dry,suffer,teach,stimulate,massage,bike,run,run fast,deceive,politicize,unsettle,protect,rush,read,talk,follow,figure,draw,dream,cry,scream, eat,train,sweat,silence,critique,try,search,find,desire,fuck,dream,sleep,forge,engorge,engage'.split(','),
imper: 'watch,explain,lie,smile,endure,forget,imagine,dream,curse,sweat,smile,txt,sin,procrastinate,excuse,run,walk,stroke,touch,revitalize,spawn,ejaculate,tingle,pray,protect,abandon,program,code,leave,desire,want'.split(','),
intrans: 'fall,perspire,drink,read,come,think,walk,dream,sing,look,watch,see,code,type,write,draw,rest,fail,function,destroy,rebuild,lose,choose,jeopardize,pay,beg,learn,burn'.split(','),
texture: 'humid,sultry,wet,warm,smooth,soft,hard,alone,engaged'.split(','),
adjs: 'alone,lazy,sunny,skinny,blond,welcome,nervous,artificial,confused,delirious,happy,shabby,contemporary,modern,digital,elegant,coded,strange,troubling,awkward,new,old,onerous,wanting,chaotic,amazed,blessed,modernist,mysterious,scary,definitive,loud,silent,amazing,cybernetic,dreamy,gritty,gentrified,cruel,forgiving,electric,peripheral'.split(','),
s: 's,'.split(','),
the: 'the',
monkeysee: 'older lover',
monkeydo: 'mobile phone'
};
var FredAndGeorge = {
title: 'Fred;and George'.split(';'),
above: 'hand,lip,wand,mouth,finger,wizard'.split(','),
below: 'brow,hand,thigh,lip,wand,mouth,shaft'.split(','),
trans: 'stroke,fondle,soothe,comfort,reveal,roam,ride,tickle'.split(','),
imper: 'fuck,love,caress,climax with,delight in,breathe in,capture'.split(','),
intrans: 'linger,love,dream,tingle'.split(','),
texture: 'rough,fine'.split(','),
adjs: 'sweet,sinuous,arched,redheaded,freckled,beloved,twinned,parallel,matching,ginger'.split(','),
s: 's,'.split(','),
the: 'the',
monkeysee: 'wizard',
monkeydo: 'taboos'
};
var allsources = 'TarokoGorge,TokyoGarage,Gorge,ToyGarbage,YokoEngorged,TakeiGeorge,AloneEngaged,FredAndGeorge'.split(',');
function mix(src1, src2) {
var obj = {};
obj.title = [ src1.title[0], src2.title[1%(src2.title.length)] ];
obj.s = src1.s;
obj.the = src1.the;
obj.monkeysee = src1.monkeysee;
obj.monkeydo = src1.monkeydo;
obj.above = src1.above.concat(src2.above);
obj.below = src1.below.concat(src2.below);
obj.trans = src1.trans.concat(src2.trans);
obj.imper = src1.imper.concat(src2.imper);
obj.intrans = src1.intrans.concat(src2.intrans);
obj.texture = src1.texture.concat(src2.texture);
obj.adjs = src1.adjs.concat(src2.adjs);
return obj;
}
function rand_range(max) {
return Math.floor(Math.random()*(max+1));
}
function choose(array) {
return array[rand_range(array.length-1)];
}
function chooseexcept(array,not) {
var res=not;
while (res==not) {
res=array[rand_range(array.length-1)];
}
return res;
}
function randomcolor() {
var ls = [ 2+rand_range(3), 11+rand_range(4), 3+rand_range(12)];
ls.push(ls.splice(rand_range(2),1)[0]);
ls.push(ls.splice(rand_range(2),1)[0]);
ls.push(ls.splice(rand_range(2),1)[0]);
return Number(ls[0]+16*ls[1]+256*ls[2]).toString(16);
}
function gen_path(src) {
var p=rand_range(1);
var words=choose(src.above);
if ((words==src.monkeysee)&&(rand_range(3)==1)) {
words=src.monkeydo+' '+choose(src.trans);
} else {
words+=src.s[p]+' '+choose(src.trans)+src.s[(p+1)%2];
}
words+=' '+src.the+' '+choose(src.below)+choose(src.s)+'.';
return words;
}
function gen_site(src) {
var words='';
if (rand_range(2)==1) {
words+=choose(src.above);
} else {
words+=choose(src.below);
}
words+=src.s[0]+' '+choose(src.intrans)+'.';
return words;
}
function gen_cave(src) {
var ls = src.adjs.slice(0,src.adjs.length);
ls.push(choose(src.texture));
var target=1+rand_range(3);
while (ls.length>target) {
ls.splice(rand_range(ls.length),1);
}
return words=' '+choose(src.imper)+' '+src.the+' '+ls.join(' ')+' \u2014';
}
function scrolldown(id, limit) {
if (!limit)
limit = 18;
var main=document.getElementById(id);
if (main.childNodes.length > limit)
main.removeChild(main.firstChild);
}
function write(id, text, nocap) {
var main=document.getElementById(id);
if (!main)
return null;
if (!nocap)
text=text.substring(0,1).toUpperCase()+text.substring(1,text.length);
var prefix='';
for (var ix=0; ix<text.length; ix++) {
if (text.charAt(ix) != ' ')
break;
prefix=prefix+'\u00a0';
}
if (ix) {
text=prefix+text.substring(ix,text.length);
}
last=document.createElement('div');
last.appendChild(document.createTextNode(text));
main.appendChild(last);
return last;
}
function generator(count) {
var res = [];
var sourcename = choose(allsources);
if (count % 2 == 0) {
var val = chooseexcept(allsources, sourcename);
sourcename = "mix("+sourcename+", "+val+")";
}
res.push("var source = "+sourcename+";");
res.push("function do_line() {");
res.push(" scrolldown(mainid);")
var limvars = 'nick,scott,jr,talan,eric,mark,maria,flourish'.split(',');
var lines = 'path(),site(),cave(),\' \''.split(',');
var breaks = 1+rand_range(2);
var limvar = null;
var line = "' '";
for (var ix=0; ix<breaks; ix++) {
var post = rand_range(2);
var jx=-1;
if (ix===0) {
jx=0;
post+=1;
if (breaks <= 1)
post+=1;
}
for (; jx<post; jx++) {
line = chooseexcept(lines,line);
if (ix===0 && jx===0) {
res.push(" if (n===0) {");
line = "' '";
}
else if (ix===0) {
res.push(" } else if (n=="+jx+") {");
}
else if (jx<0) {
res.push(" } else if (n<"+limvar+") {");
}
else if (jx===0) {
res.push(" } else if (n=="+limvar+") {");
}
else {
res.push(" } else if (n=="+jx+"+"+limvar+") {");
}
res.push(" text="+line+";");
}
if (ix<breaks-1) {
var limvar = limvars.splice(rand_range(limvars.length-1), 1);
var minlim = 2+rand_range(1);
var rangelim = rand_range(2);
var offset="+"+minlim;
if (rangelim)
offset+="+rand_range("+rangelim+")";
res.push(" "+limvar+"=n"+offset+";");
}
}
res.push(" } else {");
res.push(" text=' ';");
res.push(" n=0;");
res.push(" }");
res.push(" n+=1;");
res.push(" write(mainid,text);");
res.push("}");
return res;
}
var outerlist = null;
var poemcount = 0;
var callables = [];
function do_outer_line() {
var el;
if (!outerlist || !outerlist.length) {
poemcount+=1;
outerlist = generator(poemcount);
var title = build_callable(outerlist, poemcount);
el = write('main', title);
el.className = 'Clear';
el = write('main', '');
el.id = 'poem'+poemcount;
el.className = 'Sidebar';
el.style.backgroundColor = '#'+randomcolor();
scrolldown('main',50);
return;
}
write('main', outerlist.splice(0,1)[0], true);
scrolldown('main',50);
}
function build_callable(ls, ix) {
var mainid = 'poem'+ix;
var source = '';
var cave = function() { return gen_cave(source); };
var path = function() { return gen_path(source); };
var site = function() { return gen_site(source); };
var nick,scott,jr,talan,eric,mark,maria,flourish;
var n = 0;
eval(ls.join('\n'));
callables.push({ id:mainid, func:do_line });
return source.title.join(' ') + ' (remix)';
}
function do_inner_lines() {
var ls = callables.slice(0,callables.length);
callables.length = 0;
for (var ix=0; ix<ls.length; ix++) {
var obj = ls[ix];
if (!document.getElementById(obj.id))
continue;
obj.func();
callables.push(obj);
}
}
function poem() {
setInterval(do_outer_line, 1200);
setInterval(do_inner_lines, 500);
}
</script>
<title>Argot Ogre, OK!</title>
</head>
<body onload="poem()">
<div id="header"><div id="headersub">
<p class="Right">
Argot Ogre, OK!<br>Andrew Plotkin
</p>
<p>
Following Nick Montfort's
<a href="http://nickm.com/poems/taroko_gorge.html">Taroko Gorge</a>,
and including its remixes by
<a href="http://retts.net/tokyogarage.html">Scott Rettberg</a>,
<a href="http://luckysoap.com/generations/gorge.html">J.R. Carpenter</a>,
<a href="http://talanmemmott.com/drp_web/text_gen/toygarbage/">Talan Memmott</a>,
<a href="http://talanmemmott.com/es/pg/yoko/yoko_engorged.html">Eric Snodgrass</a>,
<a href="http://samplereality.com/elit/takeigeorge.html">Mark Sample</a>,
<a href="http://polyaesthetics.org/AloneEngaged.html">Maria Engberg</a>,
and
<a href="http://www.flourishklink.com/portfolio/fredandgeorge.html">Flourish Klink</a>.
(View source for author's notes.)
</p>
</div></div>
<noscript><p>(This poem requires Javascript.)<p></noscript>
<div id="main"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment