maze.bak

来自「this is a prolog implementation to solve」· BAK 代码 · 共 18 行

BAK
18
字号
% allow the addition of new paths as they are found.
:-dynamic(path/1).

% data describe movements in maze
move(a,b). move(b,c). move(c,d).  move(c,e). move(e,f).

% The simplest path is a single movement
path([X,Y]):-move(X,Y).


% construct more complex paths from simpler paths and movements
go([X,Y|Z]):-path([Y|Z]), move(X,Y),assert_if_new(path([X,Y|Z])), listing(path).
go:-go(Path), fail.

% add Fact to database if it is not already a Clause in the database
assert_if_new(Fact):-clause(Fact,true),!; assert(Fact).

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?