The Hatter, the Hare, the Rabbit, the Mouse, Alice and I met for a Tea Party. The table had two sides, with three chairs on each side, numbered like so:
Side A: 1 2 3
Side B: 6 5 4
Chair one was across from chair 6, chair 2 across from chair 5, etc. We would sit down one at a time, in any chair we choose. The first guest to sit down was called the first guest. After the second guest sat down, however, everyone moved clockwise to the next chair. This behavior was continued after the fourth and sixth guest sat down.
My question is, after everyone had been seated, where was I seated?
(1) The first guest sat in chair 1.
(2) The mouse sat down last.
(3) After the first time everyone moved, no one had been on side B yet.
(4) The Hatter and Alice choose the same starting chair.
(5) When I was in chair 1, the Rabbit was in chair 6.
(6) I started on side B, but didn't end there.
(7) The hare moved all three times.
(8) Alice ended up between the mouse and the hare.
(9) I sat down after the rabbit but before the hatter.
(10) The mouse sat down in an odd numbered chair.
Also, a bonus question. Who am I?
DECLARE SUB permute (a$)
CLS
mp$ = "3456"
mg$ = "thrai"
FOR p = 1 TO 24
permute mp$
ps$ = "12" + mp$
FOR g = 1 TO 120
permute mg$
pg$ = mg$ + "m"
ix = INSTR(pg$, "i")
good = 1
IF ix < INSTR(pg$, "r") OR ix > INSTR(pg$, "t") THEN good = 0
IF INSTR(pg$, "h") < 3 AND good > 0 THEN
chair$ = SPACE$(6)
good = 1: foundI = 0
FOR turn = 1 TO 6
plc = VAL(MID$(ps$, turn, 1))
SELECT CASE turn
CASE 1, 2
CASE 3, 4
plc = plc + 1
CASE 5, 6
plc = plc + 2
END SELECT
IF plc > 6 THEN plc = plc - 6
g$ = MID$(pg$, turn, 1)
IF g$ = "i" AND plc < 4 THEN good = 0: EXIT FOR
IF g$ = "m" AND plc / 2 = INT(pcl / 2) THEN good = 0: EXIT FOR
IF g$ = "a" THEN aPos = plc
IF g$ = "t" THEN tPos = plc
MID$(chair$, plc, 1) = MID$(pg$, turn, 1)
IF turn = 2 OR turn = 4 OR turn = 6 THEN
chair$ = RIGHT$(chair$, 1) + LEFT$(chair$, 5)
END IF
IF MID$(chair$, 1, 1) = "i" THEN
foundI = 1
IF MID$(chair$, 6, 1) <> "r" THEN good = 0: EXIT FOR
END IF
NEXT
ELSE
good = 0
END IF
IF foundI = 0 THEN good = 0
IF aPos <> tPos THEN good = 0
a = INSTR(chair$, "a")
aplus = a + 1: IF aplus > 6 THEN aplus = 1
aminus = a - 1: IF aminus < 1 THEN aminus = 6
IF INSTR("mh", MID$(chair$, aplus, 1)) = 0 THEN good = 0
IF INSTR("mh", MID$(chair$, aminus, 1)) = 0 THEN good = 0
IF good THEN
PRINT pg$
PRINT ps$
PRINT chair$
PRINT
END IF
NEXT
NEXT
This finds two solutions:
haritm
124563
ritham
ahritm
123456
itmahr
where the first line is the sequence of guests sitting down (where t represents the hatter and i represents the narrator). The last line represents the final seats of the particapants, in order from seat 1 to seat 6.
The middle row in each represents the moving slot in which the guest sat: that is, at the beginning each slot is labeled with the chair in which it is located, but after moves 2, 4 and 6 each slot moves a chair clockwise. So we could relabel these by the current chair under which the entering guest took the place:
haritm
125625
ritham
ahritm
124512
itmahr
so the first solution has
Hare sits in chair 1.
Alice sits in chair 2.
Rabbit sits in chair 5.
"I" (narrator) sits in chair 6.
Hatter sits in chair 2.
Mouse sits in chair 5.
They wind up Rabbit, "I", Hatter, Hare, Alice, Mouse in seats 1-6.
The second solution:
Alice sits in chair 1.
Hare sits in chair 2.
Rabbit sits in chair 4.
"I" sits in chair 5.
Hatter sits in chair 1.
Mouse sits in chair 2.
They wind up with "I", Hatter, Mouse, Alice, Hare and Rabbit in seats 1-6.
So the narrator could have ended up in either chair 1 or chair 2, unless I'm missing something.
whoops...
The second solution has the mouse sitting in an even chair. The narrator actually ends up in chair 2. The following line was supposed to catch that, but didn't:
IF g$ = "m" AND plc / 2 = INT(pcl / 2) THEN good = 0: EXIT FOR
but of course that was a misspelling of plc as pcl.
Edited on May 18, 2005, 10:40 pm
|
Posted by Charlie
on 2005-05-18 22:34:51 |