24 lines
662 B
Plaintext
24 lines
662 B
Plaintext
#show match/3.
|
|
|
|
% Let the choice to have a triplet in the match or not
|
|
unmatch(X,Y,Z) :- tri(X,Y,Z), not match(X,Y,Z).
|
|
match(X,Y,Z) :- tri(X,Y,Z), not unmatch(X,Y,Z).
|
|
|
|
% every letter in domain must be used
|
|
:- dom(X), not match(X,_,_).
|
|
|
|
% cannot have different matching with same first letter
|
|
:- match(X,Y,Z), match(X,Y1,Z1), Z != Z1.
|
|
:- match(X,Y,Z), match(X,Y1,Z1), Y1 != Y.
|
|
|
|
% cannot have different matching with same second letter
|
|
:- match(X,Y,Z), match(X1,Y,Z1), X1 != X.
|
|
:- match(X,Y,Z), match(X1,Y,Z1), Z != Z1.
|
|
|
|
% cannot have different matching with same third letter
|
|
:- match(X,Y,Z), match(X1,Y1,Z), X != X1.
|
|
:- match(X,Y,Z), match(X1,Y1,Z), Y1 != Y.
|
|
|
|
|
|
|