Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- append(List,[],List).
- append([Item|Result],[Item|List1],List2) :-
- append(Result,List1,List2).
- /// appendItem (ResultList, List, Item)
- /// ResultList = List + Item
- /// List + Item = ResultList
- ///
- appendItem(ResultList,List,Item) :-
- append(ResultList,List,[Item]).
- move(1,X,Y,K1,R,Q) :-
- appendItem(Q,R,X).
- move(N,X,Y,Z,R,Q) :-
- (N > 1),
- (M is (N - 1)),
- move(M,X,Z,Y,R,Q0),
- R1 := Q0,
- move(1,X,Y,K2,R1,Q1),
- R2 :=Q1,
- move(M,Z,Y,X,R2,Q2),
- Q:=Q2.
- :-move(3,left,right,center,[],Out).
Add Comment
Please, Sign In to add comment