Jump to content


Photo

"If the Playoffs Were To Start Today" module


488 replies to this topic

#1 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,703 posts
  • Gender:Male
  • Location:Leamington ON, Canada

  • 2017 MFL: 55681
  • , 18835

Posted 27 October 2006 - 12:53 PM

PLEASE USE THE NEW GENERATOR AS THE ONE CONTAINED IN THIS THREAD IS NO LONGER BEING UPDATED:

 

NEW ====> REPORT GENERATOR

 

 

 

 

===========================================================================================

 

I have a module working for my league that will automatically determine the division winners and wild-card teams according to my leagues rules.

You can check it out here: http://football24.my...2006/home/19610 (under the 'Playoffs' tab)

If you would like something similar then just copy the below code to where you would like the module to appear on your home page.



 

<script language="JavaScript" type="text/javascript" src="http://www.habman.com/mfl/apps/js/habman_apps_ver2.js"></script>
<script language="JavaScript" type="text/javascript">
<!--
// Tie-Breaker Legend:
// 1 - Winning Percentage
// 2 - Divisional Winning Percentage
// 3 - Divisional Points For
// 4 - Points For
// 5 - Victory Points
// 6 - Power Rank
// 7 - Play-All Winning Percentage
// 8 - Head to Head
// 9 - Coin Flip (ie random)
// 10 - Non-Divisional Winning Percentage
// 11 - Non-Divisional Points For
// 12 - Reverse Points Allowed
// 13 - Conference Winning Percentage
// 14 - Conference Points For
// 15 - Non-Conference Winning Percentage
// 16 - Non-Conference Points For
// 17 - Common Games (default 4 game minimum; see var below)
// 18 - Head to head points scored
// 19 - Strength of Schedule
// 20 - Strength of Victory
// 0 - Default (must be included at the end of the arrays below)

// Assign tie-breakers into the respective arrays using the legend above.
var divisionTieBreaker = [1,8,2,3,4,9,0];
var wildCardTieBreaker = [1,8,4,9,0];
var numWildCardTeams = 4;

// OPTIONAL VAR SECTION change variables below to suit your league
var useStartOverRule = false; //MFL default is false; most leagues are true
var useDivisionBestRule = false;
var useSweepRule = false;
var conferenceLikeDivision = false;
var numDivisionTeams = 1;
var commonGameMinGP = 4; //Works in conjunction with common games tiebreaker
var scoringDecimals = 2; //Sets the decimal display for all scoring in the tables
var useDivisionIcon = false; //Place a coloured icon in the tables distinguishing divisions

// NO NEED TO EDIT BELOW THIS LINE

synchronousXMLRequest(leagueFile, 'getLeagueData', 'league')
synchronousXMLRequest(standingsFile,'doStandingsArray','standings')

doHeadToHeadArray();
doPlayoffTable();

//-->
</script>



Currently there are 16 tiebreakers to choose from. Just set up the Divisional and WildCard tiebreaker arrays in the code above to meet your leagues needs. You must leave the 0 as the last entry.

For instance if my divisional tiebreaker was: 1)Divisional Points Scored 2)Divisional Winning %
Then my divisional tiebreaker array would be var divisionTieBreaker = [3,2,0];

Also enter the number of wild card teams for your league.



OTHER NOTES & SETTINGS

Special Seed

  • Set the last playoff spot based on a specific category
  • Use tiebreaker legend above to set the specialSeed array
  • Add the following var to the VAR SECTION in the code above to enable

 

var specialSeed = [7,6,5,4,0];


If you add the var specialSeed as shown above it will search the teams that are out of the playoffs and add the teams with the best playall win%. If tied then power rank all the way down the line until the seed is assigned.

================================================================


Table Captions

  • Use alternative text in the table captions
  • Change the quoted text to whatever you want
  • You can use html here but use single quotes if quotes are required
  • Listed below are the default settings
  • Add the following var(s) to the VAR SECTION in the code above to enable

 

var titleHeader = "<h4>If the playoffs were to start today</h4>";
var titleDivisionWinner = "Division Winners";
var titleWildCardWinner = "Wild Card Winners";
var titleNonPlayoffTeam = "Out of the Playoffs";
var titlePlayoffTeam = "Playoff Teams";



