in reply to Adding Special Rules to Sort
I have written this same sort of formula before and it is actually pretty easy as long as you avoid the working with the A vs B vs C headache.
sub _team_standings { $b->get_wins_total <=> $a->get_wins_total or $b->get_wins_division <=> $a->get_wins_division or $b->get_wins_home <=> $a->get_wins_home or $b->get_run_difference <=> $a->get_run_difference or $b->get_runs_scored <=> $a->get_runs_scored or $a->get_reg_schedule_id <=> $b->get_reg_schedule_id }
If you notice, I am sorting my teams all based upon some team stat except the last one. There I am using a schedule id as my tie breaker instead of a head-to-head comparison.
The problem with the head-to-head comparison is when you have 3 or more teams tied together and you are trying to determine who would be ahead, it creates a catch-22 scenario. Example:
A beat B B beat C C beat A
If you are trying to use head-to-head comparison, there is no way to resolve it. You are basically down to using a coin flip or some other stat to resolve the issue.
For the sake of simplicity, I would ignore using head-to-head comparisons and look at other values instead.
|
|---|