Csc 4330/6330, Programming Language Concepts (Spring 2018)
Zebra Puzzle (Due: 29 April (Sunday))
Write a Prolog program (zebra.pl) to solve the "Zebra Puzzle".The Zebra Puzzle is a logic puzzle said to be invented by Albert Einstein (but who knows), and Wikipedia says that only 2% of the world population is able to solve it, most of them being Prolog programmers like you :-).
The puzzle consists of five different-colored houses in a row, each lived in by a resident of a different nationality. Each resident owns a different pet, prefers a different drink, and smokes a different brand of cigarettes than the others.
You’re given 15 other facts:
- There are five houses.
- The Englishman lives in the red house.
- The Spaniard owns the dog.
- Coffee is drunk in the green house.
- The Ukrainian drinks tea.
- The green house is immediately to the right of the ivory house (to your right as you stand facing the row of five houses).
- The Old Gold smoker owns snails.
- Kools are smoked in the yellow house.
- Milk is drunk in the middle house.
- The Norwegian lives in the first house.
- The man who smokes Chesterfields lives in the house next to the man with the fox.
- Kools are smoked in a house next to the house where the horse is kept.
- The Lucky Strike smoker drinks orange juice.
- The Japanese smokes Parliaments.
- The Norwegian lives next to the blue house.
- Which man likes to drink water?
- Which man owns a zebra?