/* Put the digits 1 to 9 in boxes puzzle in Picat. From MindYourDecisions """ There are 9 boxes below. Solve by using each digit from 1 to 9 exactly once to fill the 9 boxes. X X * X ----- X X + X X ----- X X """ Solution: [1,7,4,6,8,2,5,9,3] This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. main => go. go ?=> X=new_list(9), X::1..9, all_different(X), (10*X[1] + X[2]) * X[3] #= 10*X[4] + X[5], 10*X[4] + X[5] + 10*X[6] + X[7] #= 10*X[8] + X[9], solve(X), println(X), fail, nl. go => true.