I'm very new to prolog and am having trouble with the 8 puzzle heuristics. I'm not sure how to compare the two lists (goal and start) and figure out my h value. What I am trying to do is send compare_list two list the goal and start. It should compare each head and if they are not equal add 1 to the total else call it's self recursively. I'm not sure how to do if else statements in prolog.
%T1,T2,T3 top
%M1,M2,M3 middle
%B1,B2,B3 bottom
goal([1/2/3/8/0/4/7/6/5]).
%Top row movements
%shift right
shift([T1/0/T3/M1/M2/M3/B1/B2/B3],
[0/T1/T3/M1/M2/M3/B1/B2/B3]).
shift([T1/T2/0/M1/M2/M3/B1/B2/B3],
[T1/0/T2/M1/M2/M3/B1/B2/B3]).
%shift left
shift([T1/T2/T3/M1/M2/M3/B1/B2/B3],
[T1/T2/T3/M1/M2/M3/B1/B2/B3]).
shift([T1/T2/T3/M1/M2/M3/B1/B2/B3],
[T1/T2/T3/M1/M2/M3/B1/B2/B3]).
%shift down
shift([T1/T2/T3/0/M2/M3/B1/B2/B3],
[0/T2/T3/T1/M2/M3/B1/B2/B3]).
shift([T1/T2/T3/M1/0/M3/B1/B2/B3],
[T1/0/T3/M1/T2/M3/B1/B2/B3]).
shift([T1/T2/T3/M1/M2/0/B1/B2/B3],
[T1/T2/0/M1/M2/T3/B1/B2/B3]).
%Middle row movements
%shift right
shift([T1/T2/T3/M1/0/M3/B1/B2/B3],
[T1/T2/T3/0/M1/M3/B1/B2/B3]).
shift([T1/T2/T3/M1/M2/0/B1/B2/B3],
[T1/T2/T3/M1/0/M2/B1/B2/B3]).
%shift left
shift([T1/T2/T3/0/M2/M3/B1/B2/B3],
[T1/T2/T3/M2/0/M3/B1/B2/B3]).
shift([T1/T2/T3/M1/0/M3/B1/B2/B3],
[T1/T2/T3/M1/M3/0/B1/B2/B3]).
%shift up
shift([0/T2/T3/M1/M2/M3/B1/B2/B3],
[M1/T2/T3/0/M2/M3/B1/B2/B3]).
shift([T1/0/T3/M1/M2/M3/B1/B2/B3],
[T1/M2/T3/M1/0/M3/B1/B2/B3]).
shift([T1/T2/0/M1/M2/M3/B1/B2/B3],
[T1/T2/M3/M1/M2/0/B1/B2/B3]).
%shift down
shift([T1/T2/T3/M1/M2/M3/0/B2/B3],
[T1/T2/T3/0/M2/M3/M1/B2/B3]).
shift([T1/T2/T3/M1/M2/M3/B1/0/B3],
[T1/T2/T3/M1/0/M3/B1/M2/B3]).
shift([T1/T2/T3/M1/M2/M3/B1/B2/0],
[T1/T2/T3/M1/M2/0/B1/B2/M3]).
%bottom row movements
%shift right
shift([T1/T2/T3/M1/M2/M3/B1/0/B3],
[T1/T2/T3/M1/M2/M3/0/B1/B3]).
shift([T1/T2/T3/M1/M2/M3/B1/B2/0],
[T1/T2/T3/M1/M2/M3/B1/0/B2]).
%shift left
shift([T1/T2/T3/M1/M2/M3/0/B2/B3],
[T1/T2/T3/M1/M2/M3/B2/0/B3]).
shift([T1/T2/T3/M1/M2/M3/B1/0/B3],
[T1/T2/T3/M1/M2/M3/B1/B3/0]).
%shift up
shift([T1/T2/T3/0/M2/M3/B1/B2/B3],
[T1/T2/T3/B1/M2/M3/0/B2/B3]).
shift([T1/T2/T3/M1/0/M3/B1/B2/B3],
[T1/T2/T3/M1/B2/M3/B1/0/B3]).
shift([T1/T2/T3/M1/M2/0/B1/B2/B3],
[T1/T2/T3/M1/M2/B3/B1/B2/0]).
h(State):-
compare_list(State, goal, 1).
compare_list([H1 | T1], [H2 | T2], I) :-
H1 \= H2,
compare_list(T1, T2, I1),
I is I1 +1.