secret
Last active

  • Download Gist
!rule.markdown
Markdown

The Rules

  1. 32 teams split into 4 teirs (by their FIFA ranking)
  2. 8 entries
  3. Each entry is randomly assigned 1 team per tier
app.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
require 'yaml'
 
@teams = YAML::load(File.open('teams.yaml'))
@players = %w[Player1 Player2 Player3 Player4 Player5 Player6 Player7 Player8]
 
results = Hash.new
players = @players.sort_by{rand}
 
players.each_with_index do |p, i|
results[p] = Array[@teams['teir_one'][i]]
end
 
second = @players.sort_by{rand}
second.each_with_index do |p, i|
results[p] << @teams['teir_two'][i]
end
 
third = @players.sort_by{rand}
third.each_with_index do |p, i|
results[p] << @teams['teir_three'][i]
end
 
fourth = @players.sort_by{rand}
fourth.each_with_index do |p, i|
results[p] << @teams['teir_four'][i]
end
 
p results
gistfile3.yml
YAML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
teir_one:
- Brazil
- Spain
- England
- Netherlands
- Argentina
- Germany
- Chile
- Portugal
teir_two:
- Uruguay
- Serbia
- Italy
- France
- Ivory Coast
- United States
- Mexico
- Paraguay
teir_three:
- Denmark
- Cameroon
- Australia
- South Korea
- Honduras
- Slovenia
- Nigeria
- Switzerland
teir_four:
- Ghana
- Greece
- Japan
- Slovakia
- South Africa
- Algeria
- North Korea
- New Zealand

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.