I\'m trying to solve the Einstein riddle using Prolog. When I\'m trying to run by houses(Hs), it shows No. Task is
Here is a generalization of your program. I added some extra *
to remove several goals and replaced some terms by _/*origterm*/
. And yet, the resulting program is still failing. Therefore, the error has to be in the remaining fragment. You did not say anything about the program (Edit: you added something later), so I do not (Edit: want to) know what it is about. But no matter what, the error has to be in the remaining visible part:
:- initialization(houses(_Sol)). :- op(950, fy, *). *_. houses(Hs) :- length(Hs, 5), *member(h(english,_,_,_,red), Hs), % 2 *member(h(swede,dog,_,_,_), Hs), *member(h(_,_,_,coffee,green), Hs), *member(h(dane,_,_,tea,_), Hs), *next(h(_,_,_,_,green), h(_,_,_,_,white), Hs), member(h(_,_/*bird*/,'Pall Mall',_,_), Hs), member(h(_,_,'Dunhill',_,_/*yellow*/), Hs), *Hs = [_,_,h(_,_,_,milk,_),_,_], *Hs = [h(norwegian,_,_,_,_)|_], *next(h(_,horse,_,_,_), h(_,_,'Dunhill',_,_), Hs), next(h(_,_,blend,_,_), _/*h(_,cat,_,_,_)*/, Hs), member(h(_,_,'Blue Master',_/*beer*/,_), Hs), member(h(_/*german*/,_,'Prince',_,_), Hs), *next(h(norwegian,_,_,_,_), h(_,_,_,_,blue), Hs), next(h(_,_,'Blend',_,_), _/*h(_,_,_,water,_)*/, Hs), *member(h(_,fish,_,_,_), Hs). next(A, B, Ls) :- append(_, [A,B|_], Ls). next(A, B, Ls) :- append(_, [B,A|_], Ls).
There is not much left! In the visible part there is at least one error! (And, strictly speaking there may be many more errors in the other parts. We simply don't know).