% Otter solution for Linear Peg Solitaire, 4 pegs of each color % by Robert Keller % The move sequence is recorded and returned as the answer. % mw = move white, mr = move red % jw = jump white, jr = jump red set(auto). list(usable). move(s(w(x), y), s(x, w(y)), mw). move(s(x, r(y)), s(r(x), y), mr). move(s(r(w(x)), y), s(x, r(w(y))), jw). move(s(x, w(r(y))), s(w(r(x)), y), jr). reachable(s(w(w(w(w(c)))), r(r(r(r(c))))), []). -reachable(x, z) | -move(x, y, v) | reachable(y, [v | z]). -reachable(s(r(r(r(r(c)))), w(w(w(w(c))))), z) | $ans(z). end_of_list.