Skip to content

Instantly share code, notes, and snippets.

View albertbellonch's full-sized avatar

Albert Bellonch Llargués albertbellonch

View GitHub Profile
#!/usr/bin/env ruby
level1 = %w{ Roger Jorge Ferran Bernat }.shuffle
level2 = %w{ Victor Albert Gorka Alex }.shuffle
level3 = %w{ Dario Jon Marc Cesar }.shuffle
level4 = %w{ Txell Eliza Pablo Daniel }.shuffle
4.times do |group_i|
group_players = [
level1[group_i],
@albertbellonch
albertbellonch / keybase.md
Created September 18, 2014 10:47
keybase.md

Keybase proof

I hereby claim:

  • I am albertbellonch on github.
  • I am abellonch (https://keybase.io/abellonch) on keybase.
  • I have a public key whose fingerprint is C97C 8085 A173 BAE4 6393 C312 2659 3FF0 37FC F3D7

To claim this, I am signing this object:

@albertbellonch
albertbellonch / league.rb
Created September 4, 2014 21:56
Ping pong league
#!/usr/bin/env ruby
# Based on: http://en.wikipedia.org/wiki/Round-robin_tournament
def matches_schedule(players_count)
schedule = {}
matchdays = players_count - 1
matches_per_day = middle = players_count / 2
@albertbellonch
albertbellonch / pot_draw.rb
Last active August 29, 2015 14:05
Pot draw
#!/usr/bin/env ruby
# Assuming pot_a, pot_b, pot_c and pot_d are 4 arrays with 8 players each.
pots = [pot_a, pot_b, pot_c, pot_d]
%w{ A B C D E F G H }.each do |group_id|
players = pots.map do |pot|
pot.shuffle!
pot.pop