## Can't convert solution of einstein riddle document.SUBSCRIPTION_OPTIONS = { "thing": "thread", "subscribed": false, "url": "subscribe", "icon": { "css": "fa fa-envelope-o" } };

John Doe
2007-10-02
2013-05-28
• John Doe - 2007-10-02

Unfortunately it’s impossible to convert Prolog solution of Einstein riddle to C# code (and Javascript too):

next_to(X, Y, List) :- iright(X, Y, List).
next_to(X, Y, List) :- iright(Y, X, List).

iright(L, R, [L | [R | _]]).
iright(L, R, [_ | Rest]) :- iright(L, R, Rest).

einstein(Houses, Fish_Owner) :-
=(Houses, [[house, norwegian, _, _, _, _], _, [house, _, _, _, milk, _], _, _]),
member([house, brit, _, _, _, red], Houses),
member([house, swede, dog, _, _, _], Houses),
member([house, dane, _, _, tea, _], Houses),
iright([house, _, _, _, _, green], [house, _, _, _, _, white], Houses),
member([house, _, _, _, coffee, green], Houses),
member([house, _, bird, pallmall, _, _], Houses),
member([house, _, _, dunhill, _, yellow], Houses),
next_to([house, _, _, dunhill, _, _], [house, _, horse, _, _, _], Houses),
member([house, _, _, _, milk, _], Houses),
next_to([house, _, _, marlboro, _, _], [house, _, cat, _, _, _], Houses),
next_to([house, _, _, marlboro, _, _], [house, _, _, _, water, _], Houses),
member([house, _, _, winfield, beer, _], Houses),
member([house, german, _, rothmans, _, _], Houses),
next_to([house, norwegian, _, _, _, _], [house, _, _, _, _, blue], Houses),
member([house, Fish_Owner, fish, _, _, _], Houses).

SWI Prolog and Canna Prolog are able to consult this Prolog program

• Don Sawatzky - 2008-09-24

I am experimenting with YieldProlog for Python.  My first attempt at the einstein riddle got an endless loop in parser.py.  I inserted a try block in parser and found that the Python recursion limit was exceeded.  I doubled the limit in the parsed code, and the goal worked.  My computer is new and fast, but takes about 10 seconds to solve this riddle and a recursion depth between 1000 and 2000.  This seems to be a deep recursion task for YieldProlog.