-3

I've seen the Wikipedia page about it a while ago - but I can't find it now. The problem is something like:

  • Mary lives next to Jane
  • Rob has a green door
  • Mike likes dogs
  • Jeff likes cats and can't live next to Mike
  • Steve lives across from Rob and Jane

Who lives next door to Jeff?

It's a really old puzzle (I think World War 1) published in a newspaper and possibly to do with Camel Cigarettes advertising at some point.

the Wiki page discussed various solutions using different software languages, as some families of languages are better suited to these types of solutions

New contributor
wild is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    It is often called a "Smith, Jones, Robinson" puzzle, because the first widely published puzzled used those names for the engineer, conductor and passenger on a train. In general, they are called logic puzzle.s – BobDalgleish Dec 2 at 14:17
2

This is a Constraint Satisfaction Problem. This problem is also a Zebra Puzzle. A kind of Logic Puzzle.

You can find solutions in multiple languages in Rosetta code.

The rest of this answer is a description of how I figured that out.


The problem in the question reminded me of a "riddle" from a TED-Ed video. I found the TED-Ed video searching in the TED-Ed youtube channel for "riddle thief", which gave me the name "Einstein's riddle".

Looking for "Einstein's riddle" in Wikipedia, leaded me to the article Zebra Puzzle. The article says:

The puzzle is often called Einstein's Puzzle or Einstein's Riddle because it is said to have been invented by Albert Einstein as a boy; it is also sometimes attributed to Lewis Carroll. However, there is no known evidence for Einstein's or Carroll's authorship and the Life International version of the puzzle mentions brands of cigarette, such as Kools, that did not exist during Carroll's lifetime or Einstein's boyhood.

Althought there are no code examples in the article.

There are some interesting links, among which a couple papers talk about Constraint programming:

The name "Constraint Satisfaction Problem" which I'm giving you comes from that last paper. The name "Zebra Puzzle" and the fact that it is a "Logic Puzzle" come from Wikipedia.

I also found the the Rosetta Code link in the Wikipedia article.

1

Think this might be Constraint Programming

https://en.m.wikipedia.org/wiki/Constraint_programming

Your Answer

wild is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.