% This program computes the final standings in each of the eight divisions. % Copyright 2006 by William S. Krasker place=zeros(4,8); % At the end, this array will contain the standings. for d=1:8 nteams0=4; origteams0=[(d-1)*4+1; (d-1)*4+2; (d-1)*4+3; (d-1)*4+4]; teams0=origteams0; % find first-place team in division for n=1:5 [teams1,nteams1,exitcode]=divtiebreaker(teams0,nteams0,a,conf,div,wltpct,cwltpct,dwltpct,sov,sos); if nteams1==1 place(1,d)=teams1(1); nteams0=3; count=0; for r=1:4 if origteams0(r)~=place(1,d) count=count+1; teams0(count)=origteams0(r); end end break end nteams0=nteams1; teams0=teams1; end % find second-place team in division for n=1:5 [teams1,nteams1,exitcode]=divtiebreaker(teams0,nteams0,a,conf,div,wltpct,cwltpct,dwltpct,sov,sos); if nteams1==1 place(2,d)=teams1(1); nteams0=2; count=0; for r=1:4 if (origteams0(r)~=place(1,d)) & (origteams0(r)~=place(2,d)) count=count+1; teams0(count)=origteams0(r); end end break end nteams0=nteams1; teams0=teams1; end % find third- and fourth-place teams in division for n=1:5 [teams1,nteams1,exitcode]=divtiebreaker(teams0,nteams0,a,conf,div,wltpct,cwltpct,dwltpct,sov,sos); if nteams1==1 place(3,d)=teams1(1); for r=1:4 if (origteams0(r)~=place(1,d)) & (origteams0(r)~=place(2,d)) & (origteams0(r)~=place(3,d)) place(4,d)=origteams0(r); end end break end nteams0=nteams1; teams0=teams1; end end