Write a piece of prolog code that solves the following puzzle. 4. Einstein’s 5 Houses Logic Puzz

Write a piece of prolog code that solves the following puzzle.

4. Einstein's 5 Houses Logic Puzzle (2 marks) Below is Einstein's five houses riddle taken from (https://udel.edu/ os/riddle.html): The situation: There are 5 houses in five different colors. In each house lives a person with a different nationality. These 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. The question is: Who owns the fish? Hints: • the Brit lives in the red house • the Swede keeps dogs as pets • the Dane drinks tea • the green house is on the left of the white house • the green house's owner drinks coffee • the person who smokes Pall Mall rears birds • the owner of the yellow house smokes Dunhill • the man living in the center house drinks milk • the Norwegian lives in the first house • the man who smokes blends lives next to the one who keeps cats • the man who keeps horses lives next to the man who smokes Dunhill • the owner who smokes BlueMaster drinks beer • the German smokes Prince • the Norwegian lives next to the blue house • the man who smokes blend has a neighbor who drinks water You will need to write at least the following 2 predicates: • solution(Persons) • ownerOfFish(Persons, Owner) where solution/1 generates the matrix used to determine the fish owner and ownerOfFish/2 extracts the owner of the fish from that matrix. You may create as many other predicates as you want.


Looking for a Similar Assignment? Hire our Top Uk Tutors while you enjoy your free time! All papers are written from scratch and are 100% Original. Try us today! Active Discount Code FREE15