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

Home > Shapes
Curious Continuous Connection (Posted on 2005-03-10) Difficulty: 3 of 5
Draw a line that starts at 0 and visits numbers 0 to 9 in order. The line can only be horizontal or vertical, cannot cross itself, and can only change direction at dots. All dots must be visited.
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . 2 .
. . . 9 . . 0 . . .
. . . . . . . . . .
. . . . 5 . 7 . . .
. . 6 . . 8 . . . .
. 1 . . . . . . . .
. 3 . . . . . . . 4
. . . . . . . . . .

See The Solution Submitted by Old Original Oskar!    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
re(2): ...but can I draw it? | Comment 3 of 4 |
(In reply to re: ...but can I draw it? by Charlie)

That's the best transcription I can make from Jer's directions.

However, most numbered positions have a direction change. Does a number count as a dot, where a direction change is allowed? (Only 4, other than the obvious 0 and 9, does not have a direction change).

DATA DRRDDDDLLLLLULL(1)
DATA UUUUUURRRRRRRD(2)
DATA RUULLLLLLLLLDDDDDDDDDRU(3)
DATA RDRRRRRRRU(4)
DATA UUUUULLULLLLLDDRRD(5)
DATA LLD(6)
DATA RRDRRRUUL(7)
DATA DL(8)
DATA UUULL(9)

FOR i = 1 TO 9: READ dir$(i): NEXT

row = 4: col = 7: board$(row, col) = "0"

FOR piece = 1 TO 9
 FOR p = 1 TO LEN(dir$(piece)) - 3
 d$ = MID$(dir$(piece), p, 1)
 SELECT CASE d$
   CASE "D"
    row = row + 1
    SELECT CASE MID$(dir$(piece), p + 1, 1)
     CASE "D"
      cd$ = "02"
     CASE "R"
      cd$ = "14"
     CASE "L"
      cd$ = "18"
     CASE "("
      cd$ = "--"
    END SELECT
   CASE "U"
    row = row - 1
    SELECT CASE MID$(dir$(piece), p + 1, 1)
     CASE "U"
      cd$ = "02"
     CASE "R"
      cd$ = "0C"
     CASE "L"
      cd$ = "10"
     CASE "("
      cd$ = "--"
    END SELECT
   CASE "R"
    col = col + 1
    SELECT CASE MID$(dir$(piece), p + 1, 1)
     CASE "D"
      cd$ = "10"
     CASE "R"
      cd$ = "00"
     CASE "U"
      cd$ = "18"
     CASE "("
      cd$ = "--"
    END SELECT
   CASE "L"
    col = col - 1
    SELECT CASE MID$(dir$(piece), p + 1, 1)
     CASE "D"
      cd$ = "0C"
     CASE "U"
      cd$ = "14"
     CASE "L"
      cd$ = "00"
     CASE "("
      cd$ = "--"
    END SELECT
 END SELECT
 IF cd$ = "--" THEN
  board$(row, col) = MID$(dir$(piece), p + 2, 1)
 ELSE
  board$(row, col) = "&#x25" + cd$ + ";"
 END IF
 NEXT
NEXT
OPEN "ccc.HTM" FOR OUTPUT AS #2
 FOR row = 1 TO 10
  FOR col = 1 TO 10
   PRINT #2, board$(row, col); " ";
  NEXT
  PRINT #2, "<br>"
 NEXT
 
CLOSE

 

 


  Posted by Charlie on 2005-03-10 20:07:26
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 (6)
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