#!/s/std/bin/perl

use strict;

use CGI qw(:standard);
use File::Temp;
use IO::File;

use lib '/u/k/o/koczan/public/html/tourney';
use Tournament;

my $cgi = new CGI;
my $tourney = new Tournament("NCAA.txt", "/dev/null");

print $cgi->header;

print "<html>
<head>
<title>Let's Predict Us a Tournament</title>
</head>
</body>
";

print "<h1>NCAA Tournament Predictor</h1>\n";

print "Welcome to the new and improved NCAA tournament predictor.\n";

print "<h2>Here are the results of your random simulation.</h2>\n";

print "The game is on the left column of the table, the winner is the right. Tables are grouped according to round.\n\n";

$tourney->initialize;
$tourney->simulate;

# stdout to web page
my $stdout = new IO::File;
open ($stdout, ">-");
$tourney->print($stdout, "html");
close $stdout;

print "<p>These are my predictions. Let's see how these fare against those of the \"experts\".

<p>Please note that you cannot download a text-only version at this time.

<p><a href='/~koczan/tourney/'>Back to tourney index</a> | <a href='/~koczan/'>Back to main index</a>

</body>
</html>
";
