Questions tagged [zebra-puzzle]

A Zebra-puzzle is a combinatorial logic puzzle. Also known as Einstein's riddle, Caliban's problem, Five Houses Puzzle.

A Zebra-puzzle is a combinatorial logic puzzle. Also known as Einstein's riddle, Caliban's problem, Five Houses Puzzle.

112 questions
3
votes
1 answer

Numerical comparision in Einstein Riddle

My version is interested in the name, age, origin and subject of students. solve :- length(X, 6), % there are six students member([manuel, 19, _, _], X), % Manuel is 19 years old member([_, 20, _, win], X), % 20 years…
nicksheen
  • 550
  • 6
  • 23
3
votes
3 answers

Prolog: Murder Mystery solution

I recently started learning Prolog for fun. I found the following murder mystery puzzle. Since I don't know much about Prolog except the basics, I cannot really evaluate the solution provided in the link, however, it didn't seem particularly nice…
Carl
  • 705
  • 8
  • 22
3
votes
2 answers

is there a way to generate all unique permutations of a list of items

I have a list of five attributes, each attribute has five different values. I want to generate the Cartesian product of them and filter all unique permutations. Some background: I need them to be my input values to solve a logic puzzle. Where I…
Algore87
  • 43
  • 8
3
votes
4 answers

Truth table for the zebra puzzle

I'm reading "Computer Science distilled" book and I've faced a trouble. Author suggests to solve Einstein's "Zebra puzzle" through truth table, but I can't figure out how. I can't find starting conditions and variables. Do you have any ideas of the…
Igor
  • 198
  • 1
  • 11
3
votes
1 answer

Prolog: Trying to solve a puzzle! returned false

The code at the end on my post is supposed to answer the following puzzle: Brown, Clark, Jones and Smith are 4 substantial citizens who serve their community as achitect, banker, doctor and lawyer, though not necessarily respectively. Brown,…
AIM
  • 137
  • 1
  • 1
  • 5
3
votes
2 answers

Why I can't get an answer for the Ship Puzzle with Prolog?

I need to solve the Ship Puzzle problem with using Prolog. Here are the facts. There are 5 ships. The Greek ship leaves at six and carries coffee. The Ship in the middle has a black chimney. The English ship leaves at nine. The French ship with…
Punuth
  • 417
  • 3
  • 6
  • 19
3
votes
1 answer

Strange warning and computation result in constraint logic program

First, sorry for posting the whole program, but as I don't know were the problem is I don't know which parts are irrelevant. These are two slightly different implementations of the same logic puzzle in SWI-Prolog, the first one succeeds the second…
jules
  • 1,897
  • 2
  • 16
  • 19
3
votes
2 answers

Prolog logic puzzle & constraint programming

I have a homework assignment to define 10 facts in prolog to solve this puzzle. Five translators are working in an international organization: Spaniard, Englishman, Frenchman, German and Russian. Each of them speaks its native language and also…
Rene
  • 289
  • 1
  • 4
  • 8
3
votes
6 answers

Solving a textual logic puzzle in Prolog - Find birthday and month

I'm reading the "7 Languages in 7 Days"-book, and have reached the Prolog chapter. As a learning exercises I'm trying to solve some textual logic puzzles. The puzzle goes as follow: Five sisters all have their birthday in a different month and each…
Jonas Follesø
  • 6,441
  • 7
  • 41
  • 54
2
votes
1 answer

Zebra puzzle - who lives on which floor?

I have a zebra/Einstein type Prolog puzzle very similar to the one depicted here: A "Building" Riddle in Prolog. The riddle is: There are two buildings, each one has tree apartments (one apartment on each floor): one apartment of 3 rooms, one of 4…
Jamaico
  • 87
  • 10
2
votes
2 answers

Defining complicated facts - Einsteins Zebra

I am trying to figure out the right fact representation of complicated relations in Prolog. There are 6 tents in 2 lines represented as: tent(color, orientation, place, mans name, womans name, surename, car) I need to write down a fact saying…
2
votes
3 answers

Solving puzzle using constraints and permutations in Prolog

I have been asked to solve a puzzle similar to the zebra puzzle using Prolog. Instead, I am trying to find the nationality of the individual who eats pie. I know there are differing solutions for the problem, however I am trying to solve the puzzle…
2
votes
1 answer

Prolog and Logic Puzzles

I seem to be having an issue with the unification of facts in Prolog, but can't confirm it. Everything looks like it should work, and I've looked up examples of solved logic puzzles using Prolog to no real effect, given the relative rarity of…
2
votes
1 answer

Einstein's riddle

I am new to Prolog and I'm trying to model a riddle like the Einstein riddle, also known as the Zebra riddle, (but with 10 houses and 30 hints) in Prolog and I'm using this model example as a starting…
Javalicious
  • 43
  • 1
  • 6
2
votes
1 answer

Prolog puzzle with given Knowledge Base - Not Working

I know the title of the topic exists here: A prolog program that reflects people sitting at a round table But I need a different solution, more simple. So I have this problem where 4 people sit around a square table. We know their names. And that…