The contents of the pl file.
isabove(g,b1).
isabove(b1,w1).
isabove(w2,b2).
isabove(b2,b3).
isabove(X,Z):-isabove(X,Y),isabove(Y,Z).
color(g,gray).`enter code here`
color(b1,blue).
color(b2,blue).
color(b3,blue).
color(w1,white).
color(w2,white).
then When the following command is executed ?- isabove(X,Y).
results
X = g,
Y = b1 ;
X = b1,
Y = w1 ;
X = w2,
Y = b2 ;
X = b2,
Y = b3 ;
X = g,
Y = w1 ;
ERROR: Stack limit (2.0Gb) exceeded
ERROR: Stack sizes: local: 2.0Gb, global: 2Kb, trail: 0Kb
ERROR: Stack depth: 24,399,533, last-call: 0%, Choice points: 5
ERROR: Probable infinite recursion (cycle):
ERROR: [24,399,533] user:isabove(w1, _814)
ERROR: [24,399,532] user:isabove(w1, _834)
?- =
'isabove(X,Z):-isabove(X,Y),isabove(Y,Z).
This part seems to cause the problem, but I am wondering why it is a problem and how to fix it to get the answer you want. Answers I'll wait. Thank you.