CIS 554 Assignment 2: Logic Puzzle

Spring 2010, David Matuszek

- To give you more experience with logic programming.
- To introduce lists in Prolog.
- To emphasize the
*declarative*nature of Prolog. (The entire program consists of a*statement*of the problem,*not*some algorithm to solve the problem.)

Solve a standard (commercial) logic puzzle.

I am providing three such puzzles:

**It's a Tie**-- I have provided a sample solution for this one.**Imaginary Friends**-- Once you understand the "It's a Tie" solution, this should be trivial. I suggest you implement this to get a better feel for how to do puzzles like this, but don't hand it in.**Star Tricked**-- Your assignment is to write (and turn in) a Prolog program to solve this logic puzzle. If you understand how the sample program works, it should be fairly easy to figure out how to describe the ordering of weekdays.

**Notes:**

- One of my problems in solving these was spelling errors. Prolog checks for singleton variables, but there is no such check for misspelled atoms, such as
`spiegel`

instead of`speigel`

. Be especially careful of this. - These problems make unusually extensive use of the "not" operator,
`\+`

. Here's what you need to know about this operator:`\+`

works as you would expect when all variables are completely instantiated (bound).- Prolog tries to prove things, so if expression E contains unbound variables,
`\+E`

will try to find variable bindings that will make E true.

This one should be easy to grade; your program should produce the correct solution. We may deduct points if your formatting is egregiously bad.

` .pl`

file in to Blackboard. Since only one file is required, please don't zip it.