% Otter solution for Linear Peg Solitaire, 4 pegs of each color, with % solution capture. % by Robert Keller % The functions composed in the answer are read from inside out to % get the move sequence. set(auto). list(usable). move(s(w(x), y), s(x, w(y)), z, wm(z)). move(s(x, r(y)), s(r(x), y), z, rm(z)). move(s(r(w(x)), y), s(x, r(w(y))), z, wj(z)). move(s(x, w(r(y))), s(w(r(x)), y), z, rj(z)). reachable(s(w(w(w(w(c)))), r(r(r(r(c))))), d). -reachable(x, z) | -move(x, y, z, zz) | reachable(y, zz). -reachable(s(r(r(r(r(c)))), w(w(w(w(c))))), z) | $answer(z). end_of_list.