Six Minikins met at Ekum's house and shared a potluck dinner. At one such gathering, one provided acorn soup, one provided mushrooms, one provided forest greens, one provided a variety of nuts, one provided baked fish, and one provided a favorite dessert made from honey, berries, and grain meal.
From the following statements, which friends brought which dishes, and what was the sequence of their arrival for the dinner?
- Ekum was late getting home, so was not the first to arrive.
- Ebum did not bring dessert, mushrooms, or nuts, nor was he the first to arrive.
- Ekum provided either dessert or nuts, and was not the last to arrive.
- The one who arrived first, who was not Epum, provided soup.
- Eskum arrived immediately after Evum, who arrived immediately after Epum.
- The last to arrive, who was not Eskum, brought the fish.
- The one who provided mushrooms, who was not Epum, was the third to arrive.
- The one who arrived immediately after Elfum brought the dessert.
DECLARE SUB permute (a$)
CLS
n$ = "bksvpl": hn$ = n$
DO
d$ = "smgnfd": hd$ = d$
DO
good = 1
IF LEFT$(n$, 1) = "k" THEN good = 0
IF LEFT$(n$, 1) = "b" THEN good = 0
ebix = INSTR(n$, "b")
IF MID$(d$, ebix, 1) = "d" THEN good = 0
IF MID$(d$, ebix, 1) = "m" THEN good = 0
IF MID$(d$, ebix, 1) = "n" THEN good = 0
ekix = INSTR(n$, "k")
IF MID$(d$, ekix, 1) <> "d" AND MID$(d$, ekix, 1) <> "n" THEN good = 0
IF RIGHT$(n$, 1) = "k" THEN good = 0
IF LEFT$(n$, 1) = "p" THEN good = 0
IF LEFT$(d$, 1) <> "s" THEN good = 0
IF INSTR(n$, "pvs") = 0 THEN good = 0
IF RIGHT$(d$, 1) <> "f" THEN good = 0
IF RIGHT$(n$, 1) = "s" THEN good = 0
IF MID$(d$, 3, 1) <> "m" THEN good = 0
IF MID$(n$, 3, 1) = "p" THEN good = 0
elix = INSTR(n$, "l")
IF MID$(d$, elix + 1, 1) <> "d" THEN good = 0
IF good THEN PRINT n$, d$
permute d$
LOOP UNTIL d$ = hd$
permute n$
LOOP UNTIL n$ = hn$
reports
lpvskb sdmgnf
meaning the sequence was, in order:
E E E E E E
l p v s k b
f u u k u u
u m m u m m
m m
s d m g n f
o e u r u i
u s s a t s
p s h i s h
e r n
r o
t o
m
s
Words are in columns reading down.
|
Posted by Charlie
on 2014-01-27 21:43:27 |