I guess that’s fair, there’s no best solution, but I will draw something up. It’s going to take me a while :)  

--  
Vitor Monteiro
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Sunday, 9 March 2014 at 16:47, Nuno Guerreiro wrote:

> In _posts/2014-03-08-solving-cannibalism-with-prolog.md (http://2014-03-08-solving-cannibalism-with-prolog.md):
> > +* get the `NextPosition` from the `CurrentPosition`; > +* check if it's valid, if not exit and try to match another clause; > +* recursively call `missionaries/3` with the `NextPosition` and add the `CurrentPosition` to the visited list. > + > +For each recursion step, we add the movement type to the `Path` list, like `1M` for 1 missionary using the boat, > +`1M1C` for 1 each, and so on. > + > +And finally if we give the `missionaries/3` a go, we solve our problem: > + > +{% highlight prolog %} > +?- missionaries(((3,3),(0,0),1),[],Path). > +Path = ['2C', '1C', '2C', '1C', '2M', '1C1M', '2M', '1C', '2C', '1M', '1C1M'] ; > +Path = ['2C', '1C', '2C', '1C', '2M', '1C1M', '2M', '1C', '2C', '1C', '2C'] ; > +Path = ['1C1M', '1M', '2C', '1C', '2M', '1C1M', '2M', '1C', '2C', '1M', '1C1M'] ; > +Path = ['1C1M', '1M', '2C', '1C', '2M', '1C1M', '2M', '1C', '2C', '1C', '2C'] ; > +{% endhighlight prolog %}  
> I think it might be good if you can take the best solution and explain the each position in the list. A diagram with arrows might help using each position of the list as the label for its corresponding arrow.
>  
> —
> Reply to this email directly or view it on GitHub (https://github.com/bitoiu/bitoiu.github.com/pull/8/files#r10414476).
>  
>  
>