Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
887 B
4
Indexable
Never
person(alex).
person(blake).
person(dakota).
person(charlie).
person(emerson).
person(frankie).

position(1..6).

1 {finished(P, N): person(P), position(N)} 1 :- person(X), position(N).
%1 {position(N): person(X)} 1 :- position(N).

%finished(Person, Position) :- person(Person), position(Position).

:- finished(P1, N1), finished(P2, N2), N1=N2, P1!=P2.
:- finished(P1, N1), finished(P2, N2), N1!=N2, P1=P2.

:- finished(Dakota, 6).

:- finished(alex, Pa), finished(charlie, Pc), Pc<Pa.
:- finished(frankie, Pa), finished(charlie, Pc), Pc<Pa.
:- finished(blake, Pa), finished(charlie, Pc), Pc<Pa.

:- finished(alex, Pa), finished(dakota, Pc), Pc<Pa.
:- finished(frankie, Pa), finished(dakota, Pc), Pc<Pa.
:- finished(blake, Pa), finished(dakota, Pc), Pc<Pa.

:- finished(alex, Pa), Pa!=1, Pa!=2.
:- finished(blake, Pb), Pb!=3.

:- finished(frankie, Pf), finished(charlie, Pc), Pc-Pf!=3.