Ahem: The Boston Public Plot Generator

An original Perl work by magicmanzach.

It has often been proposed that the plotlines on the popular David E. Kelley TV show Boston Public are formulaic and illogical enough that they could easily be generated by a computer. Sample results:

Chapter One - Kevin generates controversy. Milton expels Steven in the student lounge. Lauren gets pregnant. Also, a sexy student generates controversy. The Superintendent punches a sexy student near urban Boston.

Chapter Two - Kevin gets pregnant. Marilyn turns in Guber in an apartment. Milton dies. Also, Lauren overdoses. Guber sexually harasses the valedictorian near the dungeon.

Chapter Three - Ronnie leads a protest. Danny fires Marilyn in the basement. Guber gives birth. Also, Guber leads a protest. Marla punches Louisa near outside.

This piece of software is, of course, distributed under the GPL, so that it can be better developed. I would advise everyone who uses it to log results, just in case any of these plots happen to "conveniently" show up on FOX.

Enjoy!


#!/usr/bin/perl -w

# bp.pl
# Boston Public Plotline Generator
# Distributed under the GPL
# Created by magicmanzach@yahoo.com

print "Content-type:text/html\n\n";

@characters =	("Steven", "Guber", "Lauren", "Harry", "Marilyn", "Marla",
		 "Cheryl Holt", "Kevin", "a sexy student", "Danny", "Milton",
		 "Ronnie", "Louisa", "the Superintendent", "an angry parent",
		 "a gang member", "a police officer", "the valedictorian");

@transitive_actions =
		("sleeps with", "talks about", "punches", "fires", "shoots",
		 "is offended by", "expels", "transfers", "suspends",
		 "breaks up with", "sexually harasses", "assaults",
		 "turns in", "reports");

@intransitive_actions =
		("overdoses", "streaks", "dies", "is expelled", "quits",
		 "foolishly drives out to Northampton, only to be disappointed",
		 "sings", "uses the N-word", "gets pregnant", "comes out",
		 "generates controversy", "passes out", "gives birth",
		 "leads a protest", "does something touching");

@places =	("the office", "the student lounge", "the bathroom",
		 "the basement", "the hallway", "outside", "urban Boston",
		 "the stairwell", "the stairwell", "the stairwell",
			# a lot of stuff happens on the stairwell
		 "the girls' locker room", "the boys' locker room",
		 "the dungeon", "Steven's office", "Scott's office",
		 "an apartment", "a hotel room");

# We can also use $character . "'s classroom"

@ordinals = ('one', 'two', 'three', 'four', 'five', 'six', 'seven',
	     'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen',
	     'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen',
	     'nineteen', 'twenty');

$num_episodes = 5;	# Set this for the number of episodes you want.
			# If it's more than twenty, add some values to
			# @ordinals; a general engine would be possible
			# to churn out numbers above twenty.

for ($i = 0; $i < $num_episodes; $i++) {
	print 'Chapter ' . ucfirst($ordinals[$i]) . ' - ';
	print ucfirst(&character) . " " . &intransitive . ". ";
	$c2 = $c1 = &character;
	$c2 = &character until ($c1 ne $c2);
	print ucfirst($c1) . " " . &transitive . " " . $c2 .
		((rand(4) == 2) ? "." : " in " . &place . ". ");
	$c3 = &character;
	print ucfirst($c3) . " " . &intransitive . ". ";
	print ((rand(1) == 1) ?
		"Because of this, " . &character .
		&transitive . " " . &character . " to get back at " .
		$c3 . ". " :
		"Also, " . &character . " " . &intransitive . ". ");
	print "Steven yells at " . &character . ". ";
	$c5 = $c4 = &character;
	$c5 = &character until ($c4 ne $c5);
	print ((rand(1) == 1) ? ucfirst($c4) . " " . &intransitive . ".":
		ucfirst($c5) . " " . &transitive . " "
		. $c4 . " near " . &place . ".");
	print "<p>\n\n";
};

sub character {
	return $characters[rand(scalar @characters)];
};

sub transitive {
	return $transitive_actions[rand(scalar @transitive_actions)];
};

sub intransitive {
	return $intransitive_actions[rand(scalar @intransitive_actions)];
};

sub place {
	return $places[rand(scalar @places)];
};

Log in or registerto write something here or to contact authors.