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

Home > Logic
Five Hunters (Posted on 2014-02-12) Difficulty: 3 of 5
Five friends (named Lion, Deer, Hare, Boar, and Tiger) have just come back from hunting with five dead animals of the same names. It is known that:
  • Each has killed one animal, not corresponding to his/her own name, and:
  • Each has missed another differently named animal, also not corresponding to his/her own name.
It is further known that:

1. The deer was killed by the hunter who has the name of the animal missed by Tiger.
2. The lion was killed by the hunter who has the name of the animal missed by Hare.
3. Deer, who missed a tiger, was very disappointed to kill only a hare.

Who killed and missed what animals?

See The Solution Submitted by K Sengupta    
No Rating

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

DECLARE SUB permute (a$)
DIM names AS STRING, hit AS STRING, miss AS STRING

names = "ldhbt"
mrTiger = INSTR(names, "t")
mrHare = INSTR(names, "h")
mrDeer = INSTR(names, "d")

CLS
hit = "dhbtl": h$ = hit
DO
  miss = "hbtld": m$ = miss
  DO
    good = 1
    FOR i = 1 TO 5
      IF MID$(names, i, 1) = MID$(hit, i, 1) THEN good = 0: EXIT FOR
      IF MID$(names, i, 1) = MID$(miss, i, 1) THEN good = 0: EXIT FOR
      IF MID$(miss, i, 1) = MID$(hit, i, 1) THEN good = 0: EXIT FOR
    NEXT
    IF good THEN
      tgmiss$ = MID$(miss, mrTiger, 1)
      drkiller = INSTR(names, tgmiss$)
      IF MID$(hit, drkiller, 1) <> "d" THEN good = 0
      hrmiss$ = MID$(miss, mrHare, 1)
      hrkiller = INSTR(names, hrmiss$)
      IF MID$(hit, hrkiller, 1) <> "l" THEN good = 0
      IF MID$(miss, mrDeer, 1) <> "t" THEN good = 0
      IF MID$(hit, mrDeer, 1) <> "h" THEN good = 0
      IF good THEN
        PRINT names: PRINT hit: PRINT miss
      END IF
    END IF
    permute miss
  LOOP UNTIL miss = m$
  permute hit
LOOP UNTIL hit = h$

finds

ldhbt
dhtlb
htbdl

meaning

Mr. Lion killed the deer but missed the hare.
Mr. Deer killed the hare but missed the tiger.
Mr. Hare killed the tiger but missed the boar.
Mr. Boar killed the lion but missed the deer.
Mr. Tiger killed the boar but missed the lion.


  Posted by Charlie on 2014-02-13 01:30:14
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 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information