Note that there are some explanatory texts on larger screens.

plurals
  1. POSolving "Who owns the Zebra" programmatically?
    text
    copied!<p>Edit: this puzzle is also known as "Einstein's Riddle"</p> <p>The <a href="https://en.wikipedia.org/wiki/Zebra_Puzzle" rel="nofollow noreferrer">Who owns the Zebra</a> (you can <a href="https://www.brainzilla.com/logic/zebra/einsteins-riddle/" rel="nofollow noreferrer" title="Einstein&#39;s Riddle">try the online version here</a>) is an example of a classic set of puzzles and I bet that most people on Stack Overflow can solve it with pen and paper. But what would a programmatic solution look like?</p> <p>Based on the clues listed below...</p> <ul> <li>There are five houses.</li> <li>Each house has its own unique color.</li> <li>All house owners are of different nationalities.</li> <li>They all have different pets.</li> <li>They all drink different drinks.</li> <li>They all smoke different cigarettes.</li> <li>The English man lives in the red house.</li> <li>The Swede has a dog.</li> <li>The Dane drinks tea.</li> <li>The green house is on the left side of the white house.</li> <li>They drink coffee in the green house.</li> <li>The man who smokes Pall Mall has birds.</li> <li>In the yellow house they smoke Dunhill.</li> <li>In the middle house they drink milk.</li> <li>The Norwegian lives in the first house.</li> <li>The man who smokes Blend lives in the house next to the house with cats.</li> <li>In the house next to the house where they have a horse, they smoke Dunhill.</li> <li>The man who smokes Blue Master drinks beer.</li> <li>The German smokes Prince.</li> <li>The Norwegian lives next to the blue house.</li> <li>They drink water in the house next to the house where they smoke Blend. </li> </ul> <p>...who owns the Zebra?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload