Module: TournamentSystem::Swiss::AcceleratedDutch

Extended by:
AcceleratedDutch
Included in:
AcceleratedDutch
Defined in:
lib/tournament_system/swiss/accelerated_dutch.rb

Overview

A implementation of accelerated (dutch) swiss pairing

Instance Method Summary collapse

Instance Method Details

#pair(driver, options = {}) ⇒ Array<Array(team, team)>

Pair teams using the accelerated (dutch) swiss pairing system.

Behaves identical to the dutch pairing system, except that for the first N rounds the top half of the seeded teams is given a point bonus. This makes the first couple rounds of a tournament accelerate 1 round ahead of swiss.

Options are passed to the dutch system and behave identically.

Parameters:

  • driver (Driver)
  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • acceleration_rounds (Integer)

    determines how many round to perform the acceleration for. This should be shorter than the length of the tournament in order to produce fair results.

  • acceleration_points (Number)

    determines how many points to grant the teams. This should be approximately equal to the number of points usually granted in one round.

Returns:

  • (Array<Array(team, team)>)

    the generated pairs of teams


24
25
26
27
28
29
30
31
32
33
# File 'lib/tournament_system/swiss/accelerated_dutch.rb', line 24

def pair(driver, options = {})
  acceleration_rounds = options[:acceleration_rounds] || 2
  acceleration_points = options[:acceleration_points] || 1

  # Accelerate for the first N rounds by replacing the driver with an accelerated one
  driver = accelerate_driver(driver, acceleration_points) if Swiss.guess_round(driver) < acceleration_rounds

  # Do a regular dutch pairing
  Dutch.pair(driver, options)
end