Thanks for your help. So far I have
minus(X,Y) :- Y > X, fail.
minus(X,Y) :- Y is X-1;
minus(X,Y) :- Y is X-2;
minus(X,Y) :- Y is X-3.
but I'm not sure how to implement this using a list of numbers. I have a list [9,8,7,3] and I want to see all the moves available if minus is a move. I think...
Sorry after reading it again its not clear at all.
If I state 1 bit it might be easier.
I have a list [9,8,7,3] or along those lines.
I need a predicate minus(A,B) which will list the moves possible. The only moves can be to subtract 4 or 2 so i would get the answer
A = 9 B = 5 ;
A = 9 B =...
This may be a simple problem but I am completely new to prolog.
I am attempting to generate a predicate minus(A,B) where A is an initial state in a list [7,3,12,1] and B is what i am attemping to get to. So minus[7,3] would be acceptable. however i can only minus the numbers 4 and 2 so [7,4] is...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.