I have to solve the following problem in Prolog. Alex, Fred and Jane are 3 children that have made a seesaw out of a plank that is 10 meters long. They mark 11 seating positions along the plank, each one meter apart. The number the seating positions as -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 where 0 is the center position. Alex, Fred and Jane weight respective 4, 3, and 2 units of weight. They are interested to know how they can get the seesaw to balance when all three of them are seated somewhere along the plank, and each child has to sit on a different position.
One seating position is when Alex, Fred, and Jane are at positions -4, 2, and 5 since (-4 * 4) + (2 * 3) + (5 * 2) = -16 + 6 + 10 = 0. Another seating position for Alex, Fred and Jane is -4, 4 and 2, and yet another is -3, 2, and 3.
I have tried the following to solve this but get error: ERROR: Type error: integer' expected, found
[_G11889,_G11892,_G11895]'
Can anyone please help explain where I have gone wrong/how to go about this?
Many thanks in advance
:-use_module(library(clpfd)).
find(Seats):-
Seats=[Alex, Fred, Jane],
Seats in -5..5,
all_different(Seats),
(Alex*4+Fred*3+Jane*2)#=0, % I am not sure about this line
labeling([],Seats).