Skip to content

Instantly share code, notes, and snippets.

@justincampbell
Created August 13, 2014 21:24
Show Gist options
  • Save justincampbell/cd18ce823f0d3a4745d8 to your computer and use it in GitHub Desktop.
Save justincampbell/cd18ce823f0d3a4745d8 to your computer and use it in GitHub Desktop.
$ ruby pairs-using-pairs.rb
Jeff & Dan
Jason & Dotcom
Mox & Jearvon
Mike & Matt
Justin
require 'pairs'
pairs = Pairs.new do
senior "Dan"
senior "Jason"
senior "Jeff"
senior "Justin"
senior "Matt"
senior "Mike"
senior "Mox"
junior "Dotcom"
junior "Jearvon"
constraint { |a, b| !(junior?(a) && junior?(b)) }
separate "Jason", "Mike"
together "Mox", "Jearvon"
alone "Justin"
end
pairs.solution.each do |pair|
puts pair.join(' & ')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment