 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Uncle Christmas (Posted on 2013-08-27) 1. Uncle Raymond will not get the scarf unless Uncle John gets the hat.
2. Uncle George will not get the gloves unless Uncle Victor gets the scarf.
3. Uncle Victor will not get the tie unless Uncle George gets the scarf.
4. Uncle John will not get the gloves unless Uncle Raymond gets the hat.
5. Uncle John will not get the hat unless Uncle Victor gets the gloves.
6. Uncle George will not get the hat unless Uncle Raymond gets the tie.
7. Uncle George will not get the tie unless Uncle Raymond gets the hat.
8. Uncle Raymond will not get the hat unless Uncle George gets the scarf.
9. Uncle Victor will not get the gloves unless Uncle Raymond gets the hat.
10. Uncle John will not get the tie unless Uncle Raymond gets the gloves.
11. Uncle George will not get the scarf unless Uncle Raymond gets the gloves.
Which uncle will get the scarf for Christmas?

 See The Solution Submitted by K Sengupta No Rating Comments: ( Back to comment list | You must be logged in to post comments.) computer solution | Comment 1 of 3

DECLARE SUB permute (a\$)
name\$ = "RGVJ"

g\$ = gift\$: h\$ = g\$
DO
s\$ = "R" + MID\$(g\$, 1, 1) + "G" + MID\$(g\$, 2, 1) + "V" + MID\$(g\$, 3, 1) + "J" + MID\$(g\$, 4, 1)
good = 1
IF INSTR(s\$, "Rs") > 0 AND INSTR(s\$, "Jh") = 0 THEN good = 0
IF INSTR(s\$, "Gg") > 0 AND INSTR(s\$, "Vs") = 0 THEN good = 0
IF INSTR(s\$, "Vt") > 0 AND INSTR(s\$, "Gs") = 0 THEN good = 0
IF INSTR(s\$, "Jg") > 0 AND INSTR(s\$, "Rh") = 0 THEN good = 0
IF INSTR(s\$, "Jh") > 0 AND INSTR(s\$, "Vg") = 0 THEN good = 0
IF INSTR(s\$, "Gh") > 0 AND INSTR(s\$, "Rt") = 0 THEN good = 0
IF INSTR(s\$, "Gt") > 0 AND INSTR(s\$, "Rh") = 0 THEN good = 0
IF INSTR(s\$, "Rh") > 0 AND INSTR(s\$, "Gs") = 0 THEN good = 0
IF INSTR(s\$, "Vg") > 0 AND INSTR(s\$, "Rh") = 0 THEN good = 0
IF INSTR(s\$, "Jt") > 0 AND INSTR(s\$, "Rg") = 0 THEN good = 0
IF INSTR(s\$, "Gs") > 0 AND INSTR(s\$, "Rg") = 0 THEN good = 0
IF good THEN PRINT s\$
permute g\$
LOOP UNTIL g\$ = h\$

finds

RgGsVhJt

with the initial of the uncle, in upper case, followed by the initial of the gift he received:

Raymond gloves
George scarf
Victor hat
John tie

 Posted by Charlie on 2013-08-27 13:17:51 Please log in:

 Search: Search body:
Forums (2)