#!/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","VTT","PT50","PB150","FI","FII","FIII","NCFII","NCFIII","CFII","CFIII","RRPI","RFI","RFII","RFIII","HRPI","HFI","HFII","HFIII","ORPI","RPI2","NCRPI2","WRPI","NCWRPI","DWRPI","NCDWRPI","SEED","Z","NCZ","RAWZ","NCRAWZ","DEFZ","OFFZ","MZ","NCDEFZ","NCOFFZ","NCMZ","PTS","PTSA","MARGIN","REGION","SOS","STDPOWER","STDOFF","STDDEF","PPOWER","POFF","PDEF","TFACTOR","Conf"
);
($bconf{"American West"},$bconf{"Atlantic 10"},$bconf{"Atlantic Coast"},$bconf{"Big East"},$bconf{"Big Sky"},$bconf{"Big South"},$bconf{"Big 10"},$bconf{"Big West"},$bconf{"Colonial Athletic"},$bconf{"Conference USA"},$bconf{"Independents"},$bconf{"Ivy League"},$bconf{"Metro Atlantic"},$bconf{"Mid American"},$bconf{"Mid Continent"},$bconf{"Mid Eastern Athletic"},$bconf{"Mid Western Collegiate"},$bconf{"Missouri Valley"},$bconf{"North Atlantic"},$bconf{"Northeast"},$bconf{"Ohio Valley"},$bconf{"PAC 10"},$bconf{"Patriot League"},$bconf{"Southeastern"},$bconf{"Southern"},$bconf{"Southland"},$bconf{"Southwestern Athletic"},$bconf{"Sun Belt"},$bconf{"Trans America Athletic"},$bconf{"West Coast"},$bconf{"Western Athletic"},$bconf{"Big 12"},$bconf{"America East"},$bconf{"Mountain West"},$bconf{"New England Collegiate"},$bconf{"Southern Intercollegiate"})=("AWC","A10","ACC","BEC","BSKY","BSOUT","B10","BWC","CAA","CUSA","IND","IVY","METAC","MAC","MCC","MEAC","MWCC","MVC","NAC","NEC","OVC","PAC10","PATRL","SEC","SOUTH","SLC","SWAC","SBC","TAAC","WCC","WAC","B12","AEC","MWC","NEWC","SIC");
$lconf{"AEC"}="America East";$lconf{"AWC"}="American West";$lconf{"A10"}="Atlantic 10";$lconf{"ACC"}="Atlantic Coast";$lconf{"B10"}="Big 10";$lconf{"B12"}="Big 12";$lconf{"BEC"}="Big East";$lconf{"BSKY"}="Big Sky";$lconf{"BSOUT"}="Big South";$lconf{"BWC"}="Big West";$lconf{"CAA"}="Colonial Athletic";$lconf{"CUSA"}="Conference USA";$lconf{"IND"}="Independent";$lconf{"IVY"}="Ivy League";$lconf{"METAC"}="Metro Atlantic";$lconf{"MAC"}="Mid-American";$lconf{"MCC"}="Mid-Continent";$lconf{"MEAC"}="Mid-Eastern Athletic";$lconf{"MWCC"}="Mid-Western Collegiate";$lconf{"MVC"}="Missouri Valley";$lconf{"MWC"}="Mountain West";$lconf{"NEWC"}="New England";$lconf{"NAC"}="North Atlantic";$lconf{"NEC"}="Northeast";$lconf{"OVC"}="Ohio Valley";$lconf{"PAC10"}="Pacific 10";$lconf{"PATRL"}="Patriot League";$lconf{"SWAC"}="South-Western Athletic";$lconf{"SEC"}="Southeastern";$lconf{"SOUTH"}="Southern";$lconf{"SIC"}="Southern Intercollegiate";$lconf{"SLC"}="Southland";$lconf{"SBC"}="Sun Belt";$lconf{"TAAC"}="Trans-America Athletic";$lconf{"WCC"}="West Coast";$lconf{"WAC"}="Western Athletic";
%sorts = (
rpi => 'RPI',
ncrpi => 'Non-Conference RPI',
crpi => 'Conference RPI',
ccrpi => 'Conference & CRPI',
cwrpi => 'Conference & WRPI',
cdwrpi => 'Conference & DWRPI',
cncrpi => 'Conference & NCRPI',
cncz => 'Conference & NCZ',
ccz => 'Conference & Z',
ccuz => 'Conference & RAWZ',
ccunz => 'Conference & RAWNCZ',
cfi => 'Conference Standings',
fi => 'Winning Percentage',
fii => 'Schedule Strength (Opp Win %)',
ncfii => 'Non-Conference Strength of Schedule',
sos => 'Strength of Schedule',
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',
pnct50 => '%Non-Conference Opponents in RPI Top 50',
pncb150 => '%Non-Conference Opponents in RPI Bottom 150',
rpi2 => 'RPI-2',
seed => 'NCAA Seeding',
# region => 'NCAA Region',
ncrpi2 => 'Non-Conference RPI-2',
z => 'Z Rating',
ncz => 'Non-Conference Z Rating',
rawz => 'Unscaled Z Rating',
ncrawz => 'Non-Conference Unscaled Z Rating',
defz => 'Defensive Z Rating',
offz => 'Offensive Z Rating',
mz => 'Scoring Margin Z Rating',
ncdefz => 'Non-Conference Defensive Z Rating',
ncoffz => 'Non-Conference Offensive Z Rating',
ncmz => 'Non-Conference Scoring Margin Z Rating',
offense => 'Scoring Offense',
defense => 'Scoring Defense',
margin => 'Point Margin',
tfactor => 'T Factor',
stdpower => 'STD Power',
stdoff => 'STD Offense',
stddef => 'STD Defense',
ppower => 'P-Power',
poff => 'P-Offense',
pdef => 'P-Defense'
);
$query = new CGI;
$sortm=$query->param('sortm');
$tourney=$query->param('tourney');
$showconf=$query->param('showconf');
if ($showconf eq "" ) {$showconf = "all";}
for ($x=0;$x<=$#cols;$x++) {
$selected{$cols[$x]}=$query->param($cols[$x]);
$which=$which . ":" . $cols[$x] if ($query->param($cols[$x]));
}
if ($sortm eq "") {
$sortm="rpi";
$selected{REC}=1;
$selected{RPI}=1;
$selected{FII}=1;
$selected{FIII}=1;
$selected{SEED}=1;
$selected{L10}=1;
$selected{TR}=1;
$selected{Conf}=1;
$which="default";
}
$LOCK_SH = 1; $LOCK_EX = 2; $LOCK_NB = 4; $LOCK_UN = 8;
open(LOG,">> /user/dan/public_html/wbball/rpi.log");
flock(LOG,$LOCK_EX);
seek(LOG, 0, 2);
print LOG time,":",$ENV{"REMOTE_ADDR"},":",$sortm,":",$showconf,":",$which,$tourney,"\n";
flock(LOG,$LOCK_UN);
close(LOG);
open (CONF,"< /user/dan/public_html/wbball/9900conf.txt");
$x=1;
while () {
chop;
@data=split;
$conf=$data[0];
$CRPI{$conf}=$data[1];
$CREC{$conf}=$data[2];
$CFI{$conf}=$data[3];
$CFII{$conf}=$data[4];
$CFIII{$conf}=$data[5];
$CZ{$conf}=$data[6];
$CRAWZ{$conf}=$data[7];
$CRANK{$conf}=$x;
$x++;
}
close(CONF);
%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',
PT50 => '%Non-Conference Opponents in RPI Top 50',
PB150 => '%Non-Conference Opponents in RPI Bottom 150',
VTT => 'Record versus NCAA Tournament Teams',
FI => 'Team Winning Percentage',
FII => 'Opponents record (Strength of Schedule)',
FIII => 'Opponents Strength of Schedule',
SOS => 'Strength of Schedule',
NCFII => 'Non-Conference Opponents record (SoS)',
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',
SEED => 'NCAA Seeding',
Z => 'Z Rating',
NCZ => 'Non-Conference Z Rating',
RAWZ => 'Unscaled Z Rating',
NCRAWZ => 'Unscaled Non-conference Z Rating',
DEFZ => 'Defensive Z Power Rating',
OFFZ => 'Offensive Z Power Rating',
MZ => 'Scoring Marging Z Power Rating',
NCDEFZ => 'Non-Conference Defensive Z Power Rating',
NCOFFZ => 'Non-Conference Offensive Z Power Rating',
NCMZ => 'Non-Conference Scoring Marging Z Power Rating',
PTS => 'Scoring Offense',
PTSA => 'Scoring Defense',
MARGIN => 'Points Margin',
REGION => 'Tournament Region',
STDPOWER => 'STD Power',
STDOFF => 'STD Offense',
STDDEF => 'STD Defense',
PPOWER => 'P-Power',
POFF => 'P-Offense',
PDEF => 'P-Defense',
TFACTOR => 'T-Factor',
Conf => 'Conference affiliation'
);
print 'NCAA Women\'s Basketball RPI and Related Data
Information about the data available here
';
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat("9900fullrpi.txt");
@month = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec);
@week = (Sun,Mon,Tue,Wed,Thu,Fri,Sat);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($mtime);
$year += 1900;
printf("Last updated: %s, %s %02d %02d:%02d:%02d %s\n",$week[$wday],$month[$mon],$mday,$hour,$min,$sec,$year);
print 'Select the data to display and the method to sort by....
";
print "* denotes teams that have qualified for the tournament\n";
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/9900fullrpi.txt | sort -nr +7.1;grep "L[0-9]" /user/dan/public_html/wbball/9900fullrpi.txt | sort -n +7.1)`;
}
else {
$cmd="/usr/sbin/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="+42 +6nr";$mode="c"}
elsif ($sortm eq "pnct50" ) {$order="-nr";$key="+16";}
elsif ($sortm eq "pncb150" ) {$order="-nr";$key="+17";}
elsif ($sortm eq "fi" ) {$order="-nr";$key="+18 +1 +2";}
elsif ($sortm eq "fii" ) {$order="-nr";$key="+19";}
elsif ($sortm eq "ncfii" ) {$order="-nr";$key="+21";}
elsif ($sortm eq "fiii" ) {$order="-nr";$key="+20";}
elsif ($sortm eq "rrpi" ) {$order="-nr";$key="+25";}
elsif ($sortm eq "hrpi" ) {$order="-nr";$key="+29";}
elsif ($sortm eq "srpi" ) {$order="-nr";$key="+33";}
elsif ($sortm eq "rpi2" ) {$order="-nr";$key="+34";}
elsif ($sortm eq "ncrpi2" ) {$order="-nr";$key="+35";}
elsif ($sortm eq "wrpi" ) {$order="-nr";$key="+36";}
elsif ($sortm eq "ncwrpi" ) {$order="-nr";$key="+37";}
elsif ($sortm eq "dwrpi" ) {$order="-nr";$key="+38";}
elsif ($sortm eq "ncdwrpi" ) {$order="-nr";$key="+39";}
elsif ($sortm eq "seed" ) {$order="-n";$key="+40 +2nr";}
elsif ($sortm eq "region" ) {$order="";$key="+40";$mode="C";$mode2="R";}
elsif ($sortm eq "z" ) {$order="-nr";$key="+41";}
elsif ($sortm eq "ncz" ) {$order="-nr";$key="+42";}
elsif ($sortm eq "rawz" ) {$order="-nr";$key="+43";}
elsif ($sortm eq "ncrawz" ) {$order="-nr";$key="+44";}
elsif ($sortm eq "defz" ) {$order="-nr";$key="+45";}
elsif ($sortm eq "offz" ) {$order="-nr";$key="+46";}
elsif ($sortm eq "mz" ) {$order="-nr";$key="+47";}
elsif ($sortm eq "ncdefz" ) {$order="-nr";$key="+48";}
elsif ($sortm eq "ncoffz" ) {$order="-nr";$key="+49";}
elsif ($sortm eq "ncmz" ) {$order="-nr";$key="+50";}
elsif ($sortm eq "offense" ) {$order="-nr";$key="+51";}
elsif ($sortm eq "defense" ) {$order="-n";$key="+52";}
elsif ($sortm eq "margin" ) {$order="-nr";$key="+53";}
elsif ($sortm eq "sos" ) {$order="-nr";$key="+55";}
elsif ($sortm eq "stdpower" ) {$order="-nr";$key="+56";}
elsif ($sortm eq "stdoff" ) {$order="-nr";$key="+57";}
elsif ($sortm eq "stddef" ) {$order="-nr";$key="+58";}
elsif ($sortm eq "ppower" ) {$order="-nr";$key="+59";}
elsif ($sortm eq "poff" ) {$order="-nr";$key="+60";}
elsif ($sortm eq "pdef" ) {$order="-nr";$key="+61";}
elsif ($sortm eq "tfactor" ) {$order="-nr";$key="+62";}
elsif ($sortm eq "conference" ) {$cmd="/usr/sbin/sort";$order="";$key="+2nr"; $mode="C";}
elsif ($sortm eq "cncrpi" ) {$order="";$key="+4nr"; $mode="C";}
elsif ($sortm eq "cwrpi" ) {$order="";$key="+36nr"; $mode="C";}
elsif ($sortm eq "cdwrpi" ) {$order="";$key="+38nr"; $mode="C";}
elsif ($sortm eq "cncz" ) {$order="";$key="+42nr"; $mode="C";}
elsif ($sortm eq "ccz" ) {$order="";$key="+41nr"; $mode="C";}
elsif ($sortm eq "ccuz" ) {$order="";$key="+43nr"; $mode="C";}
elsif ($sortm eq "ccunz" ) {$order="";$key="+44nr"; $mode="C";}
elsif ($sortm eq "cfi" ) {$cmd="/bin/cat";$order="";$key=""; $mode="CS";}
@entries=`$cmd $order $key /user/dan/public_html/wbball/9900fullrpi.txt`;;
}
if ($mode eq "C") {
for ($x=0;$x<=$#entries;$x++) {
$rank{$entries[$x]}=$x+1;
}
if ($mode2 eq "R") {
@entries=`/usr/sbin/sort +54 $key /user/dan/public_html/wbball/9900fullrpi.txt`;
}
else {
@entries=`/usr/sbin/sort +63 $key /user/dan/public_html/wbball/9900fullrpi.txt`;
}
for ($x=0;$x<=$#entries;$x++) {
$rest=$entries[$x];
chop $rest;
$rest=~s/^ +//;
@cconf=split(/[ \t\n]+/,$rest);
$cconf=$cconf[$#cconf];
$pconf=$lconf{$cconf};
if ($cconf ne $occonf && $showconf eq "all") {print"| $pconf RANK=$CRANK{$cconf} RPI=$CRPI{$cconf} RECORD=$CREC{$cconf} Z=$CZ{$cconf} RAWZ=$CRAWZ{$cconf} | \n";$j++;if($j==2){$j=0;}
if($x>5) {printf("
%s |
\n",$sep);}
}
$outstr=sprintf("%17s ",$cconf[0]);
#$space=" " x (17-length($cconf[0]));
#$outstr=sprintf("%s%s ",$space,$cconf[0],$cconf[0]);
for ($z=0;$z<=$#cols;$z++) {
if ($selected{$cols[$z]} == 1) {
if ($cols[$z] eq "Conf") {
$outstr=sprintf("%s %6s ",${outstr},$pconf);
}
else {
$outstr=sprintf("%s %6s ",${outstr},$cconf[$z+1]);
}
}
}
$occonf=$cconf;
if (($tourney!=1 || $cconf[0]=~/\*/) && ($showconf eq "all" || $showconf eq $cconf || $showconf eq $cconf[$#cconf-8])) {
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/sbin/sort +63 +6nr +5nr +7nr +19nr +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];
$pconf=$lconf{$cconf};
if ($cconf ne $occonf && $showconf eq "all" ) {print"| $pconf RANK=$CRANK{$cconf} RPI=$CRPI{$cconf} RECORD=$CREC{$cconf} Z=$CZ{$cconf} RAWZ=$C
RAWZ{$cconf} | \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]);
#$space=" " x (17-length($cconf[0]));
#$outstr=sprintf("%s%s ",$space,$cconf[0],$cconf[0]);
for ($z=0;$z<=$#cols;$z++) {
if ($selected{$cols[$z]} == 1) {
if ($cols[$z] eq "Conf") {
$outstr=sprintf("%s %6s ",${outstr},$pconf);
}
else {
$outstr=sprintf("%s %6s ",${outstr},$cconf[$z+1]);
}
}
}
$occonf=$cconf;
if (($tourney!=1 || $cconf[0]=~/\*/) && ($showconf eq "all" || $showconf eq $cconf || $showconf eq $cconf[$#cconf-8])) {
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);
$cconf=$cconf[$#cconf];
$pconf=$lconf{$cconf};
if ($mode eq "c" ) {
if ($cconf ne $occonf && $showconf eq "all") {print" | \n";$j++;if($j==2){$j=0;}$k=1;
if ($x> 5) {printf("
%s |
\n",$sep);}
}
$occonf=$cconf;
}
$outstr=sprintf("%17s ",$cconf[0]);
#$space=" " x (17-length($cconf[0]));
#$outstr=sprintf("%s%s ",$space,$cconf[0],$cconf[0]);
for ($z=0;$z<=$#cols;$z++) {
if ($selected{$cols[$z]} == 1) {
if ($cols[$z] eq "Conf" ) {
$outstr=sprintf("%s %6s ",${outstr},$pconf);
}
else {
$outstr=sprintf("%s %6s ",${outstr},$cconf[$z+1]);
}
}
}
if ($sortm eq "seed") {
if ($cconf[$#cconf-3] != $oldseed && $showconf eq "" && $tourney != 1 ) {
$j++;if($j==2) {$j=0;}
print" | \n";
}
$oldseed=$cconf[$#cconf-3];
}
if (($tourney!=1 || $cconf[0]=~/\*/) && ($showconf eq "all" || $showconf eq $cconf || $showconf eq $cconf[$#cconf-8])) {
printf("
%3d %s |
\n",$k,$outstr);
if (($x+1)/25 == int(($x+1)/25) && $mode ne "c" && $showconf eq "all") {
printf("%s |
\n",$sep);
}
$y++;if ($y==2) {$y=0;};
}
$k++;
}
}
print '
';