================================================================


Columns to Display

  • Set the stats columns that are to be displayed in the table(s)
  • Default columns are shown in the code below i.e. Overall Record and Points Scored
  • Set the array using the legend below
  • You can display as many columns as you want
  • Add the following var to the VAR SECTION in the code above to enable

 

var displayColumns = [6,8];

Here is the Column to Display legend:
1&2 are unused
3 = Wins
4 = Losses
5 = Ties
6 = Record
7 = Win %
8 = Points Scored
9 = Points Allowed
10 = Divisional Wins
11 = Divisional Losses
12 = Divisional Ties
13 = Divisional Record
14 = Divisional Win %
15 = Divisional Points Scored
16 = Power Ranking
17 = Victory Points
18 = Play-All Wins
19 = Play-All Losses
20 = Play-All Ties
21 = Play-All Record
22 = Play-All Win %
23 = Non-divisional Wins
24 = Non-divisional Losses
25 = Non-divisional Ties
26 = Non-divisional Record
27 = Non-divisional Win %
28 = Non-divisional Points Scored
29 = Conference Wins
30 = Conference Losses
31 = Conference Ties
32 = Conference Record
33 = Conference Win %
34 = Conference Points Scored
35 = Non-Conference Wins
36 = Non-Conference Losses
37 = Non-Conference Ties
38 = Non-Conference Record
39 = Non-Conference Win %
40 = Non-Conference Points Scored
42 = Strength of Schedule Record
43 = Strength of Schedule Win %

================================================================


Division Best Wildcard Seeding

  • For leagues that only compare the best unseeded team in a division for each wildcard playoff seed.
  • This is similar to how the NFL seeds wildcard teams
  • Add the following var to the VAR SECTION in the code above to enable

 

var useDivisionBestRule = true;




================================================================



Conference-like Divisions

  • For leagues without conferences (only divisions) but would like to have their own seperate playoffs for each division
  • see Damage Ink's post for more details
  • Add the following var to the VAR SECTION in the code above to enable

 

var conferenceLikeDivision = true;



================================================================



Division Winners/Leaders

  • For leagues that would like to automatically advance more than one team from one division before getting to the wildcard tiebreakers.
  • Add the following var to the VAR SECTION in the code above and set it to the number of divisional teams that will automatically advance.

 

var numDivisionTeams = 2;

The code above will automatically advance two teams from one division before doing the wildcards.



================================================================

Info on Head to Head tiebreakers
For Two-Teams: this tiebreaker works as everyone would expect. If the two teams played each other then the team with the better win% wins the tiebreaker.

For Three or More Teams (default rule): this app, by default, uses MFL's rule of "Head to head Winning Percentage" for both divisional and wildcard tiebreakers. How this works is you take all the teams tied and look at the games between them. You would then calculate a winning percentage for each team based on the wins/losses/ties each team has accumulated in these games and the team with the highest winning percentage would advance. If a team hasn't played any of the other tied teams then they will be given a 0.000 winning percentage for sorting purposes (MFL's rule not mine)

You can set the way this app enforces Head to Head Winning Percentage to suit your leagues needs:

There are four different settings:
0: Use head to head winning percentage for two teams tied only. If more than two teams then skip to the next tiebreaker.
1: Use MFL's default rule as described above. This is also the default setting for this var.
2: All the tied teams must have played at least one of the other tied teams.
3: All the tied teams must have played all of the other tied teams at least once.

To set the Winning Percent Rule use the following var

var useWinPctRule = 1;




For Three or More Teams (optional sweep rule): This works like the NFL "Sweep Rule" for head to head tiebreakers when three or more teams are tied. This applies for wild-card tiebreakers only. How this works is that one team must have swept or been swept by all the other tied teams before advancing or being eliminated from the tiebreaking process.

To activate the sweep rule for wildcard tiebreakers add the following var


var useSweepRule = true;

Note: if activated this will be used instead of the default rule for wildcard tiebreakers only. Divisional tiebreakers will still use the default rule explained above. This rule when activated will also set the useStartOverRule (see other notes below) to true because it doesn't make sense otherwise.



================================================================



Optional CSS Settings

  • Each table has an ID associated with it
  • You can use these ID's in your custom CSS file to set attributes for the tables
  • The ID names for each table can be attained by hovering over the table caption and a tooltip will display the name

Notes:
- If a table is empty it will automatically be hidden
- There is an outer table nesting all the tables that may appear invisible if your league has only one conference. You can not get the table ID for this outer table using the tooltip method because no caption will be displayed. To get this table ID do the following. If the nested tables ID's last digit is "1" then the table ID for this table is "outerplayoff_table0-1". If "2" then the ID is "outerplayoff_table0-2" etc.

Sample CSS code to hide Division Winners Caption assuming id is divisionwinner_table0-0.

#divisionwinner_table0-0 {
display: none;
}



