hanoi.bak
来自「人工智能课程学习中的作业」· BAK 代码 · 共 32 行
BAK
32 行
constants
l="left"
m="center"
r="right"
predicates
hanoi(integer)
move(integer,string,string,string)
inform(integer,string,string)
clauses
hanoi(N):-move(N,l,m,r).
move(0,_,_,_):-!.
move(N,A,B,C):- M=N-1,
move(M,A,C,B),
inform(N,A,C),
move(M,B,A,C).
inform(N,X,Y):-write("move disc "),write(N),
write(" from "),write(X),
write(" to the "),write(Y),nl.
goal
/*
write("Please input the number of hanoi:"),
readint(N),nl,
*/
hanoi(3).
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?