I'm quite new to declarative programming as a whole and am having trouble understanding how to properly recursively create a list of "moves" using tail recursion. In Prolog, I've been aimlessly tinkering for hours and false/gtrace can only tell me so much. I'd really appreciate any advice!
% Recursive Step
path([LF1, LH1, B1, RF1, RH1], [LF2, LH2, B2, RF2, RH2], Explored, Moves) :-
move([LF1, LH1, B1, RF1, RH1], [LF3, LH3, B3, RF3, RH3]),
not(member([LF3, LH3, B3, RF3, RH3], Explored)),
path([LF3, LH3, B3, RF3, RH3],
[LF2, LH2, B2, RF2, RH2],
[[LF3, LH3, B3, RF3, RH3]|Explored],
[[[LF3, LH3, B3],[LF1, LH1, B1]] | Moves]).
% Solution found
path([LF,LH,B,RF,RH],[LF,LH,B,RF,RH],[], []).
solve(P) :- path([3,3,1,0,0],[0,0,0,3,3], _, P).