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

Home > Logic
Recondite Route (Posted on 2013-03-11) Difficulty: 3 of 5
+----+---------+----+---------+        
| 1  |         |    |    5    |  
+----+         | 4  +---------+
| 2  |    3    |    |    6    |    
+----+         +----+---------+       
|    |         |   east       |
|    +---------+    +---------+
|  west        |    |         |
+----+----+----+----|   10    |
|    |    |  south  |         |   
|    |    +----+    +----+----+      
| 7  |  8 |    |    |    |    |    
|    |    | 9  |    | 11 | 12 |
|    |    |    |    |    |    |   
+----+----+----+----+----+----+
The plan above shows an arrangement of corn, wheat and rye fields. Jack is in the middle of one of the fields and has to meet his father in the middle of another field.

On his journey from the field he is in to the field his father is in.
  1. His route takes him continuously through each of five other fields exactly once.
  2. He (being allergic to rye) avoids going through any part of a rye field.
  3. He notices no two fields of the same kind border on each other.
Which L-shaped field - east, west, or south- is a rye field?

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

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

Preliminary setup: the fields have types matching field 1, 2 or 3, forced by proximity to two other types (crop) of field:

West: type 1
East: type 2
4: type 1
6: type 3
5: type 2
South: type 3
10: type 1 (designated field a below)
11: type 2 (designated field b below)
12: type 3 (designated field c below)
8: type 2
9: type 1
7: type 3

The program uses 1-character names for each field: 1 - 9 for fields 1 - 9; a - c for 10 - 12; and w,s and e for west, south and east. They are typed according to their crop content's being the same as field 1, 2 or 3.

DECLARE SUB addOn ()
DECLARE FUNCTION subscr! (nam$)
CLEAR , , 25000
DIM SHARED seq$, conn$(15), typ(15), path$, avoid
seq$ = "123456789abcwse"

DATA 23,13w,12we4,3e65,46,54e,w8,7ws9,8s,esbc,as,ab,23es87,98weab,643wsa
FOR i = 1 TO 15: READ conn$(i): NEXT

DATA 1,2,3,1,2,3,3,2,1,1,2,3,1,3,2
FOR i = 1 TO 15: READ typ(i): NEXT

CLS

FOR startpos = 1 TO 15
 FOR avoid = 1 TO 3
  path$ = MID$(seq$, startpos, 1)
  IF typ(subscr(path$)) <> avoid THEN
    addOn
  END IF
 NEXT
NEXT

SUB addOn
  s = subscr(RIGHT$(path$, 1))
  choice$ = conn$(s)
  FOR i = 1 TO LEN(choice$)
    newfield$ = MID$(choice$, i, 1)
    s2 = subscr(newfield$)
    IF typ(s2) <> avoid THEN
      IF INSTR(path$, newfield$) = 0 THEN
        path$ = path$ + newfield$
        IF LEN(path$) = 7 THEN
          PRINT path$, avoid
        ELSE
          addOn
        END IF
        path$ = LEFT$(path$, LEN(path$) - 1)
      END IF
    END IF
  NEXT
END SUB

FUNCTION subscr (nam$)
  subscr = INSTR(seq$, nam$)
END FUNCTION

finds

643wsac        2
casw346        2

indicating the sequence of fields from start to finish, and that the type field being avoided is the same as the content of field 2. As the East field has that content, that is the field that has rye.


  Posted by Charlie on 2013-03-11 12:00:53
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