Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ciag_aryt(L1) :- L1=[A,B],!.
- ciag_aryt(L1) :-L1=[A,B,C], C-B =:= B-A,!.
- ciag_aryt(L1) :-
- L1=[A,B,C|T],
- C-B =:= B-A,
- ciag_aryt([B,C|T]).
- odleglosc(L1,W) :- ciag_aryt(L1), L1=[A,B|T], W is B-A.
- stw_ciag(L1,I,L2) :- ciag_aryt(L1), odleglosc(L1,R), ciag(L1,I,R,L2).
- ciag(L1,I,R,L2) :- I=:=0, L2=L1,!.
- ciag(L1,I,R,L2) :- append(T,[H],L1), A is H+R, append(L1,[A],LW1),
- I1 is I-1,
- ciag(LW1,I1,R,L2).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement