# FILE bbwomcomb.pl working copy running time sec # fix NC standings to include /PL/ for playoffs #============= CREATE SCORES PAGE =================== $scofile='BBWsco0102.txt'; open (SCORES,"<$scofile") || die "Can't open $scorefile $!"; open (SCORESHTML, ">bbwscores0102.html"); print SCORESHTML "CIS Womens BB scores 2001-02 \n Womens Basketball Scores 2001-02"; while () { ($date,$Tm1,$Sco1,$Tm2,$Sco2,$GmType,$Notes) = split(':',$_); ### Flag any reversed score, stops program, prints line to warn if ($Sco1 < $Sco2) { die print "$date $Tm1 $Sco1 $Tm2 $Sco2 $GmType $Notes"; } # dispose of heading in data file if ($date =~ /CIAU/) { print SCORESHTML "$date\n"; next; } # print date if alone on datafile row if ($Tm1 le " ") { print SCORESHTML "
$date\n"; } #print score lines without dates else { print SCORESHTML "
$Tm1 $Sco1 $Tm2 $Sco2 $Notes\n"; } } print SCORESHTML ""; #close HTML file close SCORESHTML; #==================================================== #### TEAM-BY-TEAM SCORES ### #==================================================== $scofile='BBWsco0102.txt'; open (SCORES,"<$scofile") || die "Can't open $scorefile $!"; open (TEAMDATA, ">bbwteams0102.html"); print TEAMDATA "
2001-02 WBB Scores by Team
Atlantic
Acadia
Dalhousie
Saint Mary's
Memorial
StFX
St. Thomas
UNB
UPEI
Quebec
Bishop's
Concordia
Laval
McGill
OUA East
Carleton
Ottawa
Laurentain
Queen's
Ryerson
Toronto
York
OUA West
Brock
Guelph
Laurier
Lakehead
McMaster
Waterloo
Western
Windsor
CanWest
Brandon
Manitoba
Regina
Saskatchewan
Winnipeg
Alberta
Calgary
Lethbridge
Simon Fraser
TWU
UBC
Victoria
  "; @TeamName = ("Acadia", "Memorial", "Saint Mary's", "StFX", "Dalhousie", "UCCB", "UNB", "UPEI", "Bishop's", "Concordia", "Laval", "McGill", "Carleton", "Laurentian", "Queen's", "Ottawa", "Ryerson", "Toronto", "York", "Brock", "Guelph", "Laurier","Lakehead", "McMaster", "Waterloo", "Western", "Windsor", "Brandon", "Manitoba", "Regina", "Winnipeg", "Alberta", "Calgary", "Lethbridge", "Saskatchewan", "Simon Fraser", "TWU", "UBC", "Victoria",); foreach $team (@TeamName) { open (TEAMDATA, ">>bbwteams0102.html"); print TEAMDATA "

