All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Logic
Vera's Date (Posted on 2013-06-12) Difficulty: 3 of 5
Vera wants to go on a date and prefers her date to be tall, dark and handsome.
  1. Of the preferred traits - tall, dark and handsome - no two of Adam, Boyd, Cary and Dirk have the same number.
  2. Only one of Adam or Dirk is tall and fair.
  3. Only one of Boyd or Cary is short and handsome.
  4. Adam and Cary are either both tall or both short.
  5. Boyd and Dirk are either both dark or both fair.
Who is tall, dark and handsome?

See The Solution Submitted by K Sengupta    
Rating: 4.5000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 2 of 10 |

There's a type in the program, leading to the wrong answer. See the comments made later.

DECLARE FUNCTION attct! (x!)
'tall=4
'dark=2
'handsome=1

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
             END IF
          END IF
        END IF

      END IF
  
    END IF
    NEXT
  END IF
  NEXT
END IF
NEXT
NEXT

FUNCTION attct (x)
  ct = ((4 AND x) = 4)
  ct = ct + ((2 AND x) = 2)
  ct = ct + ((1 AND x) = 1)
  attct = ct
END FUNCTION

finds

 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

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information