i\'m making a game in prolog, with a given set of domino pieces, it should make a correct domino row using all the pieces in the initial set. we must use an inference system
domino(X) :tasselli(L), member(T,L), componibile(X,L,[T]).
componibile(X,L,X) :length(L,N), length(X,N).
componibile(X,L,A) :member(T,L),
\+(member(T,A)),
T = t(_,N2),
A = [t(N2,_)|_],
componibile(X,L,[T|A]).
So if you have:
tasselli([t(3,4),t(5,3),t(4,1),t(1,5)]).
Then the result will be:
?domino(X).
X = [t(4, 1), t(1, 5), t(5, 3), t(3, 4)] ;
X = [t(3, 4), t(4, 1), t(1, 5), t(5, 3)] ;
X = [t(1, 5), t(5, 3), t(3, 4), t(4, 1)] ;
X = [t(5, 3), t(3, 4), t(4, 1), t(1, 5)] ;
false.