$team\n"; open (SCORES,"<$scofile") || die "Can't open $scorefile $!"; while () { ($Date,$Tm1,$Sco1,$Tm2,$Sco2,$GmType,$Notes) = split(':',$_); if ($Tm1 eq $team || $Tm2 eq $team) { print TEAMDATA "
$Date $Tm1 $Sco1 $Tm2 $Sco2 $GmType $Notes\n"; } } } print TEAMDATA ""; #==================================================== #### CREATING STANDINGS MDA file ### #==================================================== $scofile='BBWsco0102.txt'; open (BBWMDA, ">bbwstand.txt") || die "Can't open bbwstand.txt $!"; print BBWMDA ""; @TeamName = ("Acadia", "Dalhousie", "Saint Mary's", "Memorial", "StFX", "UCCB", "UNB", "UPEI", "Bishop's", "Concordia", "Laval", "McGill", "Carleton", "Laurentian", "Queen's", "Ottawa", "Ryerson", "Toronto", "York", "Brock", "Guelph", "Laurier","Lakehead", "McMaster", "Waterloo", "Western", "Windsor", "Brandon", "Manitoba", "Regina", "Saskatchewan", "Winnipeg", "Alberta", "Calgary", "Lethbridge", "Simon Fraser", "TWU", "UBC", "Victoria",); foreach $team (@TeamName) { open (SCORES,"<$scofile") || die "Can't open $scorefile $!"; open (BBWMDA, ">>bbwstand.txt") || die "Can't open bbwstand.txt $!"; # initialize counts $teamwins=0; $teamlosses=0; $teamgp=0; $teamties=0; $pfor=0; $Against=0; $WLpct=0; $Margin=0; $Pts=0; $WLpct=0; $pfpg=0; $papg=0; $mgp=0; $olosses=0; $NCwins=0; $NClosses=0; $NCties=0; $CISwins=0; $CISlosses=0; $CISties=0; $EXwins=0; $EXlosses=0; $EXties=0; $OAwins=0; $OAlosses=0; $OAties=0; # while reading SCORES (BBWsco0102.txt) line-by-line # parse it at colons : into standings variables while () { ($date,$Tm1,$Sco1,$Tm2,$Sco2,$GmType,$Notes) = split(':',$_); #------------------------------------------- # BEGIN calculation of standings variables. #------------------------------------------- if ($Tm1 eq $team and $GmType eq "" ) { # selects Conference only ++$teamgp; ++$teamwins; # counts name in winner column $pfor = ($pfor + $Sco1); # adds winner's score to FOR $Against = ($Against + $Sco2); # adds loser's score to AGAINST } elsif ($Tm2 eq $team && $GmType eq "") { ++$teamgp; ++$teamlosses; # counts name in loser column $pfor = ($pfor + $Sco2); # adds loser's score to FOR $Against = ($Against + $Sco1); # adds winner's score to AGAINST } $Margin = ($pfor - $Against); #============== NON CONF =============== if (($Tm1 eq $team) and ($GmType =~ /NC|PL/)) { ++$NCwins; } elsif (($Tm2 eq $team) and ($GmType =~ /NC|PL/)) { ++$NClosses; } $CISwins = ( $teamwins + $NCwins) ; $CISlosses = ($teamlosses + $NClosses) ; #============== OVERALL ================= if (($Tm1 eq $team) and ($GmType =~ /EX/)) { ++$EXwins; } elsif (($Tm2 eq $team) and ($GmType =~ /EX/)) { ++$EXlosses; } $OAwins = ( $teamwins + $NCwins + $EXwins) ; $OAlosses = ($teamlosses + $NClosses + $EXlosses) ; #================================================= $Pts = (2 * $teamwins); #====================================== # WL Percent Conference #====================================== if ($teamgp == 0) { $WLpct = 1.000 ; } # calc W/L %, elim div by zero elsif ($teamlosses == 0 and $teamgp != 0) { $WLpct = 1.000; #NEW > > > > > > > } else { $WLpct = ($teamwins / $teamgp ); } if ($team =~ /Acadia|Memorial|Saint Mary's|StFX|/) { $conf = "aAUBaldwin"; } if ($team =~ /Dalhousie|UCCB|UNB|UPEI/) { $conf = "bAUNelson"; } elsif ($team =~ /Bishop's|Concordia|Laval|McGill/) { $conf = "cQUE"; } elsif ($team =~ /Carleton|Laurentian|Ottawa|Queen's|Ryerson|Toronto|York/) { $conf = "dOUAE"; } elsif ($team =~ /Brock|Guelph|Lakehead|Laurier|McMaster|Waterloo|Western|Windsor/) { $conf = "eOUAW"; } elsif ($team =~ /Brandon|Manitoba|Regina|Winnipeg/) { $conf = "gCWGP"; } elsif ($team =~ /Alberta|Calgary|Lethbridge|Saskatchewan/) { $conf = "hCWC"; } elsif ($team =~ /Simon Fraser|TWU|UBC|Victoria/) { $conf = "jCWW"; } } # Baldwin: Acadia, Memorial, Saint Mary's, StFX, # Nelson: Dalhousie, UCCB, UNB, UPEI # Quebec: Concordia, McGill, Bishop's, Laval # OUA East: Carleton, Laurentian, Ottawa, Queen's, # Ryerson, Toronto York # OUA West: Brock, Guelph, Laurier, Lakehead, # McMaster Waterloo, Western, Windsor # G Plains: Brandon Manitoba Regina Winnipeg # Central: Alberta Calgary Lethbridge Saskatchewan # Coast: Simon Fraser TWU UBC Victoria # END calculation of standings variables for Team. print BBWMDA "$team:$conf:$teamgp:$teamwins:$teamlosses:$pfor:$Against:$Pts:$WLpct:$Margin:$CISwins:$CISlosses:$OAwins:$OAlosses\n"; #"$team:$conf:$teamgp:$teamwins:$teamlosses:$pfor:$Against:$Margin:$Pts: #$WLpct:$pfpg:$papg:$mgp:$CISwins:$CISlosses:$CISties:$OAwins:$OAlosses:$#OAties\n"; } close BBWMDA; #==================================================== #### SORTING STANDINGS ### #==================================================== $stanfile='bbwstand.txt'; open (BBWMDA, "; @mdasorted = map { $_->[0] } sort { $a->[2] cmp $b->[2] # Conf || $b->[8] <=> $a->[8] # Points || $b->[9] <=> $a->[9] # Percent || $b->[10] <=> $a->[10] # Margin || $a->[1] cmp $b->[1] # Team } map { [ $_, (split /:/, $_,) ] } @mda; open (STANHTML, ">bbwstand0102.html"); print STANHTM ""; open (STANHTML, ">>bbwstand0102.html"); open (STANAUSB, ">bbwstanausb.txt"); open (STANAUSN, ">bbwstanausn.txt"); open (STANQUE, ">bbwstanque.txt"); open (STANOUAE, ">bbwstanouae.txt"); open (STANOUAW, ">bbwstanouaw.txt"); open (STANCWGP, ">bbwstancwgp.txt"); open (STANCWC, ">bbwstancwc.txt"); open (STANCWW, ">bbwstancww.txt"); print STANAUSB @mdasorted[0 .. 3]; ##AUSBaldwin .. begins zero print STANAUSN @mdasorted[4 .. 7]; ##AUSNelson print STANQUE @mdasorted[8 .. 11]; ##Quebec print STANOUAE @mdasorted[12 .. 18]; ##OUAEast print STANOUAW @mdasorted[19 .. 26]; ##OUAWest print STANCWGP @mdasorted[27 .. 30]; ##CanWestGPlains print STANCWC @mdasorted[31 .. 34]; ##CanWestCentral print STANCWW @mdasorted[35 .. 38]; ##CanWestWest ##====================================================== print STANHTML " BB Women Standings 2001-02 "; ##====================================================== ##================AUS Baldwin======================= print STANHTML " "; open (STANAUSB, ") { ($tm,$tmconf,$tmgp,$tmw,$tml,$tmf,$tma,$tmpts,$tmpct,$Margin, $CISwins,$CISlosses,$OAwins,$OAlosses) = split(':',$_); $tmpct = sprintf("%.3f", $tmpct); ## converts to 3 places $tmpct =~ s/^0/ /g; ## replace Leading Zeros print STANHTML " "; } ##====================================================== ##================AUS Nelson ======================= print STANHTML " "; open (STANAUSN, ") { ($tm,$tmconf,$tmgp,$tmw,$tml,$tmf,$tma,$tmpts,$tmpct,$Margin, $CISwins,$CISlosses,$OAwins,$OAlosses) = split(':',$_); $tmpct = sprintf("%.3f", $tmpct); ## converts to 3 places $tmpct =~ s/^0/ /g; ## replace Leading Zeros print STANHTML " "; } ##================ QUEBEC ===================== print STANHTML " "; open (STANQUE, ") { ($tm,$tmconf,$tmgp,$tmw,$tml,$tmf,$tma,$tmpts,$tmpct,$Margin, $CISwins,$CISlosses,$OAwins,$OAlosses) = split(':',$_); $tmpct = sprintf("%.3f", $tmpct); ## converts to 3 places $tmpct =~ s/^0/ /g; ## replace Leading Zeros print STANHTML " "; } ##================OUAE======================= print STANHTML " "; open (STANOUAE, ") { ($tm,$tmconf,$tmgp,$tmw,$tml,$tmf,$tma,$tmpts,$tmpct,$Margin, $CISwins,$CISlosses,$OAwins,$OAlosses) = split(':',$_); $tmpct = sprintf("%.3f", $tmpct); ## converts to 3 places $tmpct =~ s/^0/ /g; ## replace Leading Zeros print STANHTML " "; } ##================OUAW======================= print STANHTML " "; open (STANOUAW, ") { ($tm,$tmconf,$tmgp,$tmw,$tml,$tmf,$tma,$tmpts,$tmpct,$Margin, $CISwins,$CISlosses,$OAwins,$OAlosses) = split(':',$_); $tmpct = sprintf("%.3f", $tmpct); ## converts to 3 places $tmpct =~ s/^0/ /g; ## replace Leading Zeros print STANHTML " "; } ##================CWGP======================= print STANHTML " "; open (STANCWGP, ") { ($tm,$tmconf,$tmgp,$tmw,$tml,$tmf,$tma,$tmpts,$tmpct,$Margin, $CISwins,$CISlosses,$OAwins,$OAlosses) = split(':',$_); $tmpct = sprintf("%.3f", $tmpct); ## converts to 3 places $tmpct =~ s/^0/ /g; ## replace Leading Zeros print STANHTML " "; } ##================CWC======================= print STANHTML " "; open (STANCWC, ") { ($tm,$tmconf,$tmgp,$tmw,$tml,$tmf,$tma,$tmpts,$tmpct,$Margin, $CISwins,$CISlosses,$OAwins,$OAlosses) = split(':',$_); $tmpct = sprintf("%.3f", $tmpct); ## converts to 3 places $tmpct =~ s/^0/ /g; ## replace Leading Zeros print STANHTML " "; } ##================CWW======================= print STANHTML " "; open (STANCWW, ") { ($tm,$tmconf,$tmgp,$tmw,$tml,$tmf,$tma,$tmpts,$tmpct,$Margin, $CISwins,$CISlosses,$OAwins,$OAlosses) = split(':',$_); $tmpct = sprintf("%.3f", $tmpct); ## converts to 3 places $tmpct =~ s/^0/ /g; ## replace Leading Zeros print STANHTML " "; } print STANHTML "
2001-02 Womens BB Standings
  CONFERENCE CIS Oall
