Class: SeedList::Strategy::MLGPlayoff

Inherits:
Base
  • Object
show all
Defined in:
lib/seed_list/strategy.rb

Overview

TODO This strategy is implemented incorrectly, with an associated pending test. Best matched against worst, second best against second worst, and so on. Ensures that if the higher seed wins, he will always face someone from the lower half in the next round.

Instance Attribute Summary

Attributes inherited from Base

#players

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from SeedList::Strategy::Base

Instance Method Details

#seedObject



41
42
43
44
45
46
47
# File 'lib/seed_list/strategy.rb', line 41

def seed
  input, sequence, pairs, output = @players.clone, [], [], []
  input.size.times { |i| sequence << (i.even? ? input.shift : input.pop) }
  loop { pairs << sequence.shift(2); break if sequence.empty? }
  pairs.size.times { |i| output << (i.even? ? pairs.shift : pairs.pop) }
  output.flatten
end