
%start( c([1,2,3],[8,x,4],[7,6,5])).
%start( c([x,2,3],[1,5,6],[4,7,8]) ).
start( c([1,2,3],[x,5,6],[4,7,8]) ).
%start( c([1,2,3],[4,5,6],[x,7,8]) ).

ziel( c([1,2,3],[4,5,6],[7,8,x])).

kante( c(L1,L2,L3), c(S,L2,L3)) :- horzswap(L1,S).
kante( c(L1,L2,L3), c(L1,S,L3)) :- horzswap(L2,S).
kante( c(L1,L2,L3), c(L1,L2,S)) :- horzswap(L3,S).
kante( c(L1,L2,L3), c(S1,S2,S3)) :- vertswap(L1,L2,L3,S1,S2,S3).

vertswap([A|L1],[B|L2],[C|L3], [SA|L1], [SB|L2], [SC|L3]) :-
	horzswap([A,B,C],[SA,SB,SC]).
vertswap([A|L1],[B|L2],[C|L3], [A|SL1], [B|SL2], [C|SL3]) :-
   vertswap(L1,L2,L3, SL1, SL2, SL3).


horzswap([x,A,B],[A,x,B]).
horzswap([A,x,B],[x,A,B]).
horzswap([A,x,B],[A,B,x]).
horzswap([A,B,x],[A,x,B]).

:- use_module(library(lists)).