AUS Baldwin W  L   F A   P Pct W L W L
$tm $tmw$tml $tmf$tma$tmpts $tmpct $CISwins$CISlosses $OAwins$OAlosses
AUS Nelson W  L   F A   P Pct W L W L
$tm $tmw$tml $tmf$tma$tmpts $tmpct $CISwins$CISlosses $OAwins$OAlosses
Quebec W  L   F A   P Pct W L W L
$tm $tmw$tml $tmf$tma$tmpts $tmpct $CISwins$CISlosses $OAwins$OAlosses
OUAE  W  L   F A   P Pct W L W L
$tm $tmw$tml $tmf$tma$tmpts $tmpct $CISwins$CISlosses $OAwins$OAlosses
OUAW W  L   F A   P Pct W L W L
$tm $tmw$tml $tmf$tma$tmpts $tmpct $CISwins$CISlosses $OAwins$OAlosses
CW Plains W  L   F A   P Pct W L W L
$tm $tmw$tml $tmf$tma$tmpts $tmpct $CISwins$CISlosses $OAwins$OAlosses
CW Central W  L   F A   P Pct W L W L
$tm $tmw$tml $tmf$tma$tmpts $tmpct $CISwins$CISlosses $OAwins$OAlosses
CW West W  L   F A   P Pct W L W L
$tm $tmw$tml $tmf$tma$tmpts $tmpct $CISwins$CISlosses $OAwins$OAlosses
"; ### END STANDINGS PAGE ### ## Tm conf g w l f a m p % fgp agp mgp ##York:aAUS:8:3:5:99:205:-106:6:0.375:12.375:25.625:-13.25 ## 1 2 3 4 5 6 7 8 9 10 11 12 13 #------------------------------------------------------------------ #------------------------------------------------------------------