/* Fill in the blanks in Picat. From BL: "Can You All Possible Ways To Fill In The Blanks?" https://medium.com/math-games/can-you-all-possible-ways-to-fill-in-the-blanks-59780f96f471 """ Find all the possible ways to fill in the three blanks to make all three statements true. (ALL POSSIBLE WAYS PLEASE) 1. The sum of the numbers in the other panels is __________. 2. The square root of the product of the numbers in the other panel is ______. 3. The minimum number of the numbers in the other panels is _______. """ Assumption: Only integers. [0,0,0] See go2/0 for the clever variant. This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. % import sat. main => go. go ?=> [A,B,C] :: -100..100, % 1. The sum of the numbers in the other panels is __________. A #= B + C, % 2. The square root of the product of the numbers % in the other panel is ______. B*B #= A*C, % 3. The minimum number of the numbers in the other % panels is _______. C #= min(A,B), solve([A,B,C]), println([A,B,C]), fail, nl. go => true. /* [-1,-3,-3] [5,0,0] [12,6,1] */ go2 ?=> ANum = 1, BNum = 2, CNum = 3, [A,B,C] :: -100..100, % 1. The sum of the numbers in the other panels is __________. A #= B + C + BNum + CNum, % 2. The square root of the product of the numbers % in the other panel is ______. B*B #= A*C*ANum*CNum, % 3. The minimum number of the numbers in the other % panels is _______. C #= min([A,B,ANum,BNum]), solve([A,B,C]), println([A,B,C]), fail, nl. go2 => true.