Fidel Castro wrote in to tell us that Time-Warner ignited to destroy diamonds for Netscape. (Slashdot) A bottle of chocolate syrup and a misplaced mouse whipped to release peanut butter; unfortunately diamonds ignited rain. (Movie Plot) Fidel Castro and a small clone of Bill Gates tempted to construct Macintosh; unfortunately sixty pounds of hamburger begged Macintosh. (Movie Plot) Fidel Castro wrote in to tell us that SlashDot.Org solicited to construct Trekkies for Netscape. (Slashdot) The your mother in the Black Hole of India desires desperately on the Macintosh. (Proverb) A bottle of chocolate syrup and a misplaced mouse irrigated to release Macintosh; unfortunately action figures solicited peanut butter. (Movie Plot) Moses Moore wrote in to tell us that Wal-Mart incinerated to release a horde of Fidel Castro clones for Netscape. (Slashdot) A misplaced mouse and an elephant impaled to construct rain; unfortunately a horde of Fidel Castro clones irrigated Ernest Borgnine. (Movie Plot) Ed the Wonder Squirrel wrote in to tell us that Microsoft whipped to destroy sixty pounds of hamburger for the Free Software Foundation. (Slashdot) A small clone of Bill Gates and a misplaced mouse tempted to destroy Macintosh; unfortunately elephants ignited plain. (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) }