#!/usr/bin/perl
print "Content-type: text/html\n\n";
print '
NCAA Women\'s Basketball RPI
';
use CGI;
@cols = (
"REC","RPI","NCFI","NCRPI","CFI","CRPI","TR","L10","T10","T25","T26-50","T51-100","T101-150","B150","FI","FII","FIII","NCFII","NCFIII","CFII","CFIII","RRPI","RFI","RFII","RFIII","HRPI","HFI","HFII","HFIII","ORPI","RPI2","NCRPI2","WRPI","NCWRPI","DWRPI","NCDWRPI","Z","NCZ","Seed","Conf"
);
%sorts = (
rpi => 'RPI',
ncrpi => 'Non-Conference RPI',
crpi => 'Conference RPI',
ccrpi => 'Conference & CRPI',
cfi => 'Conference Standings',
fi => 'Winning Percentage',
fii => 'Schedule Strength (Opp Win %)',
srpi => 'Schedule Strength (Opp RPI)',
conference => 'Conference & RPI',
rrpi => 'Road RPI',
hrpi => 'Home RPI',
trend => 'Win/Loss Trend',
dwrpi => 'Dominance Weighted RPI',
ncdwrpi => 'Non-Conference Dominance Weighted RPI',
wrpi => 'Weighted RPI',
ncwrpi => 'Non-Conference Weighted RPI',
rpi2 => 'RPI-2',
ncrpi2 => 'Non-Conference RPI-2',
z => 'Z Rating',
ncz => 'Non-Conference Z Rating',
seed => 'NCAA Seeding'
);
$query = new CGI;
$sortm=$query->param('sortm');
for ($x=0;$x<=$#cols;$x++) {
$selected{$cols[$x]}=$query->param($cols[$x]);
}
if ($sortm eq "") {
$sortm="rpi";
$selected{REC}=1;
$selected{RPI}=1;
$selected{NCFI}=1;
$selected{NCRPI}=1;
$selected{FII}=1;
$selected{FIII}=1;
$selected{L10}=1;
$selected{TR}=1;
$selected{Conf}=1;
}
%cols = (
REC => 'Team Record',
RPI => 'Ratings Percentage Index',
NCFI => 'Non-Conference Record',
NCRPI => 'Non-Conference RPI',
CFI => 'Team Conference Record',
CRPI => 'Conference RPI',
TR => 'Current streak (trend)',
L10 => 'Record in last 10 games',
T10 => 'Record vs RPI Top 10',
T25 => 'Record vs RPI Top 25',
'T26-50' => 'Record vs RPI 26-50 indexed teams',
'T51-100' => 'Record vs RPI 51-100 indexed teams',
'T101-150' => 'Record vs RPI 101-150 indexed teams',
B150 => 'Record vs teams indexed >150 in RPI',
FI => 'Team Winning Precentage',
FII => 'Opponents record (Strength of Schedule)',
FIII => 'Opponents Strength of Schedule',
NCFII => 'Non-Conference Opponents record (Strength of Schedule)',
NCFIII => 'Non-Conference Opponents Strength of Schedule',
CFII => 'Conference Opponents record (Strength of Schedule)',
CFIII => 'Conference Opponents Strength of Schedule',
RRPI => 'Road RPI',
RFI => 'Road Record',
RFII => 'Road Opponents record (Strength of Schedule)',
RFIII => 'Road Opponents Strength of Schedule',
HRPI => 'Home RPI',
HFI => 'Home Record',
HFII => 'Home Opponents record (Strength of Schedule)',
HFIII => 'Home Opponents Strength of Schedule',
ORPI => 'Strength of Schedule by Opponent RPI',
RPI2 => 'Second Order RPI',
NCRPI2 => 'Non-Conference Second Order RPI',
WRPI => 'Weighted RPI',
NCWRPI => 'Non-Conference Weighted RPI',
DWRPI => 'Dominance Weighted RPI',
NCDWRPI => 'Non-Conference Dominance Weighted RPI',
Z => 'Z Rating',
NCZ => 'Non-Conference Z Rating',
Seed => 'NCAA Tournament Seed',
Conf => 'Conference affiliation'
);
print 'NCAA Women\'s Basketball RPI and Related Data
Select the data to display and the method to sort by....
";
print '';
$outstr=sprintf("Rank %16s ","Team");
for ($z=0;$z<=$#cols;$z++) {
if ($selected{$cols[$z]} == 1) {
$outstr=sprintf("%s %6s ",${outstr},$cols[$z]);
}
}
printf("%s |
\n",$outstr);
$sep=$outstr;
#$sortm="fi
$color[0]="yellow";
$color[1]="white";
$color[2]="#00CC00";
$color[3]="#FFFFCC";
$mode="";
if ($sortm eq "trend") {
@entries=`(grep "W[0-9]" /user/dan/public_html/wbball/9798fullrpi.txt | sort -nr +7.1;grep "L[0-9]" /user/dan/public_html/wbball/9798fullrpi.txt | sort -n +7.1)`;
}
else {
$cmd="/usr/bin/sort";
if ($sortm eq "rpi") { $cmd="/bin/cat";$order="";$key=""}
elsif ($sortm eq "ncrpi") { $order="-nr";$key="+4";}
elsif ($sortm eq "crpi") { $order="-nr";$key="+6";}
elsif ($sortm eq "ccrpi") { $order="";$key="+39 +6nr";$mode="c"}
elsif ($sortm eq "fi" ) {$order="-nr";$key="+15 +1 +2";}
elsif ($sortm eq "fii" ) {$order="-nr";$key="+16";}
elsif ($sortm eq "fiii" ) {$order="-nr";$key="+17";}
elsif ($sortm eq "rrpi" ) {$order="-nr";$key="+22";}
elsif ($sortm eq "hrpi" ) {$order="-nr";$key="+26";}
elsif ($sortm eq "srpi" ) {$order="-nr";$key="+30";}
elsif ($sortm eq "rpi2" ) {$order="-nr";$key="+31";}
elsif ($sortm eq "ncrpi2" ) {$order="-nr";$key="+32";}
elsif ($sortm eq "wrpi" ) {$order="-nr";$key="+33";}
elsif ($sortm eq "ncwrpi" ) {$order="-nr";$key="+34";}
elsif ($sortm eq "dwrpi" ) {$order="-nr";$key="+35";}
elsif ($sortm eq "ncdwrpi" ) {$order="-nr";$key="+36";}
elsif ($sortm eq "z" ) {$order="-nr";$key="+37";}
elsif ($sortm eq "ncz" ) {$order="-nr";$key="+38";}
elsif ($sortm eq "seed" ) {$order="";$key="+40n +3nr";}
elsif ($sortm eq "conference" ) {$cmd="/bin/cat";$order="";$key=""; $mode="C";}
elsif ($sortm eq "cfi" ) {$cmd="/bin/cat";$order="";$key=""; $mode="CS";}
@entries=`$cmd $order $key /user/dan/public_html/wbball/9798fullrpi.txt`;;
}
if ($mode eq "C") {
for ($x=0;$x<=$#entries;$x++) {
$rank{$entries[$x]}=$x+1;
}
@entries=`/usr/bin/sort +39 +2nr /user/dan/public_html/wbball/9798fullrpi.txt`;
for ($x=0;$x<=$#entries;$x++) {
$rest=$entries[$x];
chop $rest;
$rest=~s/^ +//;
@cconf=split(/[ \t\n]+/,$rest);
$cconf=$cconf[$#cconf];
if ($cconf ne $occonf) {print" | \n";$j++;if($j==2){$j=0;}
if($x>5) {printf("
%s |
\n",$sep);}
}
$outstr=sprintf("%17s ",$cconf[0]);
#$outstr=sprintf("%17s ",$cconf[0],$cconf[0]);
for ($z=0;$z<=$#cols;$z++) {
if ($selected{$cols[$z]} == 1) {
$outstr=sprintf("%s %6s ",${outstr},$cconf[$z+1]);
}
}
$occonf=$cconf;
printf("%3d %s |
\n",$rank{$entries[$x]},$outstr);
$y++;if ($y==2) {$y=0;}
}
}
# End
elsif ($mode eq "CS") {
open (FILE,"> /tmp/.sortem.$$");
for ($x=0;$x<=$#entries;$x++) {
$rank{$entries[$x]}=$x+1;
@pieces=split(/[ \t\n]+/,$entries[$x]);
$cwl{$pieces[0]}=$pieces[5];
($cwin,$closs)=split('-',$pieces[5]);
$cwinp=0;
if ( ($cwin+$closs) > 0.0 ) {$cwinp=$cwin/($cwin+$closs);}
print FILE join(' ',@pieces[0..5],$cwinp,@pieces[6..$#pieces]),"\n";
}
close (FILE);
@entries=`/usr/bin/sort +40 +6nr +5nr +16nr +1nr /tmp/.sortem.$$`;
unlink("/tmp/.sortem.$$");
$count=1;
for ($x=0;$x<=$#entries;$x++) {
$rest=$entries[$x];
chop $rest;
$rest=~s/^ +//;
@tmp=split(/[ \t\n]+/,$rest);
$rest=join(' ',@tmp[0..5],@tmp[7..$#tmp]);
@cconf=split(/[ \t\n]+/,$rest);
$cconf=$cconf[$#cconf];
if ($cconf ne $occonf) {print" | \n";$count=1;$j++;if($j==2){$j=0;}
if($x>5) {printf("
%s |
\n",$sep);}
}
#$outstr=sprintf("%17s ",$cconf[0],$cconf[0]);
$outstr=sprintf("%17s ",$cconf[0]);
for ($z=0;$z<=$#cols;$z++) {
if ($selected{$cols[$z]} == 1) {
$outstr=sprintf("%s %6s ",${outstr},$cconf[$z+1]);
}
}
$occonf=$cconf;
printf("%3d %s |
\n",$count,$outstr);
$count++;
$y++;if ($y==2) {$y=0;}
}
}
# END
else {
$k=1;
for ($x=0;$x<=$#entries;$x++) {
$rest=$entries[$x];
chop $rest;
$rest=~s/^ +//;
@cconf=split(/[ \t\n]+/,$rest);
if ($mode eq "c" ) {
$cconf=$cconf[$#cconf];
if ($cconf ne $occonf) {print" | \n";$j++;if($j==2){$j=0;}$k=1;
if ($x> 5) {printf("
%s |
\n",$sep);}
}
$occonf=$cconf;
}
$outstr=sprintf("%17s ",$cconf[0]);
#$outstr=sprintf("%17s ",$cconf[0],$cconf[0]);
for ($z=0;$z<=$#cols;$z++) {
if ($selected{$cols[$z]} == 1) {
$outstr=sprintf("%s %6s ",${outstr},$cconf[$z+1]);
}
}
printf("%3d %s |
\n",$k,$outstr);
if (($x+1)/25 == int(($x+1)/25) && $mode ne "c") {
printf("%s |
\n",$sep);
}
$y++;if ($y==2) {$y=0;};$k++;
}
}
print '
';