Vera wants to go on a date and prefers her date to be tall, dark and handsome.
- Of the preferred traits - tall, dark and handsome - no two of Adam, Boyd, Cary and Dirk have the same number.
- Only one of Adam or Dirk is tall and fair.
- Only one of Boyd or Cary is short and handsome.
- Adam and Cary are either both tall or both short.
- Boyd and Dirk are either both dark or both fair.
Who is tall, dark and handsome?
There's a type in the program, leading to the wrong answer. See the comments made later.
DECLARE FUNCTION attct! (x!)
FOR a = 0 TO 7
act = attct(a)
FOR b = 0 TO 7
bct = attct(b)
IF bct <> act THEN
FOR c = 0 TO 7
cct = attct(c)
IF cct <> act AND cct <> bct THEN
FOR d = 0 TO 7
dct = attct(d)
IF dct <> act AND dct <> bct AND dct <> cct THEN
atall = a AND 4: afair = NOT (a) AND 2
atall = d AND 4: dfair = NOT (d) AND 2
atallfair = atall + afair
dtallfair = dtall + dfair
IF atallfair = 6 AND dtallfair <> 6 OR atallfair <> 6 AND dtallfair = 6 THEN
bhand = b AND 1: bshort = NOT (b) AND 4
chand = c AND 1: cshort = NOT (c) AND 4
bhandshort = bhand + bshort
chandshort = chand + cshort
IF bhandshort = 5 AND chandshort <> 5 OR ahandshort <> 5 AND dhandshort = 5 THEN
atall = a AND 4: ctall = c AND 4
IF atall = ctall THEN
bdark = b AND 2: ddark = d AND 2
IF bdark = ddark THEN
PRINT a; b; c; d
FUNCTION attct (x)
ct = ((4 AND x) = 4)
ct = ct + ((2 AND x) = 2)
ct = ct + ((1 AND x) = 1)
attct = ct
a b c d
0 3 2 7
1 3 0 7
Indicating that only Dirk is tall, dark and handsome.
We also know that Boyd is short, dark and handsome.
Either Adam or Cary lacks all three of Vera's requirements; if it's Adam, then Cary is dark; if it's Cary then Adam is handsome.
Edited on June 13, 2013, 10:06 am
Posted by Charlie
on 2013-06-12 15:23:43