Sha256: f22c4176b203420a77c30942c4c123585fb33c5879ce458d377d64d4a8d36123

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 Bytes

Contents

q1 = Variable.new("q1", Domain.new((1..4).to_set))
q2 = Variable.new("q2", Domain.new((1..4).to_set))
q3 = Variable.new("q3", Domain.new((1..4).to_set))
q4 = Variable.new("q4", Domain.new((1..4).to_set))

alldiff = AllDifferentConstraint.new([q1, q2, q3, q4])
tup1 = TupleConstraint.new([q1, q2], [[1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3]], false)
tup2 = TupleConstraint.new([q2, q3], [[1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3]], false)
tup3 = TupleConstraint.new([q3, q4], [[1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3]], false)

queens = Problem.new([q1, q2, q3, q4], ConstraintList.new([alldiff, tup1, tup2, tup3]))

puts solve(queens)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ConstraintSolver-0.1 examples/queens.rb