jam/test/test-csp.js

13 lines
445 B
JavaScript
Raw Normal View History

2024-08-27 00:16:04 +02:00
var m = csp.solver(csp.CSP.SIMPLE)
csp.V(m,'x',csp.range(1,9))
csp.V(m,'y',[1,2,3,4,5,6,7,8,9])
csp.V(m,'z',[1,2,3,4,5,6,7,8,9])
csp.C(m,'x','y',function (x,y) { return x > y })
csp.C(m,'y','z',function (y,z) { return y > z })
csp.C(m,'x','y',function (x,y) { return x > 3 && y < 7 })
csp.C(m,'x','y',function (x,y) { return x != y })
csp.C(m,'z',null,function (z) { return z > 2 })
print(m)
print(toJSON(m).length+' Bytes')
print(csp.solve(m))