Dr. Daves Diversions | C64 Turtle Graphics: Rotational Symmetries from Repeating Decimals #shorts @DrDavesDiversions | Uploaded February 2022 | Updated October 2024, 18 minutes ago.
Fun with Turtle Graphics on the Commodore 64 c. 1984!
This is a visualization is of the value 1/7 (one-seventh), a rational number with a repeating decimal that forms a nice rotationally symmetric figure when its base 10 digits are used to determine the fraction of 360 degrees rotated before drawing the next line segment.
Here is what I wrote today using HESware's Turtle Graphics II (c) 1983. Because this language does not have arrays, I could not simply drop the digits of 1/7 (0.14285714285714...) into an array like they do using python in the Numberphile videos (linked below). Instead, I decided to calculate each digit on each loop iteration (DRAW). Note that C64's INT() function is actually floor() and that this language, like C64 BASIC, does not have a modulo operator, which is why the calculations are more verbose. This is in the 64's 320x200 mode ("HIRES"!). Currently the fraction (1/7) is hard-coded, as well as the length of the repeating run (7) and the number of iterations (100).
1 HIRES
2 SET HEADING TO 0
3 MOVE TO 80-130
4 PEN DOWN
5 CALCULATE X=0
6 LABEL DRAW
7 FORWARD 50
8 CALCULATE Y=X-(INT(X/7)*7)
9 CALCULATE A=INT((1/7)*(10^Y))
10 CALCULATE D=36*(A-INT(A/10)*10)
11 TEST IF (D=0)
12 IF TRUE JUMP POSTROT
13 ROTATE LEFT D
14 LABEL POSTROT
15 CALCULATE X=X+1
16 TEST IF (X=100)
17 IF FALSE JUMP DRAW
18 STOP
Related:
"Plotting Pi and Searching for Mona Lisa - Numberphile"
youtube.com/watch?v=tkC1HHuuk7c
The specific figure I plot is shown beginning at 7m20s:
youtube.com/watch?v=tkC1HHuuk7c&t=7m20s
"The Plotting of Beautiful Curves (Euler Spirals and Sierpiński Triangles) - Numberphile"
youtube.com/watch?v=kMBj2fp52tA
"The Turtles are Coming!" by David Malmberg, pp. 26-28, Commodore Power-Play, 1982, Issue 2, V1, N02, Fall (issuu.com)
issuu.com/astarothduke/docs/commodore_power-play_1982_issue_02_v1_n02_fall
"David Malmberg Interview" (brasslantern.org)
brasslantern.org/community/interviews/malmberg-b.html
q(D.M.: Sort of. I wrote and published a product for the Commodore-64 and VIC-20 titled "TurtleGraphics," which sold approximately 80,000 copies and was translated into French and Spanish. It was actually published by a company called HESware, which I helped found. Turtle Graphics was a LOGO-like language/product designed to teach programming skills to "kids from six to sixty.")
"ANTIC Interview 285 - Jay Balakrishnan, HESWare" (audio)
ataripodcast.libsyn.com/antic-interview-285-jay-balakrishnan-hesware
Fun with Turtle Graphics on the Commodore 64 c. 1984!
This is a visualization is of the value 1/7 (one-seventh), a rational number with a repeating decimal that forms a nice rotationally symmetric figure when its base 10 digits are used to determine the fraction of 360 degrees rotated before drawing the next line segment.
Here is what I wrote today using HESware's Turtle Graphics II (c) 1983. Because this language does not have arrays, I could not simply drop the digits of 1/7 (0.14285714285714...) into an array like they do using python in the Numberphile videos (linked below). Instead, I decided to calculate each digit on each loop iteration (DRAW). Note that C64's INT() function is actually floor() and that this language, like C64 BASIC, does not have a modulo operator, which is why the calculations are more verbose. This is in the 64's 320x200 mode ("HIRES"!). Currently the fraction (1/7) is hard-coded, as well as the length of the repeating run (7) and the number of iterations (100).
1 HIRES
2 SET HEADING TO 0
3 MOVE TO 80-130
4 PEN DOWN
5 CALCULATE X=0
6 LABEL DRAW
7 FORWARD 50
8 CALCULATE Y=X-(INT(X/7)*7)
9 CALCULATE A=INT((1/7)*(10^Y))
10 CALCULATE D=36*(A-INT(A/10)*10)
11 TEST IF (D=0)
12 IF TRUE JUMP POSTROT
13 ROTATE LEFT D
14 LABEL POSTROT
15 CALCULATE X=X+1
16 TEST IF (X=100)
17 IF FALSE JUMP DRAW
18 STOP
Related:
"Plotting Pi and Searching for Mona Lisa - Numberphile"
youtube.com/watch?v=tkC1HHuuk7c
The specific figure I plot is shown beginning at 7m20s:
youtube.com/watch?v=tkC1HHuuk7c&t=7m20s
"The Plotting of Beautiful Curves (Euler Spirals and Sierpiński Triangles) - Numberphile"
youtube.com/watch?v=kMBj2fp52tA
"The Turtles are Coming!" by David Malmberg, pp. 26-28, Commodore Power-Play, 1982, Issue 2, V1, N02, Fall (issuu.com)
issuu.com/astarothduke/docs/commodore_power-play_1982_issue_02_v1_n02_fall
"David Malmberg Interview" (brasslantern.org)
brasslantern.org/community/interviews/malmberg-b.html
q(D.M.: Sort of. I wrote and published a product for the Commodore-64 and VIC-20 titled "TurtleGraphics," which sold approximately 80,000 copies and was translated into French and Spanish. It was actually published by a company called HESware, which I helped found. Turtle Graphics was a LOGO-like language/product designed to teach programming skills to "kids from six to sixty.")
"ANTIC Interview 285 - Jay Balakrishnan, HESWare" (audio)
ataripodcast.libsyn.com/antic-interview-285-jay-balakrishnan-hesware