Skating System


Provides an implementation of the skating system used for scoring dance comeptitions, as well as a few other types of competition.

Usage


First create a hash of the judges marks @couples_marks = { @entree1=>{@judge1=>1, @judge2=>1, @judge3=>3 },

@entree2=>{@judge1=>2, @judge2=>3, @judge3=>2 },
@entree3=>{@judge1=>3, @judge2=>2, @judge3=>1 }}

Create a new PerformanceResults object, and then call its score method @performance_resuts = SkatingSystem::PerformanceResults.new @performance_resuts.score(@couples_marks) Then you can access the ranking for the couples via @performance_resuts.ranking.should be(@ranking)

The skating system is as follows:

********* The Marking of Adjudicators' Cards
  1.
     In all rounds each judge must vote for the number of couples
  demanded by the Chairman of Adjudicators. 

  2.
     In the Final round each judge shall place all the competing
  couples in order of merit in each of the dances. 

  3.
     In the Final round the judge shall mark his first couple 1, his
  second couple 2, his third 3, and so on in each of the dances. 

  4.
     A judge must not tie couples for any place in the Final of any dance.

     Note:

           Number of Couples to Dance in a Final

        1.            
          In the Final round the open system of marking shall be used. 

        2.
           When judges are instructed to select six couples for a
           Final and six couples are clearly chosen only that number
           shall dance. The same procedure would be observed if the 
           Chairman's instructions were for any other number. 

        3.
           If it is intended that six couples shall dance in a Final
           and through a tie more couples qualify for consideration
           the number to dance shall be decided by the Chairman. The
           same procedure would be observed if it is intended to have
           a Final of any other number.

********* The Allocation of Positions in Each Dance

5.
   The winner of a particular dance is the couple who is placed
   first by an absolute majority of judges; second, the couple who
   is placed second or higher by an absolute majority. The
   remaining positions are allocated in a similar way. 

   If More that One Couple have a Majority for the Same Position

6.
   The couple with the largest majority shall be allocated the
   position under review, and the couple with the next largest
   majority, the following position. 

   Note:

   If the position under review is the "2nd" and two couples have a
   majority of "2nd and higher" places, the couple with the larger
   majority shall be placed "2nd" and the other couple "3rd". 

   We now examine the remaining competitors' markings, and the
   couple with the largest majority of "3rd and higher" places
   shall be allocated the next position, which in this example, is
   the "4th". 

   If none of the remaining couples has a majority of "3rd and
   higher" places, then include the "4th" places (and, if
   necessary, lower places).

********* If Two or More Couples have an Equal Majority for the Same Position

7.
   a) If such majorities are equal, then the lowest total of marks
   given by those judges who form the majority, shall determine the
   allocation of the position under review. 

   Note:

   If the position under review is the "2nd" and two couples have a
   similar majority of "2nd and higher" places, the couple with the
   lower total of marks given by those judges who form the
   majority, shall be allocated the "2nd" position and the other
   couple the "3rd". 

   b) If the totals of the marks are equal, then the next lower
   place (or places, if necessary), in respect of the particular
   couples concerned, must be included. 

   Note:

   It should be noted that only the couples who have a majority for
   the position under review (say, for example, the "2nd" position)
   must be considered at this stage, and only their "3rd" places
   (and, if necessary, lower places) should be referred to, until
   the "2nd" position has been allocated. 

   A definite result will eventually be obtained unless the
   remaining markings are exactly the same, and should the latter
   be the case, there will, of course, be a tie for "2nd"
   position. If two couples were concerned, they would be allocated
   "2 1/2" each.

********* If No Couple receives a Majority for the Position Under Review

8.
   If no couple receives a majority of "Firsts" then the winner is
   the couple who are placed "2nd and higher" by a majority of
   judges. 

   If no couple receives a majority of "1st" and "2nd" places, then
   the "3rd" places (and if necessary, lower places) must be
   included. (Subject to Rules 6 and 7). 

   The "2nd" and other places should be calculated in a similar
   way.

********* Compilation of the Final Summary

9.
   When all the dances have been concluded, the order ascertained
   for each dance shall be carried to another sheet, showing the
   position achieved by each couple in each dance. The first in
   each dance shall be given one mark, the second two, and so
   on. These place marks shall be added up and the couple with the
   lowest aggregate shall be the winner.

********* If there is a Tie for a Place in the Final Summary

10.
    a) If this results in a tie for first place, the winner shall be
    the couple who has actually won the greater number of dances. 

    b) If there is a tie for the "2nd" place, the "2nd" prize shall
    be awarded to the couple who has obtained "2nd and higher" in
    the greatest number of dances. If the couples have obtained the
    same number of "2nd and higher" place marks, then add the "2nd
    and higher" place marks together and the couple with the lowest
    total should be awarded second prize. 

    Note:

    If more than two couples tie for second place, the second prize
    shall be awarded to the couple who has obtained the most "2nd
    and higher" place marks. Still only considering the remaining
    "tied" couples, the "3rd" prize is awarded to the couple who has
    won the most "3rd and higher" place marks. 

    c) If there is a tie for any remaining places they shall be
    decided on similar principles. 

11.

    If after applying Rules 9 and 10 this still results in a tie,
    then treat the judges' marks of the "tied" couples over all
    dances, as for an individual dance (Rules 5 to 8). If this still
    results in a tie, there shall be at the discretion of the
    organizers of the competition, either a re-dance or the prizes
    for the places under review shall be divided. 

    a) If the tie is for first place, a majority of "1st" marks to
    the credit of either of the "tied" couples (4 dances-5
    judges-majority 11) would win. If neither of the "tied" couples
    receive a majority of "firsts" see Rule 8. 

    b) If the tie is for second place, a majority of "2nd and
    higher" marks to the credit of either of the "tied" couples
    would be necessary. If neither of the "tied" couples obtain a
    majority of "2nd and higher" marks see Rule 8. 

    c) The "3rd" or any other "tied" places should be decided on similar principles.

    d) If 3 (or more) couples tie for a place under Rule 10 (say,
    2nd place) Rule 11 is applied to all couples concerned in the
    tie, and the best couple is awarded the "2nd" place. Rule 10 is
    now applied to the remaining "tied" couples for consideration of
    the place now under review, which is the "3rd". However, if they
    now tie for "3rd" under Rule 10, then Rule 11 is again applied
    to these "tied" couples, commencing this time with the "3rd and
    higher" judges's marks in the individual dances.

It is distributed under the MIT Licence, see licence.txt for the details