Which one is the fourth ?
Finally I solved the problem by myself
before(A,B) :- A<B.
after(A,B) :- A>B.
notInFifth(A) :- A \= 5.
adjacent(A,B) :- abs(A - B) =:= 1.
separatedByTwo(A,B) :- abs(A - B) =:= 2.
solution(A,B,C,D,E,F) :-
permutation([1,2,3,4,5,6], [A,B,C,D,E,F]),
notInFifth(E),
separatedByTwo(D,A),
adjacent(B,E),
before(C,E),
before(F,A),
before(E,B).
list is : cebdfa
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.