================================================================


Other Notes
This app, by default, uses MFL sorting rules which do not start over from the first tiebreaker after a team is assigned a seed.

Most leagues (IMO) use the NFL rule that only one club advances to the playoffs or is eliminated from the playoffs in any tie-breaking step. Remaining tied clubs revert to the first step of the applicable Division or Wild-Card tie breakers

To activate this rule use the following var

var useStartOverRule = true;




================================================================

My ultimate goal is to make a module that will work for most MFL leagues. That being said I am looking for input on how to improve the module by adding more tie-breakers that I am overlooking that you would like to see included.


My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#2 joe.commish

joe.commish

    Veteran

  • Members
  • PipPipPip
  • 919 posts
  • Gender:Male
  • Location:SE Wisconsin

Posted 27 October 2006 - 01:04 PM

Another great script, habman. One of my leagues uses Victory Points as a tiebreaker. That would be one that I would request. Thanks for all you do!
Codes, Applications and CSS tweaks -- http://forums.myfant...showtopic=23490

#3 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,703 posts
  • Gender:Male
  • Location:Leamington ON, Canada

  • 2017 MFL: 55681
  • , 18835

Posted 27 October 2006 - 01:18 PM

Another great script, habman. One of my leagues uses Victory Points as a tiebreaker. That would be one that I would request. Thanks for all you do!



Alright I added Victory Points and while I was at it I added Power Rank and All-Play winning percentage.
My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#4 joe.commish

joe.commish

    Veteran

  • Members
  • PipPipPip
  • 919 posts
  • Gender:Male
  • Location:SE Wisconsin

Posted 27 October 2006 - 02:17 PM


Another great script, habman. One of my leagues uses Victory Points as a tiebreaker. That would be one that I would request. Thanks for all you do!



Alright I added Victory Points and while I was at it I added Power Rank and All-Play winning percentage.


Great!

How about head-to-head record?
Codes, Applications and CSS tweaks -- http://forums.myfant...showtopic=23490

#5 bonscott

bonscott

    Veteran

  • Members
  • PipPipPip
  • 7,786 posts
  • Gender:Male

Posted 27 October 2006 - 02:27 PM

Hmmm, it's not showing up for me. I have it as homepage message #9 and have added it to the bottom of the page for testing.

http://football3.myf...2006/home/27323


 


#6 joe.commish

joe.commish

    Veteran

  • Members
  • PipPipPip
  • 919 posts
  • Gender:Male
  • Location:SE Wisconsin

Posted 27 October 2006 - 02:36 PM

Hmmm, it's not showing up for me. I have it as homepage message #9 and have added it to the bottom of the page for testing.

http://football3.myf...2006/home/27323


For the record, it is not showing for me either. I had just started suggesting more tiebreakers without actually putting this on my site. I have it in message 5 -- also at the bottom.
Codes, Applications and CSS tweaks -- http://forums.myfant...showtopic=23490

#7 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,703 posts
  • Gender:Male
  • Location:Leamington ON, Canada

  • 2017 MFL: 55681
  • , 18835

Posted 27 October 2006 - 02:49 PM


Hmmm, it's not showing up for me. I have it as homepage message #9 and have added it to the bottom of the page for testing.

