I want to write aprolog program that moves family members from one side to another, which would require the parents for example to go back and forth and move the family. I wrote the code below, but it is only moving the members from right to left, they are not going back to the other side. Hoe can I adjust my code to make them go back and forth between sides? Please note I cannot change the format of the states.
initial_state([ [initial, [] ], [puppy, alfie, bianca, daisy, mum, dad], [] ]).
goal_state([ [_, [] ], [], [puppy,alfie,bianca,daisy,mum,dad]]).
%Moves
move([],[],[],[]).
move(L1, R1,L2,R2):-
weight_limited_selection(L1,100,C),
split(L1,C,L2),
append(R1,C,R2).
%Transitions
transition([[_, _],L1,R1], [[rl, _],L2,R2]):-
transition([[_, _],L1,R1], [[rl, _],L2,R2]):-
move(L1, R1,L2,R2).
transition([[_, _],L2,R2], [[lr, _],L3,R3]):-
move(R2,L2,R3,L3).