This is what I have:
values(Count, A, B) :-
A is Count,
B is 0.
values(Count, A, B) :-
values(Count, Aa, Bb),
A is Aa-2,
B is Bb+2,
+ A < 0;
B < 0.
So I want by output to be:
A = 6,
B = 0
A = 4,
B = 2
A = 2,
B = 4
A = 0,
B = 6
I'm getting that, but then the interpreter just keeps going and runs out of Stack space, because the recursive values(Count, Aa, Bb)
is at the start. I don't know how to rewrite this so that the recursion isn't endless, I want it to end after I get the above output. Would anyone be able to help?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…