http://football3.myf...2006/home/27323


For the record, it is not showing for me either. I had just started suggesting more tiebreakers without actually putting this on my site. I have it in message 5 -- also at the bottom.



:unsure: Okay let me look into this.


EDITED TO ADD

My bubble sort is failing for your leagues. I have gotten the tables to appear by bypassing the bubble sort. Please don't remove the code until I can figure this out. TIA.
My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#8 bonscott

bonscott

    Veteran

  • Members
  • PipPipPip
  • 7,786 posts
  • Gender:Male

Posted 27 October 2006 - 03:38 PM

No problem. I can't really use the script anyway in it's current state for tiebreakers. Here is why:

We use the NFL rule of "division best". In other words if you have 4 teams tied from various divisions only the best of each division should be considered for the first run at the tiebreak. I have a perfect example of that now in my league. I have 4 teams tied at 4-3.

In South division we have:
Killer BBs
Amish Beavers

In West division we have:
River City Mudsharks
Shetland Ponies

Our first wildcard tiebreak is total points. If all 4 were lumped together the Ponies would be first because they have the most points. But wait, they are *behind* the Mudsharks in their division (due to head 2 head). Why should the Ponies then outrank the Mudsharks in the wildcard race?

So with the first pass we compare the BBs and Mudsharks. Mudsharks win with more points.
So now we compare the BBs and Ponies. Ponies win with more points.
Now it's the BBs and Beavers and they rank out as they are in the division, BBs then Beavers.

I've been trying for a couple years to get MFL to support this but so far notta. Not sure if your script can or not. Hopefully I explained myself well.

------------------------------------------------------------

We also use head 2 head as our first tiebreak within the division. Not sure if the Tiebreaker report is available via XML? If so it would have that information in it.


 


#9 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,703 posts
  • Gender:Male
  • Location:Leamington ON, Canada

  • 2017 MFL: 55681
  • , 18835

Posted 27 October 2006 - 04:57 PM

No problem. I can't really use the script anyway in it's current state for tiebreakers. Here is why:

We use the NFL rule of "division best". In other words if you have 4 teams tied from various divisions only the best of each division should be considered for the first run at the tiebreak. I have a perfect example of that now in my league. I have 4 teams tied at 4-3.

In South division we have:
Killer BBs
Amish Beavers

In West division we have:
River City Mudsharks
Shetland Ponies

Our first wildcard tiebreak is total points. If all 4 were lumped together the Ponies would be first because they have the most points. But wait, they are *behind* the Mudsharks in their division (due to head 2 head). Why should the Ponies then outrank the Mudsharks in the wildcard race?

So with the first pass we compare the BBs and Mudsharks. Mudsharks win with more points.
So now we compare the BBs and Ponies. Ponies win with more points.
Now it's the BBs and Beavers and they rank out as they are in the division, BBs then Beavers.

I've been trying for a couple years to get MFL to support this but so far notta. Not sure if your script can or not. Hopefully I explained myself well.

------------------------------------------------------------

We also use head 2 head as our first tiebreak within the division. Not sure if the Tiebreaker report is available via XML? If so it would have that information in it.



I will work on these tie breakers once I figure out why the script is failing. I have narrowed it down to one specific sorting routine but I am still not sure why it's failing.

Thanks again for leaving the script on your page while I am testing.
My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#10 joe.commish

joe.commish

    Veteran

  • Members
  • PipPipPip
  • 919 posts
  • Gender:Male
  • Location:SE Wisconsin

Posted 27 October 2006 - 06:27 PM

I will work on these tie breakers once I figure out why the script is failing. I have narrowed it down to one specific sorting routine but I am still not sure why it's failing.

Thanks again for leaving the script on your page while I am testing.


No problem, habman. I'll leave it there until you tell me you are done testing.
Codes, Applications and CSS tweaks -- http://forums.myfant...showtopic=23490

#11 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,703 posts
  • Gender:Male
  • Location:Leamington ON, Canada

  • 2017 MFL: 55681
  • , 18835

Posted 27 October 2006 - 06:30 PM


