I want to reverse the output of the code. goal(hall). move(gateA,gateB). move(gateA,gateG). move(gateB,gateC). move(gateB,gateH). move(gateG,gateL). move(gateG,
I want to create a predicate filter/3 or filter(Condition,List,Solution) that checks every element of the list and if returns true in the condition put it in th
I have to generate lists that consist of 2 '1's and other elements are '0's. I tried the following code but it does not work: count([], _, 0). count([X|T], X,
I'm trying to multiply all nodes in a binary tree but I'm only getting 0 as a result. My code is: product_tree(nil,0). product_tree(t(L,X,R), N):- product_tr
I am new to this language and am having trouble coming up with a solution to this problem. The program must implement the following cases. Both variables are in
I have this string: B='Dogs cats birds and fish'. and i need it to appear in the format bellow: Dogs, cats, birds, and fish Is there any possible way for
Need help creating a recursive clause is a rule: X is a power of 2 only if there is a Y such that when adding Y to Y the result is X, and Y is a power of 2. in
I have a prolog-file (name definitions.pl) of this kind of type: :- module(definitions,[]). :-op(699, xfx, :=). :-op(599, xfy, ∪). C := (A ∪ B) :- u
I have a knowledge base in SWI-Prolog that consists of rules with the form: input(a,c1,b,c2,c,c3):-output(good,c4). (c1,c2,c3,c4 represent the confidence values
How is it possible to represent infinite domains in Prolog? I have been searching this topic for a while, but do not have a clue. Any help is appreciated.
I am trying to do a shortest path for a London underground system inside prolog, and I'm stuck I've managed to get the code to return lists of all the possible
I am trying to write a function in Scheme and Prolog that returns first, middle and last item of a list. E.g., find([4,5,8,7,9],L), L = [4,8,9]. I came up with
I wrote a Prolog program to find all solutions to any '8 out of 10 cats does countdown' number sequence. I am happy with the result. However, the solutions are
I'm just trying to figure out constraint programming in SWI-Prolog, looking at this tutorial : http://en.wikibooks.org/wiki/Prolog/Constraint_Logic_Programming