Guest User

Untitled

a guest
Aug 3rd, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.54 KB | None | 0 0
  1. append(List,[],List).
  2. append([Item|Result],[Item|List1],List2) :-
  3.     append(Result,List1,List2).
  4.  
  5.  
  6. /// appendItem (ResultList, List, Item)
  7. /// ResultList = List + Item
  8. /// List + Item = ResultList
  9. ///
  10. appendItem(ResultList,List,Item) :-
  11.     append(ResultList,List,[Item]).
  12. move(1,X,Y,K1,R,Q) :-
  13.     appendItem(Q,R,X).
  14.  
  15.  
  16. move(N,X,Y,Z,R,Q) :-
  17.     (N > 1),
  18.     (M is (N - 1)),
  19.     move(M,X,Z,Y,R,Q0),
  20.      R1 := Q0,
  21.     move(1,X,Y,K2,R1,Q1),
  22.      R2 :=Q1,
  23.     move(M,Z,Y,X,R2,Q2),
  24.      Q:=Q2.
  25.    
  26.  :-move(3,left,right,center,[],Out).
Add Comment
Please, Sign In to add comment