Project

pairs

0.0
No commit activity in last 3 years
No release in over 3 years
Constraint solver for pairs
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
>= 0
 Project Readme

Pairs

Gem Version Build Status

Constraint solver for pairs

Installation

gem install pairs

Usage

Running the following file:

require 'pairs'

pairs = Pairs.new do
  senior "Alice"
  senior "Brad"
  senior "Charles"
  senior "Debbie"

  junior "Edward"
  junior "Felicia"
  junior "Justin"

  constraint { |a, b| !(junior?(a) && junior?(b)) }
  together "Alice", "Edward"
  separate "Brad", "Felicia"
  alone "Justin"
end

pairs.solution.each do |pair|
  puts pair.join(' & ')
end

...could produce this output:

Felicia & Debbie
Charles & Brad
Edward & Alice
Justin