Jump to content

Recommended Posts

Okay, I have a list of 10 teams and I need them sorted top to bottom in order of standing. Calculating their order is where I'm having the problem.

 

I order the teams by:

 

1. WIN PERCENTAGE

2. POINTS

3. RECORD AGAINST TEAM TIED WITH

4. WINS

5. RUNS DIFFERENTIAL

 

I have all these figured out except #3. I don't even know where to start (thus the no code posting). Assume I can get an array with any and all information needed.

 

Keep in mind this scenerio:

 

TEAM 1 beat TEAM 2 twice

TEAM 2 beat TEAM 3 twice

TEAM 3 beat TEAM1 twice

 

These three teams are essentially tied and need to revert to tied breaker #4. If you know of an article on this kind of algorithm or if you've done this yourself, please let me know.

Link to comment
https://forums.phpfreaks.com/topic/112981-sports-teams-standings-sorting/
Share on other sites

unless there is some sort of official rule.. they really aren't "tied" per se... I mean, team 2 never beat team 1. Team 3 never beat team 2.  Team 1 never beat team 3. 

 

I personally would just kinda make something up. Like...

 

team1 beat team2 50 to 40. That's 10 point margin for team1

team1 beat team2  45 to 42. That's 3 point margin for team1

 

team2 beat team3 64 to 36. That's 28 point margin for team2

team2 beat team3 19 to 12. That's 7 point margin for team2

 

team3 beat team1 42 to 40.  That's 2 point margin for team3

team3 beat team1 83 to 49.  That's 34 point margin for team3

 

totals:

team1: 13

team2: 35

team3: 36

 

Even then it's possible to "tie" so you can also consider margin of loss as well... you'd also maybe want to consider figuring these numbers on an overall scale. I mean, what if there was a team4 that had like 10 wins, 0 losses, but they only won by like 2 points every game, for a total of 20 point margin? Seems to me that that should somehow factor into this somehow, because team2 and team3 both have higher point margins.

 

Thanks for the reply

 

I understand what you're saying. My problem is in sorting the teams by how they played against each other, specifically how to create the relationship between each team.

 

I cannot change the ranking system as that is defined by the league and not by my program.

so...just make something up...like what I said.  I don't think the challenge is so much coding it but deciding on what's a "fair" way of ranking them.  Seems to me when you have a "circle" like that: 1 > 2 > 3 > 1 > 2 > 3 etc... that figuring out who won by the highest margins seems fair.  But maybe that's just me.  I'm not really into this sort of thing.

The circle was just an example, let's ignore the circle for a minute.

 

We have 4 teams:

 

TEAM 1 went 2 - 1

TEAM 2 went 2 - 1

TEAM 3 went 1 - 2

TEAM 4 went 1 - 2

 

TEAM 1 DEF. TEAM 2

TEAM 1 DEF. TEAM 3

TEAM 2 DEF. TEAM 3

TEAM 2 DEF. TEAM 4

TEAM 3 DEF. TEAM 4

TEAM 4 DEF. TEAM 1

 

How am I going to sort these teams? The rankings should be

 

TEAM 1 (Because they are tied for top of the league by their record WITH TEAM 2, who they beat)

TEAM 2 (Because they are tied for top of the league by their record WITH TEAM 1, who they lost to)

TEAM 3 (Because they are tied for bottom of the league by their record WITH TEAM 4, who they beat)

TEAM 4 (Because they are tied for bottom of the league by their record WITH TEAM 3, who they lost to)

 

How do I program this sort because on the logic in the parenthesis'?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.