domains
A,B,C = symbol
N,P = integer
predicates
tower(integer,symbol,symbol,symbol,integer)
go
clauses
go :- clearwindow,
write("enter value of N (For Transfering from A To B)"),
readint(N),
tower(N,'a','b','c',N).
tower(N,A,B,C,P):-
N > 1,
P is N-1
tower(P,A,C,B,P),
write([move , A,B]),nl,
tower(P,C,B,A,P).
tower(0,_,_,_):- !.
i am using ancient turbo prolog . and continously facing error in following code :- mis-spelling or not declared predicate
1.2k Views Asked by scholar At
3
There are 3 best solutions below
0

Also, your domain declarations don't make sense. The syntax is not for associating variables with domains (symbol and integer are predefined for you), but rather for creating specialized domains from the predefined ones. It doesn't appear that your program needs any domain declarations.
Tutorials for domains, etc. in Turbo Prolog are rather scarce online, due to the passage of time, so your best bet (if you lack original documentation) may be to look at one of Visual Prolog tutorials.
You're missing a comma after
P is N-1
.