I will work on these tie breakers once I figure out why the script is failing. I have narrowed it down to one specific sorting routine but I am still not sure why it's failing.

Thanks again for leaving the script on your page while I am testing.


No problem, habman. I'll leave it there until you tell me you are done testing.



Okay I figured out what was wrong. Thanks Joe and Scott for allowing me to do those tests.

You can remove the module if you want or put it in a place that is more suitable. I will continue to work on the head to head tiebreaker and the playoff system that Scott mentioned.

Thanks again.
My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#12 Damage_ink

Damage_ink

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 27 October 2006 - 08:18 PM



I will work on these tie breakers once I figure out why the script is failing. I have narrowed it down to one specific sorting routine but I am still not sure why it's failing.

Thanks again for leaving the script on your page while I am testing.


No problem, habman. I'll leave it there until you tell me you are done testing.



Okay I figured out what was wrong. Thanks Joe and Scott for allowing me to do those tests.

You can remove the module if you want or put it in a place that is more suitable. I will continue to work on the head to head tiebreaker and the playoff system that Scott mentioned.

Thanks again.


Habman this looks great but I have a question...

My league has two Divisions of Ten teams each. The top four from each division make it to there own playoffs...In your table it counts all twenty teams together as one playoff......

Thanks again for all your help...with this and many previous issues...

#13 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,703 posts
  • Gender:Male
  • Location:Leamington ON, Canada

  • 2017 MFL: 55681
  • , 18835

Posted 27 October 2006 - 08:40 PM




I will work on these tie breakers once I figure out why the script is failing. I have narrowed it down to one specific sorting routine but I am still not sure why it's failing.

Thanks again for leaving the script on your page while I am testing.


No problem, habman. I'll leave it there until you tell me you are done testing.



Okay I figured out what was wrong. Thanks Joe and Scott for allowing me to do those tests.

You can remove the module if you want or put it in a place that is more suitable. I will continue to work on the head to head tiebreaker and the playoff system that Scott mentioned.

Thanks again.


Habman this looks great but I have a question...

My league has two Divisions of Ten teams each. The top four from each division make it to there own playoffs...In your table it counts all twenty teams together as one playoff......

Thanks again for all your help...with this and many previous issues...



I am just getting this off the ground. Obviously many leagues have different playoff setups. I will try to accomodate as many leagues as I can. Now that I know how your league works I will try to get something working for you.
My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#14 boogy

boogy

    Veteran

  • Members
  • PipPipPip
  • 184 posts

Posted 28 October 2006 - 02:54 AM

Hab,
If you get a chance, our tiebreakers are...
1. Overall Winning %
2. Head to Head
3. Total Points Scored

We have 3 divisions with the 3 divisional winners making the playoffs. Also, the top 3 wildcards, regardless of division, go to the playoffs.

TIA,
Boogy
WWW.VERSATILEFIGHTER.COM

#15 bonscott

bonscott

    Veteran

  • Members
  • PipPipPip
  • 7,786 posts
  • Gender:Male

Posted 28 October 2006 - 06:47 AM

Thanks Hab. Now I think you're probably seeing why MFL just lets everyone do their playoff brackets by hand. If you take 100 leagues there are probably at least 50 different ways to do tiebreakers for making the playoffs. ;)

I wish you luck. Renegade was the only one that I remember that got something like this working in his software and it still didn't support all tiebreakers.

Here are some common parameters I can think of off the top of my head:
1) How many in each division make the playoffs automatically? An example might be take the top 2 in each division and then the rest come from any division (wildcards in a way).
2) "Division best" in my case - by the way, you don't have to go to great lengths to support this method. While it makes total sense I'm not sure a lot of leagues use it.
3) I've seen leagues that will send 6 to the playoffs. Top 5 make it the "normal" way while the 6th spot is the team with the highest point total not already in the playoffs makes it. I've seen this 6th spot also be the team with the highest Victory Points not already in the playoffs.

There are more I'm sure but my brain isn't working this early in the morning. <_<

---------------------------------------------

FYI that I added a playoffs tab on my home page (which I need to do anyway for my brackets) and I put the module there so I'll leave it up for you to test on if you wish.


 




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users