Part 3 of the specification said that if you tied on the first two criteria but had played head to head, then the winner should be ranked first except when that win is part of a cycle like the one where where A beats B beats C beats A. The challenge is therefore how to calculate which wins should be counted, and which wins are to be ignored because they are part of a cycle.
My solution was to take the transitive closure of the relation "won over". This is the relation "there is a chain of wins leading from one to the other." Once you have that transitive closure, you can easily find whether a particular win is part of a cycle. If A beat B, but there is a chain of wins from B to A, then A's win over B is part of a cycle and can't be used in that criteria. If A beat B and there is no chain of wins from B to A, then A's win can be used as a sorting criteria.
Now one can debate whether the best way to do this is to compute the whole transitive closure up front. But there is no way of solving the question asked without somehow being able to figure out whether a given win is part of an ambiguous cycle or not. And the process of doing that when A beat B is exactly the same as answering the question of whether (B, A) is in the transitive closure of the relation "won over". So you can't get away from dealing with the transitive closure, whether or not you use that language or whether you compute the whole thing or just part of it on demand.
Please note in particular that simply encoding wins in numbers in some fancy way will not readily let you know which wins are to be used as sorting criteria, and which need to be discarded as being ambiguous.
In reply to Re^8: Adding Special Rules to Sort
by tilly
in thread Adding Special Rules to Sort
by ctfishman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |