examples/nonogram.rb
# define constraint type 2: order of rule variables
define constraint type 2: order of rule variables
define constraint type 2 : order of rule variables
def define_constraint_type_2(solver, r)
  r.each_cons(2) do |r2, r3|
    (1...r2.size).each do |i|
      solver << ([-r2[i]] + r3[i..-1])
    end
  end
end
def define_constraint_type_2 ( solver , r ) r . each_cons ( 2 ) do | r2 , r3 | ( 1 ... r2 . size ) . each do | i | solver << ( [ - r2 [ i ] ] + r3 [ i .. - 1 ] ) end end end
define constraint type 2: order of rule variables
define constraint type 2 : order of rule variables
# r : [[p,q,r], [s,t,u]]
solver
r