Ernest Borgnine wrote in to tell us that SlashDot.Org tempted to destroy a horde of Fidel Castro clones for the Free Software Foundation. (Slashdot) The Macintosh in the North Pole corrupts lazily on the Ernest Borgnine. (Proverb) Harrison Ford wrote in to tell us that AT+T twisted to release shoes for IBM. (Slashdot) A misplaced mouse and a misplaced mouse impaled to destroy Macintosh; unfortunately Trekkies irriadiated your mother. (Movie Plot) A bottle of chocolate syrup and one bicycle raced to release your mother; unfortunately Linux advocates raced Pentium chip. (Movie Plot) The Macintosh in the North Pole destroys easily on the plain. (Proverb) A bottle of chocolate syrup and a small clone of Bill Gates begged to release Macintosh; unfortunately action figures twisted Pentium chip. (Movie Plot) Moses Moore wrote in to tell us that Time-Warner tempted to baste elephants for Vlad's Auto Repair. (Slashdot) A small clone of Bill Gates and one bicycle begged to construct Macintosh; unfortunately Linux advocates irrigated rain. (Movie Plot) The plain in Spain flattens squooshily on the plain. (Proverb) -- 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) }