Reader Challenge: Einstein's Five-House Logic Problem

In part 1 of this series, I introduce a classic logic problem that took me nearly two hours to solve by hand. Later in the series, we'll use Access to program a solution.

Reader Challenge: Einstein's Five-House Logic Problem

My 8th-grade daughter was assigned a logic problem for extra credit tonight.  

Me being me, I couldn't let it go until I solved it.  It ended up taking me nearly two hours to arrive at a solution, but I did finally get there.  

Since programming at its core is little more than solving a series of logic problems, this sort of mental exercise is a good way to sharpen one's thinking.  Plus, if you're the kind of person who thinks programming is fun, you'll likely find joy in this exercise, too.  

As I was grinding away at this puzzle, my mind often started wandering as I thought about how I might program a solution to this conundrum.  We'll explore that aspect of the puzzle in future posts.

If nothing else, hopefully I can suck you in and get you to waste two hours (more or less) of your own time figuring this thing out so at least then I won't be alone. Misery loves company and all that. 😁

The Problem

There are many variations of this logic puzzle.  This particular version comes from my daughter's 8th grade math text book:


Below are the 15 clues to one version of a famous and difficult logic puzzle called "Who Owns the Zebra?" People have reported that Lewis Carroll or Albert Einstein wrote it, but the earliest appearance seems to be in 1962, after these men had died.

  1. There are five houses in a row, each of a different color and inhabited by people of different nationalities with different pets, drinks, and flowers.
  2. The English person lives in the red house.
  3. The Spaniard owns the dog.
  4. Coffee is drunk in the green house.
  5. The Ukrainian drinks tea.
  6. The green house is immediately to the right (your right) of the ivory house.
  7. The geranium grower owns snails.
  8. Roses are in front of the yellow house.
  9. Milk is drunk in the middle house.
  10. The Norwegian lives in the first house on the left.
  11. The person who grows marigolds lives in the house next to the person with the fox.
  12. Roses are grown at the house next to the house where the horse is kept.
  13. The person who grows lilies drinks orange juice.
  14. The Japanese person grows gardenias.
  15. The Norwegian lives next to the blue house.

Who drinks water? And who owns the zebra?


No Spoilers, Please

Please don't post answers in the comments; I'll just delete them.  There will be opportunity to post your solution to the problem in future articles.

I would say no cheating, but what do I care?  You'd only be cheating yourself out of a fun and rewarding growth opportunity.

Image by David Mark from Pixabay

All original code samples by Mike Wolfe are licensed under CC BY 4.0