Get in touch with us
Send us an e-mail
Question
Write a program to solve the classic “Einstein Riddle”. You can use Java, Python, R, C/C++.
Einstein’s Riddle
This classic riddle is claimed to have been written by Einstein but it is sometimes also attributed to Lewis Carrol, although there's no evidence that either of them actually wrote it. Regardless, it is an interesting problem that can be solved by logic but it also lends itself nicely as an AI programming exercise. There are many ways to code for this riddle – you are free to choose any approach you want. The riddle is:
There are five houses in five different colours in a row. In each house lives a person with a different nationality. The five owners drink a certain type of beverage, smoke a certain brand of cigar and keep a certain pet. No owners have the same pet, smoke the same brand of cigar, or drink the same beverage. Other facts:
The Brit lives in the red house.
The Swede keeps dogs as pets.
The Dane drinks tea.
The green house is on the immediate left of the white house.
The green house's owner drinks coffee.
The owner who smokes Pall Mall rears birds.
The owner of the yellow house smokes Dunhill.
The owner living in the centre house drinks milk.
The Norwegian lives in the first house.
The owner who smokes Blends lives next to the one who keeps cats.
The owner who keeps the horse lives next to the one who smokes Dunhill.
The owner who smokes Bluemasters drinks beer.
The German smokes Prince.
The Norwegian lives next to the blue house.
The owner who smokes Blends lives next to the one who drinks water.
The question is: who owns the fish?
Summary
This question belongs to programming and discusses about solving a classic Einstein’s riddle using programming.
Download Full Solution
From topic selection to questionnaire design, HwA has helped me in every step for my dissertation writing. They incorporated every change asked by my professor and at the end of everything I got excellent grades.
I never faced any problem with marketing management or finance. But with location strategy, I always suffered with the PERT and CRM based problems. I was unable to understand the concept of location strategies. When I came across HwA, I was relieved as they helped me overcome the horrors of location strategy and transformed my fear into a genuine interest.
I was stuck with a strategic human resource management assignment when I first took help from HwA. The corporate strategy assignment expert was wonderful and since then I have taken assistance many more times.
I am very happy customer of the atomic theory assignment help services of HwA. The online atomic theory assignment expert was very attentive to all the points that were mentioned by me to be followed for writing the assignment. I did not have to give any sort of reminders for the work and I received with plenty of time for me to go through it.
It is very affordable. I took the package for the entire semester and truth be told I have got absolute value for money till now. I am sure that I am taking the package for my next semester as well. Not to mention referring you to my friends at school.
Comments
this is a very good website
I have 50 questions for the same test your page is showing only 28
hi can you please help or guide me to answer my assignments. thanks
hi can anyone help or guide me to my assignments. thanks
This solution is perfect ...thanks
Hello Allison,I love the 2nd image that you did! I also, had never heard of SumoPaint, is something that I will have to exolpre a bit! I understand completely the 52 (or so) youtube videos that you probably watched. Sometimes they have what you want, sometimes they don't! However, it is always satisfying when you are able to produce something that you have taught yourself. Great job!Debra 0 likes
Perfect bank of solution.
great !
thanks for the quick response. the solution looks good. :)
thnx for the answer. it was perfect. just the way i wanted it.
works fine.