// Code ----------------------------------------------------------------------------------------------------------------------------------
move { // authorized moves for a "knight"
(1,6);
(1,8);
(2,7);
(2,9);
(3,4);
(3,8);
(4,3);
(4,9);
(6,7);
(6,1);
(7,6);
(7,2);
(8,3);
(8,1);
(9,4);
(9,2);
}
path { // walks the possible moves and try to find a path from a position to another one
(:f,:t,:l) :- #path(:f,:t,[:f],[],:lo), lst.cat(:f,:lo,:l);
(:e,:e,_,_,[])^ :- true;
(:f,:t,:s,:p,:po) :- #move(:f,:i), lst.except(:i,:s), #path(:i,:t,[:i|:s],:p,:p2), lst.cat(:i,:p2,:po);
}