WHO OWNS THE ZEBRA?
There are five houses, each of a different color and inhabited by men
of different nationalities, with different pets, drinks, and brands of
cigarettes.
The Clues:
1. The Englishman lives in the red house.
2. The Spaniard owns the dog.
3. Coffee is drunk in the green house.
4. The Ukranian drinks tea.
5. The green house is immediately to the right (your right) of the ivory
house.
6. The Old Gold smoker owns snails.
7. Kools are smoked in the yellow house.
8. Milk is drunk in the middle house.
9. The Norwegian lives in the first house on the left.
10. The man who smokes Chesterfields lives in the house next to the man
who owns the fox.
11. Kools are smoked in the house next to the house where the horse is kept.
12. The Lucky Strike smoker drinks orange juice.
13. The Japanese smokes Parliaments.
14. The Norwegian lives next to the blue house.
Now, who drinks water?...and who owns the zebra?
Hope you enjoy it!
Warren Brown in Fremont, CA
Dan.
From ple...@lonestar.utsa.edu (Paul A. Lentz )
Newsgroups: rec.puzzles
Subject: Who owns the Zebra?
Date: Mon, 6 Jun 1994 04:53:42 GMT
`I was assigned this puzzle and I need all the help I can get.
1.There are five houses, each a different color and inhabited by men of
different nationalities, with different pets, drinks, and cars.
2. The Englishman lives in the red huse.
3. The spaniard owns the dog.
4. Cocoa is drunk in Green house.
5. The Ukrainian drinks eggnog.
6. The Green House is immediately to the right (your right) of the ivory house.
7. The Oldsmobile owner owns snails.
8. The owner of the Ford lives in the Yellow House.
9. Milk is drunk in the middle house.
10. The Norwegian lives in the first houseon the left.
11. The man who owns the Chevrolet lives in the house next to the house where
the man owns the fox.
12. The Ford owner's house is next to the house where the horse is kept
13. The Mercedes owner drinks orange juce.
14. The japanese dirves a Volkswagan.
15. The Morwegian lives next to the blue house.
Now- Who drinks water?
Who owns the Zebra? I am sorry about the lack of carrage-returns.
Could you please e-mail the
solutions to me as I need them for an assignment.
:
--------------------------------------------------------------------------
Yellow Blue Red Ivory Green
Norwegian Ukrainian Englishman Spaniard Japanese
Water Eggnog Milk Orange juice Cocoa
Fox Horse Snails Dog Zebra
Ford Chevrolet Oldsmobile Mercedes VW
--------------------------------------------------------------------------
The Norwegian drinks water, while the Japanese owns a Zebra.
--
--------------------------------------------------------------------------
| Dror Lubin E-mail: lu...@fy.chalmers.se |
| Department of Applied Physics Tel: +(46)(31)7723186 |
| Chalmers University of Technology Fax: +(46)(31)416984 |
| 412 96 Goteborg, Sweden. |
--------------------------------------------------------------------------
This question is in the rec.puzzles archive:
==> logic/dell.p <==
How can I solve logic puzzles (e.g., as published by Dell) automatically?
==> logic/dell.s <==
#include <setjmp.h>
#define EITHER if (S[1] = S[0], ! setjmp((S++)->jb)) {
#define OR } else EITHER
#define REJECT longjmp((--S)->jb, 1)
#define END_EITHER } else REJECT;
/* values in tmat: */
#define T_UNK 0
#define T_YES 1
#define T_NO 2
#define Val(t1,t2) (S->tmat[t1][t2])
#define CLASS(x) \
(((x) / NUM_ITEM) * NUM_ITEM)
#define EVERY_TOKEN(x) \
(x = 0; x < TOT_TOKEN; x++)
#define EVERY_ITEM(x, class) \
(x = CLASS(class); x < CLASS(class) + NUM_ITEM; x++)
#define BEGIN \
struct state { \
char tmat[TOT_TOKEN][TOT_TOKEN]; \
jmp_buf jb; \
} States[100], *S = States; \
\
main() \
{ \
int token; \
\
for EVERY_TOKEN(token) \
yes(token, token); \
EITHER
/* Here is the problem-specific data */
#define NUM_ITEM 5
#define NUM_CLASS 6
#define TOT_TOKEN (NUM_ITEM * NUM_CLASS)
#define HOUSE_0 0
#define HOUSE_1 1
#define HOUSE_2 2
#define HOUSE_3 3
#define HOUSE_4 4
#define ENGLISH 5
#define SPANISH 6
#define NORWEG 7
#define UKRAIN 8
#define JAPAN 9
#define GREEN 10
#define RED 11
#define IVORY 12
#define YELLOW 13
#define BLUE 14
#define COFFEE 15
#define TEA 16
#define MILK 17
#define OJUICE 18
#define WATER 19
#define DOG 20
#define SNAIL 21
#define FOX 22
#define HORSE 23
#define ZEBRA 24
#define OGOLD 25
#define PLAYER 26
#define CHESTER 27
#define LSTRIKE 28
#define PARLIA 29
char *names[] = {
"HOUSE_0", "HOUSE_1", "HOUSE_2", "HOUSE_3", "HOUSE_4",
"ENGLISH", "SPANISH", "NORWEG", "UKRAIN", "JAPAN",
"GREEN", "RED", "IVORY", "YELLOW", "BLUE",
"COFFEE", "TEA", "MILK", "OJUICE", "WATER",
"DOG", "SNAIL", "FOX", "HORSE", "ZEBRA",
"OGOLD", "PLAYER", "CHESTER", "LSTRIKE", "PARLIA",
};
BEGIN
yes(ENGLISH, RED); /* Clue 1 */
yes(SPANISH, DOG); /* Clue 2 */
yes(COFFEE, GREEN); /* Clue 3 */
yes(UKRAIN, TEA); /* Clue 4 */
EITHER /* Clue 5 */
yes(IVORY, HOUSE_0);
yes(GREEN, HOUSE_1);
OR
yes(IVORY, HOUSE_1);
yes(GREEN, HOUSE_2);
OR
yes(IVORY, HOUSE_2);
yes(GREEN, HOUSE_3);
OR
yes(IVORY, HOUSE_3);
yes(GREEN, HOUSE_4);
END_EITHER
yes(OGOLD, SNAIL); /* Clue 6 */
yes(PLAYER, YELLOW); /* Clue 7 */
yes(MILK, HOUSE_2); /* Clue 8 */
yes(NORWEG, HOUSE_0); /* Clue 9 */
EITHER /* Clue 10 */
yes(CHESTER, HOUSE_0);
yes(FOX, HOUSE_1);
OR
yes(CHESTER, HOUSE_4);
yes(FOX, HOUSE_3);
OR
yes(CHESTER, HOUSE_1);
EITHER yes(FOX, HOUSE_0);
OR yes(FOX, HOUSE_2);
END_EITHER
OR
yes(CHESTER, HOUSE_2);
EITHER yes(FOX, HOUSE_1);
OR yes(FOX, HOUSE_3);
END_EITHER
OR
yes(CHESTER, HOUSE_3);
EITHER yes(FOX, HOUSE_2);
OR yes(FOX, HOUSE_4);
END_EITHER
END_EITHER
EITHER /* Clue 11 */
yes(PLAYER, HOUSE_0);
yes(HORSE, HOUSE_1);
OR
yes(PLAYER, HOUSE_4);
yes(HORSE, HOUSE_3);
OR
yes(PLAYER, HOUSE_1);
EITHER yes(HORSE, HOUSE_0);
OR yes(HORSE, HOUSE_2);
END_EITHER
OR
yes(PLAYER, HOUSE_2);
EITHER yes(HORSE, HOUSE_1);
OR yes(HORSE, HOUSE_3);
END_EITHER
OR
yes(PLAYER, HOUSE_3);
EITHER yes(HORSE, HOUSE_2);
OR yes(HORSE, HOUSE_4);
END_EITHER
END_EITHER
yes(LSTRIKE, OJUICE); /* Clue 12 */
yes(JAPAN, PARLIA); /* Clue 13 */
EITHER /* Clue 14 */
yes(NORWEG, HOUSE_0);
yes(BLUE, HOUSE_1);
OR
yes(NORWEG, HOUSE_4);
yes(BLUE, HOUSE_3);
OR
yes(NORWEG, HOUSE_1);
EITHER yes(BLUE, HOUSE_0);
OR yes(BLUE, HOUSE_2);
END_EITHER
OR
yes(NORWEG, HOUSE_2);
EITHER yes(BLUE, HOUSE_1);
OR yes(BLUE, HOUSE_3);
END_EITHER
OR
yes(NORWEG, HOUSE_3);
EITHER yes(BLUE, HOUSE_2);
OR yes(BLUE, HOUSE_4);
END_EITHER
END_EITHER
/* End of problem-specific data */
solveit();
OR
printf("All solutions found\n");
exit(0);
END_EITHER
}
no(a1, a2)
{
int non1, non2, token;
if (Val(a1, a2) == T_YES)
REJECT;
else if (Val(a1, a2) == T_UNK) {
Val(a1, a2) = T_NO;
no(a2, a1);
non1 = non2 = -1;
for EVERY_ITEM(token, a1)
if (Val(token, a2) != T_NO)
if (non1 == -1)
non1 = token;
else
break;
if (non1 == -1)
REJECT;
else if (token == CLASS(a1) + NUM_ITEM)
yes(non1, a2);
for EVERY_TOKEN(token)
if (Val(token, a1) == T_YES)
no(a2, token);
}
}
yes(a1, a2)
{
int token;
if (Val(a1, a2) == T_NO)
REJECT;
else if (Val(a1, a2) == T_UNK) {
Val(a1, a2) = T_YES;
yes(a2, a1);
for EVERY_ITEM(token, a1)
if (token != a1)
no(token, a2);
for EVERY_TOKEN(token)
if (Val(token, a1) == T_YES)
yes(a2, token);
else if (Val(token, a1) == T_NO)
no(a2, token);
}
}
solveit()
{
int token, tok2;
for EVERY_TOKEN(token)
for (tok2 = token; tok2 < TOT_TOKEN; tok2++)
if (Val(token, tok2) == T_UNK) {
EITHER
yes(token, tok2);
OR
no(token, tok2);
END_EITHER;
return solveit();
}
printf("Solution:\n");
for EVERY_ITEM(token, 0) {
for (tok2 = NUM_ITEM; tok2 < TOT_TOKEN; tok2++)
if (Val(token, tok2) == T_YES)
printf("\t%s %s\n",names[token],names[tok2]);
printf("\n");
}
REJECT;
}
---
ja...@crc.ricoh.com (James Allen)
********************************************
Instructions for Accessing the rec.puzzles Archive
INTRODUCTION
The rec.puzzles Archive is a list of puzzles, categorized by subject
area. Each puzzle includes a solution, compiled from various sources,
which is supposed to be definitive.
To request a puzzle, send a message to archive...@questrel.com like:
return_address your_name@your_site.your_domain
send requested_puzzle_name
For example, if your net address is "mic...@disneyland.com", to request
"decision/allais.p", send the message:
return_address mic...@disneyland.com
send allais
To request the index, use:
send index
To request multiple puzzles, use several "send" lines in a message.
Please refrain from requesting the entire archive via email. Use FTP.
FTP
The entire archive is also accessible via anonymous FTP, from any site
which maintains archives of the newsgroups news.answers or
rec.answers. One such site is rtfm.mit.edu, where the archive is in
the directory /pub/usenet/news.answers/puzzles/archive. The file
part01 contains the index. The remaining files contain alternating
problem text and solution text for all the puzzles.
Some other anonymous FTP archives are:
Site IP address Directory Notes
---------------------------------------------------------------------
ftp.cs.ruu.nl 131.211.80.17 /pub/NEWS.ANSWERS [1]
ftp.uu.net 137.39.1.9 /usenet/news.answers
or 192.48.96.9
ftp.win.tue.nl 131.155.70.100 /pub/usenet/news.answers
grasp1.univ-lyon1.fr 134.214.100.25 /pub/faq [2]
---------------------------------------------------------------------
[1] Also accessible via mail server requests to mail-...@cs.ruu.nl.
[2] Also accessible via mail server requests to
list...@grasp1.univ-lyon1.fr. Best used by EASInet sites.
Note that the periodic posting archives on rtfm.mit.edu are also
accessible via Prospero and WAIS (the database name is "usenet" on
port 210).
THE rec.puzzles ORACLE
This is a group of rec.puzzles regulars, who are familiar with the
rec.puzzles archive, and who will find your answer there if it exists,
or maybe compose an original answer if they are interested enough!
At any rate, they promise to respond to your question within two days,
and perhaps save you the embarrassment of posting a well-worn
question. They will respond within two days even if they do not know
the answer to your question.
To query the rec.puzzles oracle, send email containing your question
to the following address:
He's right about that, anyway. I'm reasonably sure that I first saw it
when I was in what we called "senior public school", which was 1965-67.
> This question is in the rec.puzzles archive:
> ==> logic/dell.p <==
> How can I solve logic puzzles (e.g., as published by Dell) automatically?
[250 lines of code deleted]
I think the reader might reasonably complain that Chris has answered a
different question. Providing a general procedure to solve all such
problems is the mathematician's answer, but the mathematician is more
interested in disposing of the problem and getting on to something else.
The puzzle fan, on the other hand, is likely to be interested in simply
solving the problem *without* applying a general procedure either by
computer program or by marking X's in a grid. The somewhat more
sophisticated fan may achieve pleasure by taking this "manual" approach
and producing a solution *in the minimum number of steps*. And as
I say, the archive entry that was posted does not consider this at all.
--
Mark Brader, m...@sq.com | "I shot a query into the net.
SoftQuad Inc., Toronto | I haven't got an answer yet ..." -- Ed Nather
This article is in the public domain.