fig11_11.pl
来自「超多的prolog源代码 具体内容见压缩包里面的programs.txt」· PL 代码 · 共 20 行
PL
20 行
% Figure 11.11 A more efficient program than that of Figure 11.10 for
% the breadth-first search. The improvement is based on using
% the difference-pair representation for the list of candidate paths.
% Procedure extend is as in Figure 11.10.
% solve( Start, Solution):
% Solution is a path (in reverse order) from Start to a goal
solve( Start, Solution) :-
breadthfirst( [ [Start] | Z] - Z, Solution).
breadthfirst( [ [Node | Path] | _] - _, [Node | Path] ) :-
goal( Node).
breadthfirst( [Path | Paths] - Z, Solution) :-
extend( Path, NewPaths),
conc( NewPaths, Z1, Z), % Add NewPaths at end
Paths \== Z1, % Set of candidates not empty
breadthfirst( Paths - Z1, Solution).
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?