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
2
votes
1 answer

Prolog: ERROR: >/2: Arguments are not sufficiently instantiated

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
2
votes
1 answer

Einstein Riddle using Prolog

I'm trying to solve the Einstein riddle using Prolog. When I'm trying to run by houses(Hs), it shows No. Task is 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…
user3637775
  • 499
  • 4
  • 20
2
votes
2 answers

Einstein Riddle with List of terms

I implemented Einstein Riddle in Prolog and I'm trying to find out who had a fish at home. I can't find fault in this code and trace option is not helping with this problem ;) Rules: Norwegian lives in first house The Englishman lives in…
2
votes
2 answers

Logic Puzzle in Prolog - using lists

I am trying to solve the following problem in Prolog, and I think I have coded it right, but my queries simply return false. Any advice on what to change? The problem is as follows: "Bagel Alley, the local bagel shop, was always a location of…
2
votes
1 answer

Filling a table in Prolog, given specific clues (Einstein riddle)

There is a hypothetical table of five offices. Each office has a color, a department, a pc, a drink, a cellphone and a specific position from 1 to 5: I am trying to give the following clues to Prolog, so that it can fill the table correctly: the…
2
votes
2 answers

Prolog puzzle baker, meatman and carpenter

This is a very simple puzzle I found on the web, I don't find any solution on internet. The rules are simples: There are 6 artisans, M.Baker and his son, M.Carpenter and his son and M.Meatman and his son Each artisan can be baker, carpenter or…
Metal3d
  • 2,905
  • 1
  • 23
  • 29
2
votes
1 answer

Prolog - trying to solve textual puzzle

I'm currently trying to learn a little Prolog. As an exercise I'm trying to solve the following riddle: These rules are given: *Every person that has neither a car nor a plane, has a bike. *Every person that doesn't have a plane but has a bike, has…
tschaei
  • 307
  • 1
  • 6
  • 14
2
votes
0 answers

Expressing Einstein Puzzle as a Set of Closed Formulas in First Order Logic

I am given the classic Einstein/Zebra puzzle in this form: Let us assume that there are five houses of different colors next to each other on the same road. In each house lives a man of a different nationality. Every man has his favorite drink, his…
1
vote
1 answer

Why is this prolog function running indefinitely, how do I fix it?

I am trying to create a prolog predicate to solve this zebra problem however It keeps on running indefinitely and does not produce a result, how can I fix this. Here is the Zebra Problem: The five biggest DJs in the world are going to play in an…
1
vote
3 answers

Solving a logic task using Prolog

I started to learn Prolog and I can't solve a difficult task for me. On Halloween, three friends - Bob, Mark, Alex, chose the costumes of three ghosts: a ghost, a zombie, a werewolf. It is known that: Bob is the tallest. The one who chose the…
Tempos
  • 23
  • 5
1
vote
3 answers

Prolog - animal puzzle, need to force each atom to be used only once

I've seen a few posts on SO discussing this puzzle, but they seem to be aimed at fast execution and I don't really understand what's going on. I'm trying to keep it very simple and want to write something that is declarative and human readable. I've…
LearnDude
  • 83
  • 8
1
vote
2 answers

How to solve and how to use negation in this Prolog puzzle?

I want to solve this logic puzzle with Prolog without using any built-in functions or libraries. The problem is I don't know how to formulate the negative terms in the code. The negative terms are in the second, the third, and the seventh part. For…
Kadam
  • 23
  • 1
  • 13
1
vote
1 answer

Zebra problem with modifications in prolog

I have a Zebra Problem modified but I can't do correct. This are my sentences : The Brazilian doesn’t live in the second house. The dog owner plays basketball. There is an intermediate house between the football players house and the red…
1
vote
1 answer

knowledgment unification in prolog

What I have to do is to unify the possible options and solve the problem with these sentences The Spaniard lives next to the red house. The Norwegian lives in the blue house. An Italian lives in the second house. This is my attempt but I am…
Miguel JV
  • 67
  • 5
1
vote
1 answer

Simplifying constraints in CLP puzzle

At the local games evening, four lads were competing in the Scrabble and chess competitions. Liam beat Mark in chess, James came third and the 16 year old won. Liam came second in Scrabble, the 15 year old won, James beat the 18 year old and the 19…
vasily
  • 2,850
  • 1
  • 24
  • 40