Class: Olympic::Bracket::SingleElimination

Inherits:
Base
  • Object
show all
Extended by:
Memoist
Includes:
Information
Defined in:
lib/olympic/bracket/single_elimination.rb,
lib/olympic/bracket/single_elimination/information.rb

Overview

A single elimination tournament. A single elimination tournament is a tournament of a set of teams in which the first loss results in elimination from the tournament. Single elimination tournaments have the problem in which when the number of teams is not equal to a power of two, at least one bye is required.

Defined Under Namespace

Modules: Information

Instance Method Summary collapse

Methods included from Information

#byes, #first_round_matches, #matches, #rounded_teams, #rounds

Methods inherited from Base

#byes, #first_round_matches, #initialize, #matches, #rounded_teams, #rounds

Constructor Details

This class inherits a constructor from Olympic::Bracket::Base

Instance Method Details

#callObject

Creates a single elimination tournament, by setting up the needed matches (and their respective sources).



19
20
21
22
# File 'lib/olympic/bracket/single_elimination.rb', line 19

def call
  matches = pair(initial_sources)
  @tournament.root = matches.sort_by(&:depth).last
end