Answer to Question #258666 in Prolog for Nik

Question #258666

Write a list of facts that are points on a graph (ex: point(1,3).)




• Sample fact: point(1,3).




• Add at least 6 more.




Write a rule that determines whether a line going through 2 points is horizontal. A Horizontal line requires that the Y value be the same. The X value must be different.




• The planned query is horizontal (X1,Y1,X2,Y2).




• This means that horizontal(4 variables ) needs to be the head (left part) of a rule, and the body (right side of the rule) needs to include rules about point( ? , ?).




• The head is followed by :- and then the facts that must be true.





Write another rule that determines whether a line going through 2 points is vertical.





Run a query to see all the points in your knowledgebase that start with X=1.




• Example: To find all the loves which had love object = Amy, you ran the query loves(X,Amy).




Run a query to test two points in your knowledgebase:









1
Expert's answer
2021-10-31T18:42:34-0400
Dear Nik, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS