Mr and Mrs Alden , Mr and Mrs Brent , Mr and Mrs Crown , Mr and Mrs Drake were seated around a table.
Their chairs were arranged around the square table like this:
a b
++++
   
h ++++ c
   
g ++++ d
   
++++
f e
For example, persons sitting at positions b and c are
considered next to each other.
 The person sitting across from Mrs Alden was a man who sat on Mr Brent's immediate left.
 The person sitting on Mrs Crown's immediate left was a man who sat across from Mr Drake.
 Only one couple did not sit next to each other & this couple did not sit across from each other.
Which couple did not sit next to each other?
DECLARE FUNCTION opposite! (x!)
DECLARE SUB permute (a$)
CLS
a$ = "ABCDabcd": h$ = a$
DO
MrsAlden = INSTR(a$, "a")
tst = opposite(MrsAlden)
MrBrent = tst  1: IF MrBrent < 1 THEN MrBrent = MrBrent + 8
IF MID$(a$, MrBrent, 1) = "B" AND MID$(a$, tst, 1) = UCASE$(MID$(a$, tst, 1)) THEN
MrsCrown = INSTR(a$, "c")
tst = MrsCrown + 1: IF tst > 8 THEN tst = tst  8
IF MID$(a$, tst, 1) = UCASE$(MID$(a$, tst, 1)) THEN
MrDrake = opposite(tst)
IF MID$(a$, MrDrake, 1) = "D" THEN
IF LEFT$(a$, 2) < MID$(a$, 3, 2) THEN
IF LEFT$(a$, 2) < MID$(a$, 5, 2) THEN
IF LEFT$(a$, 2) < MID$(a$, 7, 2) THEN
adjCt = 0: REDIM adj(4)
MrAlden = INSTR(a$, "A")
tst = ABS(MrAlden  MrsAlden)
IF tst = 1 OR tst = 7 THEN adjCt = adjCt + 1: adj(1) = 1
MrsBrent = INSTR(a$, "b")
tst = ABS(MrBrent  MrsBrent)
IF tst = 1 OR tst = 7 THEN adjCt = adjCt + 1: adj(2) = 1
MrCrown = INSTR(a$, "C")
tst = ABS(MrCrown  MrsCrown)
IF tst = 1 OR tst = 7 THEN adjCt = adjCt + 1: adj(3) = 1
MrsDrake = INSTR(a$, "d")
tst = ABS(MrDrake  MrsDrake)
IF tst = 1 OR tst = 7 THEN adjCt = adjCt + 1: adj(4) = 1
IF adjCt = 3 THEN
FOR i = 1 TO 4
IF adj(i) = 0 THEN nonadj = i
NEXT
nadj$ = MID$("abcd", nonadj, 1)
nadjpos = INSTR(a$, nadj$)
opp = opposite(nadjpos)
mate$ = MID$(a$, opp, 1)
IF LCASE$(mate$) <> nadj$ THEN
PRINT a$, nadj$: ct = ct + 1
END IF
END IF
END IF
END IF
END IF
END IF
END IF
END IF
permute a$
LOOP UNTIL a$ = h$
PRINT ct
FUNCTION opposite (x)
SELECT CASE x
CASE 1
opposite = 6
CASE 2
opposite = 5
CASE 3
opposite = 8
CASE 4
opposite = 7
CASE 5
opposite = 2
CASE 6
opposite = 1
CASE 7
opposite = 4
CASE 8
opposite = 3
END SELECT
END FUNCTION
finds
positions
abcdefgh

AabBCDdc c
where capital letters are the men identified by last initial and women by lowercase letters.
So as not to include rotations, only the solution where the content of positions a and b is lower than the content of any other side of the table is shown.
Going clockwise as seen from above has the effect that being to someone's left means being to the right on the above scheme except when wrapping around the end to the beginning.
The letter to the right is the initial of the couple not sitting next to each other. Thus it is the Crowns who did not sit next to each other.

Posted by Charlie
on 20130225 14:55:08 