哪一个是第四个?
答案 0 :(得分:1)
最后我自己解决了这个问题
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).
列表为:c e b d f a