# HG changeset patch # User kono # Date 979892507 -32400 # Node ID bd06de5e669ac7946bffbee3535b4b9be01ceb47 # Parent 9b86eb10b61cb4be3b0b7cfd9f943964e98db5a2 *** empty log message *** diff -r 9b86eb10b61c -r bd06de5e669a infinite.pl --- a/infinite.pl Fri Jan 19 09:16:27 2001 +0900 +++ b/infinite.pl Fri Jan 19 17:21:47 2001 +0900 @@ -39,9 +39,9 @@ retract_all(_). infinite([S|L]) :- - links(_,S), - more_only(S), % search more only node - more_only_loop(S,S,L,[]), + setof(S,links(S,0),Depth), + member(S1,[0|Depth]), + more_only_loop(S1,L,[],[S1]), assert(found_infinite). infinite([]) :- found_infinite. @@ -50,13 +50,16 @@ state(S,[empty|_],true),!,fail. more_only(S) :- number(S). -more_only_loop(S,S0,L,L1) :- - links(N,S), - more_only_loop1(N,S0,L,L1). +more_only_loop(S,L,L1,Hist) :- + setof(N,links(N,S),Depth), + member(S1,Depth), + more_only_loop1(S1,L,L1,Hist). -more_only_loop1(S,S,L,L) :-!. -more_only_loop1(N,S,[N|L],L1) :- +more_only_loop1(S,L,L,Hist) :- + member(S,Hist), + !. +more_only_loop1(S,[N|L],L1,Hist) :- more_only(N), - more_only_loop(N,S,L,L1). + more_only_loop(N,S,L,L1,[S|Hist]). /* end */