The rain in Leonardo DiCaprio's underwear eats sexually on the town hall. (Proverb) The peanut butter in your left nostril destroys offensively on the rain. (Proverb) Fidel Castro and Fidel Castro tempted to destroy your mother; unfortunately diamonds irriadiated plain. (Movie Plot) The rain in the North Pole makes love harshly on the rain. (Proverb) Cmdr Taco wrote in to tell us that the Free Software Foundation impaled to baste sixty pounds of hamburger for Vlad's Auto Repair. (Slashdot) Fidel Castro and one bicycle irriadiated to construct Ernest Borgnine; unfortunately diamonds solicited your mother. (Movie Plot) The peanut butter in the Black Hole of India flattens harshly on the Macintosh. (Proverb) An elephant and Fidel Castro whipped to construct Macintosh; unfortunately shoes rained Pentium chip. (Movie Plot) Ernest Borgnine wrote in to tell us that Wal-Mart twisted to construct diamonds for AT+T. (Slashdot) An elephant and a misplaced mouse incinerated to construct goths; unfortunately action figures incinerated goths. (Movie Plot) -- source code follows -- #!/usr/bin/perl # Cmdr Taco seems to like the [insert thing here] Random Generators, # and they look all the same to me. # This program is an explanation why. # Inspired by a Solaris program called /usr/games/thought use strict; my @phrases = ('The %noun in %place %verb_n %adverb on the %noun. (Proverb)' ,'%name wrote in to tell us that %company %verb_p %verb_i %nouns for ' .'%company. (Slashdot)' ,'%noun1 and %noun1 %verb_p %verb_i %noun; unfortunately %nouns %verb_p ' .'%noun. (Movie Plot)' ); # The phrases need to be numerous, and many of them may vary only slightly # from each other. The %terms describe what word/phrase belongs there. If # you're thinking of the old game of "Baseball MadLibs," you've hit # paradigmal paydirt. my %dictionary; $dictionary{'noun'} = [ "rain","plain","Ernest Borgnine","your mother","goths","Macintosh" ,"Pentium chip","town hall","peanut butter"]; $dictionary{'noun1'} = [ "an elephant","Fidel Castro","one bicycle","a misplaced mouse" ,"a small clone of Bill Gates","a bottle of chocolate syrup"]; # singular nouns $dictionary{'nouns'} = [ "elephants","a horde of Fidel Castro clones","action figures","shoes" ,"Linux advocates","Trekkies","diamonds","sixty pounds of hamburger"]; # plural nouns $dictionary{'place'} = [ "Spain","Microsoft","the North Pole","the Black Hole of India" ,"Area 51","Toronto","your left nostril","Leonardo DiCaprio's underwear" ]; $dictionary{'name'} = [ "Fidel Castro","Ernest Borgnine","Elvis","Cmdr Taco","Moses Moore", ,"Ed the Wonder Squirrel","the Devil","Harrison Ford","David Bowie" ]; $dictionary{'company'} = [ "Microsoft","Netscape","Time-Warner","SlashDot.Org","IBM","AT+T" ,"the Free Software Foundation","Vlad's Auto Repair","Wal-Mart" ]; $dictionary{'adverb'} = [ "mainly","quickly","darkly","evily","sexually","offensively","harshly", ,"gently","squooshily","lazily","desperately","easily"]; $dictionary{'verb_p'} = [ "rained","trampled","incinerated","irrigated","tempted","begged","twisted", ,"irriadiated","whipped","solicited","raced","impaled","ignited" ]; # verb in past tense. $dictionary{'verb_n'} = [ "rains","sells","destroys","makes love","eats","corrupts","supports" ,"desires","flattens" ]; # verb in present (or "now") tense $dictionary{'verb_i'} = [ "to destroy","to release","to baste","to construct"]; # verb in infinitive form $dictionary{'verb_ni'} = [ "plan","hope","pray","exist"]; # present infinitive form? # Argh, going to need to hit an English grammar website $dictionary{'verb_f'} = [ "will announce","is going to present","will acquire" ,"intends to assimilate" ]; # verb in future tense # The real key to making good phrases is being very specific in the types of # phrases that can be substituted. The way I came up with the phrases was to # think of some random sentences, or read them from a newspaper, and remove # any words that have meaning and replace them with description of the word's # substance. Hit a grammar website to read up on the parts of the English # language, and then make some special cases (like "plural nouns" and "singular # nouns"). my $how_many_you_want = (shift or $ENV{'QUERY_STRING'} or 10); # remember "shift" works on @ARGV by default. print "Content-Type: text/plain\n\n" if ($ENV{'SCRIPT_NAME'}); # run as CGI srand(); while($how_many_you_want--) { my $phrase = $phrases[int(rand($#phrases+1))]; $phrase =~ s/(^|\s)\%(\w+) /"$1".$dictionary{$2}->[int(rand($#{$dictionary{$2}}+1))] /egx; print ucfirst($phrase)."\n"; } if ($ENV{'SCRIPT_NAME'}) { # This is so web people can see the source code when viewing it on the web. print "\n-- source code follows --\n"; open (FILE,$0) or die "Whoa, I can't find myself!\n$0:$!\n"; while () { print; } close (FILE) }