A Single Line
Marc Weyl, a long-time Logo enthusiast, sent us the code listed below. It shows the power of Logo and is a wonderful illustration of how you can create complex drawings with just a few instructions.
His program combines music, art, and math with Logo code.
He calls it, “A single line. Each image is but a single line, bent but unbroken.”
The beautiful lines are accompanied by random musical notes, sometimes individual pitches, at other times chords.
Can you figure out how it works? It’s elegant and simple at the same time.
See a video of his ‘A Single Line’ Logo program in action.
Marc’s fascination with evolving geometric shapes can also be seen in another of his Logo programs.
TO SINGLE_LINE
HIDETURTLE
WINDOW
CLEARSCREEN
SETBG "BLACK
SETPC "WHITE
PENDOWN
TT [A SINGLE LINE]
WAIT 3000
CLEARSCREEN
SETBG "BLACK
SETPC "WHITE
PENDOWN
TT [EACH IMAGE IS BUT A SINGLE LINE]
WAIT 3000
CLEARSCREEN
SETBG "BLACK
SETPC "WHITE
PENDOWN
TT [BENT BUT UNBROKEN...]
WAIT 3000
FOR [TWIST 0 720 1] [
CLEARSCREEN
SETBG "BLACK
RT :TWIST
PD
FOR [WALK 0 3200 1] [FD :WALK RIGHT :TWIST]
PU
MAKE "S RANDOM 42
IF (:S = 1) [PLAY [I107 T120 O4 C]]
IF (:S = 2) [PLAY [I107 T120 O4 D]]
IF (:S = 3) [PLAY [I107 T120 O4 F]]
IF (:S = 4) [PLAY [I107 T120 O4 G]]
IF (:S = 5) [PLAY [I107 T120 O4 A]]
IF (:S = 6) [PLAY [I107 T120 O5 C]]
IF (:S = 7) [PLAY [I107 T120 O5 F]]
IF (:S = 8) [PLAY [I107 T120 O5 G]]
IF (:S = 9) [PLAY [I107 T120 O3 C ]]
IF (:S = 10) [PLAY [I107 T90 O3 F]]
IF (:S = 11) [PLAY [I107 T90 O3 G]]
IF (:S = 12) [PLAY [I107 T90 O3 C]]
IF (:S = 13) [PLAY [I107 T60 O3 C]]
IF (:S = 14) [PLAY [I107 T120 O5 F]]
IF (:S = 15) [PLAY [I107 T120 O5 G]]
IF (:S = 16) [PLAY [I107 T120 O4 C ]]
IF (:S = 17) [PLAY [I107 T120 O3 C ]]
IF (:S = 18) [PLAY [I107 T60 O3 C ]]
IF (:S = 19) [PLAY [I107 T120 O4 [C F]]]
IF (:S = 20) [PLAY [I107 T120 O4 [D F]]]
IF (:S = 21) [PLAY [I107 T120 O4 [C G]]]
IF (:S = 22) [PLAY [I107 T120 O4 [D G]]]
IF (:S = 23) [PLAY [I107 T120 O4 [C F]]]
IF (:S = 24) [PLAY [I107 T120 O4 [D F]]]
IF (:S = 25) [PLAY [I107 T120 O4 [C G]]]
IF (:S = 26) [PLAY [I107 T120 O4 [D G]]]
IF (:S = 27) [PLAY [I107 T120 O4 [D F]]]
IF (:S = 28) [PLAY [I107 T120 O4 [C G]]]
IF (:S = 29) [PLAY [I107 T120 O4 [D G]]]
IF (:S = 30) [PLAY [I107 T120 O4 [A C]]]
IF (:S = 31) [PLAY [I107 T240 O5 C D F G]]
IF (:S = 32) [PLAY [I107 T240 O5 G F D C]]
IF (:S = 33) [PLAY [I107 T60 O3 F]]
IF (:S = 34) [PLAY [I107 T60 O3 G]]
IF (:S = 35) [PLAY [I107 T60 O3 C]]
IF (:S = 36) [PLAY [I107 T60 O3 C]]
IF (:S > 36) [WAIT 100]
]
CLEARSCREEN
SETBG "BLACK
SETPC "WHITE
PENDOWN
TT [FIN]
WAIT 3000
CLEARSCREEN
SETBG "BLACK
SETPC "WHITE
PENDOWN
TT [A SINGLE LINE]
PU BK 200 PD
TT [BY MARC WEYL]
END
Description | Each a single line with musical accompaniment: simple, yet complex |
Procedure | SINGLE_LINE |
Level | Advanced |
Tags | Math, Drawing, Complex Images, Music |