1% LOOP46 2 3:- module(wave). 4 5getbug :- 6 writeln('\nCheck that you are in "module(wave).", then'), 7 writeln('to start the program type "prince(david).".\n'). 8 9bug :- 10 nl, 11 explanation. 12 13explanation :- 14writeln('There is a typo in the last fact. \n\ 15\n\ 16GOAL: prince(david). \n\ 17CORRECT: yes. \n\ 18BUGGY: endless loop (wave). \n'). 19 20 21% ============================================================================ 22 23prince(X) :- 24 ancestor(Y, X), 25 king(Y). 26 27ancestor(X,Y) :- 28 father(X,Y). 29ancestor(X,Z) :- 30 ancestor(Y,Z), 31 father(X,Y). 32 33father(john, david). 34father(peter, john). 35father(george, pater). % typing error 36 37king(george). 38