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

Home > Logic
Family Murder Muse (Posted on 2014-04-09) Difficulty: 3 of 5
Murder occurred one evening in the home of a married couple Mr. Hahn and Mrs. Hahn and their son Oliver and their daughter Claire. One member of the family murdered another member, the third member witnessed the crime, and the fourth member was an accessory after the fact.
  1. The accessory and the witness were of the opposite sex.
  2. The oldest member and the witness were of the opposite sex.
  3. The youngest member and the victim were of the opposite sex.
  4. The accessory was older than the victim.
  5. Mr. Hahn was the oldest member.
  6. The killer was not the youngest member.
From the above clues, determine which one of the four Mr. Hahn, Mrs. Hahn, Oliver or Claire - was the killer?

No Solution Yet Submitted by K Sengupta    
No Rating

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

DECLARE FUNCTION cap! (x$)
DECLARE SUB permute (a$)
CLS
a$ = "HwOc": h$ = a$   ' order murderer, victim, witness, accessory
age$ = "HwOc": hage$ = age$ ' young to old
DO
  good = 1
  IF INSTR(age$, "H") < INSTR(age$, "O") OR INSTR(age$, "w") < INSTR(age$, "O") THEN good = 0
  IF INSTR(age$, "H") < INSTR(age$, "c") OR INSTR(age$, "w") < INSTR(age$, "c") THEN good = 0
  IF RIGHT$(age$, 1) <> "H" THEN good = 0
  IF good THEN
    DO
      IF INKEY$ = CHR$(27) THEN STOP
      m$ = MID$(a$, 1, 1)
      v$ = MID$(a$, 2, 1)
      w$ = MID$(a$, 3, 1)
      ac$ = MID$(a$, 4, 1)
      good = 1
      IF cap(ac$) = cap(w$) THEN good = 0
      IF cap(w$) THEN good = 0
      y$ = LEFT$(age$, 1)
      IF cap(y$) = cap(v$) THEN good = 0
      IF INSTR(age$, ac$) < INSTR(age$, v$) THEN good = 0
      IF LEFT$(age$, 1) = m$ THEN good = 0
      IF good THEN PRINT a$, age$
      permute a$
    LOOP UNTIL a$ = h$
  END IF
  permute age$
LOOP UNTIL age$ = hage$

FUNCTION cap (x$)
  IF UCASE$(x$) = x$ THEN cap = 1:  ELSE cap = 0
END FUNCTION

(in the above, upper case initials are capital for male and lower case for female; H and w represent husband and wife.)

finds

wOcH      cOwH

meaning that

the wife was the murderer
Oliver was the victim
Claire was the witness
the husband was the accessory

from youngest to oldest: Clair, Oliver, the wife, the husband.


First puzzle done on new Windows 7 machine (previously on XP). Needed to use DOSbox, which is 20 to 25 times as slow as running natively on Command Prompt in XP; but the short permutations here did not need a lot of speed. Permutations of 10 characters takes "forever". Such will need QB64, which is not so good at debugging. Come to think of it DOSbox doesn't allow interrupting a running program manually, even though it does allow setting breakpoints in the program.


  Posted by Charlie on 2014-04-09 14:40:09
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 (5)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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