#!/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","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"})=("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"); %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', 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', 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' ); $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{NCFI}=1; $selected{NCRPI}=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); %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', 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', 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("9899fullrpi.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....
'; for ($x=0;$x<=$#cols;$x++) { $outstr="$outstr $cols{$cols[$x]}"; if ($cols[$x] ne "VTTx" && $cols[$x] ne "SEEDx") { $out++; if ($selected{$cols[$x]} == 1) { printf(" %-50s",$cols{$cols[$x]}); } else { printf(" %-50s",$cols{$cols[$x]}); } if ($out==2) {print "\n";$out="0"} } } print '
"; print '"; print " Show Tournament Qualifiers Only
\n"; print ""; print '* denotes teams that have qualified for the tournament '; $outstr=sprintf("Rank %16s ","Team"); for ($z=0;$z<=$#cols;$z++) { if ($selected{$cols[$z]} == 1) { $outstr=sprintf("%s %6s ",${outstr},$cols[$z]); } } printf("\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/9899fullrpi.txt | sort -nr +7.1;grep "L[0-9]" /user/dan/public_html/wbball/9899fullrpi.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="+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 "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 "conference" ) {$cmd="/usr/bin/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/9899fullrpi.txt`;; } if ($mode eq "C") { for ($x=0;$x<=$#entries;$x++) { $rank{$entries[$x]}=$x+1; } @entries=`/usr/bin/sort +55 $key /user/dan/public_html/wbball/9899fullrpi.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 && $showconf eq "all") {print"\n";$j++;if($j==2){$j=0;} if($x>5) {printf("\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) { $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-1])) { printf("\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 +56 +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]; if ($cconf ne $occonf && $showconf eq "all" ) {print"\n";$count=1;$j++;if($j==2){$j=0;} if($x>5) {printf("\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) { $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-1])) { printf("\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]; 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("\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) { $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-1])) { printf("\n",$k,$outstr); if (($x+1)/25 == int(($x+1)/25) && $mode ne "c" && $showconf eq "all") { printf("\n",$sep); } $y++;if ($y==2) {$y=0;}; } $k++; } } print '
%s
%s
%3d %s
%s
%3d %s
%s
%3d %s
%s
';