2001/02/07 (水) 04:05:03        [mirai]
#!/usr/local/bin/perl
$filedir = "./data";
###
#  文節ゲーム処理
#  見てのとおり文節ゲームの改造版
#########

sub story {
	
	my ( @storydata, @storyadj, $storytext, $random, @name, @adj, $place, $play, $thing, $noun, $job, $old );
	
	open ( IN, "$filedir/storyname.dat" );
	@storydata = <IN>;
	close ( IN );
	while ( $name[0] eq $name[1]  ) {
		$name[0] = $storydata[int(rand(@storydata))];
		$name[1] = $storydata[int(rand(@storydata))];
	}
	sub storyplace {
		open ( IN, "$filedir/storyplace.dat" );
		rand($.) < 1 and $place = $_ while <IN>;
		close ( IN );
	}
	
	sub storyplay {
		open ( IN, "$filedir/storyplay.dat" );
		rand($.) < 1 and $play = $_ while <IN>;
		close ( IN );
	}
	sub storything {
		open ( IN, "$filedir/storything.dat" );
		rand($.) < 1 and $thing = $_ while <IN>;
		close ( IN );
	}
	sub storyjob {
		open ( IN, "$filedir/storyjob.dat" );
		rand($.) < 1 and $job = $_ while <IN>;
		close ( IN );
	}
	sub storynoun {
		open ( IN, "$filedir/storynoun.dat" );
		rand($.) < 1 and $noun = $_ while <IN>;
		close ( IN );
	}
	sub storyadj {
		open ( IN, "$filedir/storyadj.dat" );
		@storyadj = <IN>;
		close ( IN );
		while ( $adj[0] eq $adj[1] ) {
			$adj[0] = $storyadj[int(rand(@storyadj))];
			$adj[1] = $storyadj[int(rand(@storyadj))];
		}
	}
	
	$old = int(rand(121));
	$year = int(rand(2100));

	$random = int( rand(4) );
	if ( $random == 0 ) {
		&storyadj;
		&storynoun;
		$storytext = "$adj[0]$noun $adj[1]$name[1]";
	} elsif ( $random == 1 ) {
		&storyadj;
		&storynoun;
		$storytext = "$name[0]$old歳 $adj[0]$noun";
	} elsif ( $random == 2 ) {
		&storyadj;
		&storynoun;
		$storytext = " $adj[0]$noun $name[0]$old歳";
	} elsif ( $random == 3 ) {
		&storyadj;
		&storynoun;
		$storytext = " $adj[0]$name[0]$old歳 $adj[1]$noun";
	}

	$storytext =~ s/\n//g;
	return $storytext;
}

$storytext = &story;
print "Content-type: text/html\n\n";
print <<"__EOM__";
<html><head>
<title>アダルトタイトル作成</title>
<body bgcolor="#004040" text="#ffffff" link="#eeffee" vlink="#dddddd" alink="#ff0000">
<center>
<small><font color ="#ffff00">アダルトタイトル作成</font></small>
<br><br>
<table border ="0">
<tr><td>
$storytext
</td></tr>
</table><br><br>
<a href="./title.cgi">§アゲイン</a>
</center></body></html>
__EOM__
exit;
__END__