Package bosco :: Module ranking :: Class Relay24hScoreing
[hide private]
[frames] | no frames]

Class Relay24hScoreing

source code

   object --+            
            |            
CachingObject --+        
                |        
 AbstractScoreing --+    
                    |    
   object --+       |    
            |       |    
CachingObject --+   |    
                |   |    
        Validator --+    
                    |    
AbstractRelayScoreing --+
                        |
                       Relay24hScoreing

This class is both a validation strategy and a scoreing strategy. The strategies are combined because they use some common private functions. This class validates and scores teams for the 24h relay.

Instance Methods [hide private]
 
__init__(self, starttime, speed, duration, event, method='runcount', blocks='finish', cache=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_loop_over_runs(self, team)
This is an utility function to not duplicate code in _check_order and _omitted_runners.
source code
 
_check_order(self, team)
Checks if the order of the runners is correct.
source code
 
_omitted_runners(self, team)
Count the runners that were omitted during the event and gave up.
source code
 
_check_pools(self, team) source code
 
validate(self, team)
Validate the runs of this team according to the rules of the 24h orienteering event.
source code
 
score(self, team)
Compute score for a 24h team according to the following rules:
source code

Inherited from AbstractRelayScoreing (private): _runs

Inherited from CachingObject (private): _from_cache, _to_cache

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  START = re.compile('^SF[1-4]$')
  NIGHT = re.compile('^[LS][DE]N[1-5]$')
  DAY = re.compile('^[LS][DE][1-4]$')
  FINISH = re.compile('^FF[1-6]$')
  POOLNAMES = ['start', 'night', 'day', 'finish']

Inherited from AbstractScoreing: information

Inherited from Validator: DID_NOT_FINISH, DID_NOT_START, DISQUALIFIED, MISSING_CONTROLS, NOT_COMPLETED, OK

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, starttime, speed, duration, event, method='runcount', blocks='finish', cache=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • starttime (datetime.datetime) - Start time of the event.
  • speed (int) - expected speed in minutes per kilometers. Used to compute penalty time for invalid runs
  • event - object of class Event to score and validate single runs
  • duration - Duration of the event
  • method (str) - score calculation method, currently implemented: runcount: count valid runs lkm: sum of lkms of all valid runs
  • blocks - score until the end of this block. Possible blocks: 'start', 'night', 'day', 'finish' (default)
Overrides: object.__init__

_loop_over_runs(self, team)

source code 

This is an utility function to not duplicate code in _check_order and _omitted_runners. It loops over all runs, counts the omitted runners and checks the order. Returns a tuple (validation_code, number_of_omitted_runners).

validate(self, team)

source code 

Validate the runs of this team according to the rules of the 24h orienteering event. The following rules apply:

  • runners must run in the defined order, omitted runners may not run again
  • every runner must run at least once at the beginning of the event
  • runs must be run in the following order:
    • 4 start courses (Codes SF1-4), fixed order defined for each team
    • night courses (Codes LDNx, LENx, SDNx, SENx), free order choosen by team
    • day courses (Codes LDx, LEx, SDx, SEx), free order choosen by team
    • 6 finish courses (Codes FF1-6), same order for each team
Overrides: Validator.validate

score(self, team)

source code 

Compute score for a 24h team according to the following rules:

  • compute finish time:
    • 24h - (omitted_runners - 1) * 30min - sum(expected_time - running_time) for all failed runs
  • count valid runs completed before the finish time
  • record finish time of the last VALID run The result is a 24hScore object consisting of the number of runs and the finish time of the last run (not equal to the finish time computed in the first step!).
Overrides: AbstractScoreing.score