Prolog Homework

Note, your textbook is online at http://www.learnprolognow.org

All the sample databases can be found at: http://home.adelphi.edu/~pe16132/csc270/note/prologExercises.htm (You will dowload the knowledgebase as ?.x but change it to .pl).

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

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.

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

Save the file with a .pl extension.

Open a prolog session on panther (swipl)

consult your knowledgebase by typing [your filename without the .pl].

list the knowledgebase using : listing.

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

Run a query to test two points in your knowledgebase:

Run these queries that show all the possible horizontal lines made with the points in the database: horizontal (X1,Y1,X2,Y2). . Repeat for vertical (X1,Y1,X2,Y2).

copy everything you ran in your prolog session from your terminal into a notepad file and upload that fille to moodle.