06-02-2022, 06:14 PM
Hey look, another triggered snowflake!
Code: (Select All)
SCREEN 12
DIM a$
a$ = "FRRFRRF"
DIM j
FOR j = 1 TO 4
a$ = stReplace$(a$, "F", "RFSFRFSF")
NEXT j
TurtleGraphics 460 / 2, 120 / 2, 0, 5, a$
TurtleGraphics 840 / 2, 120 / 2, 0, 5, a$
TurtleGraphics 650 / 2, 340 / 2, 0, 5, a$
TurtleGraphics 550 / 2, 540 / 2, 0, 5, a$
TurtleGraphics 750 / 2, 540 / 2, 0, 5, a$
TurtleGraphics 480 / 2, 690 / 2, 0, 5, a$
TurtleGraphics 820 / 2, 690 / 2, 0, 5, a$
TurtleGraphics 550 / 2, 840 / 2, 0, 5, a$
TurtleGraphics 750 / 2, 840 / 2, 0, 5, a$
SLEEP
SYSTEM
SUB TurtleGraphics (x0 AS DOUBLE, y0 AS DOUBLE, a0 AS DOUBLE, ssize AS DOUBLE, path AS STRING)
DIM AS DOUBLE x, y, angle, stepsize
DIM w AS STRING
DIM t AS STRING
x = x0
y = y0
angle = a0
w = path
stepsize = ssize
PRESET (x0, y0)
DO WHILE LEN(w)
t = LEFT$(w, 1)
w = RIGHT$(w, LEN(w) - 1)
SELECT CASE t
CASE "F"
x = x + stepsize * COS(angle)
y = y + stepsize * SIN(angle)
CASE "L"
angle = angle - 60 * _PI / 180
CASE "R"
angle = angle + 60 * _PI / 180
END SELECT
LINE -(x, y), 15
LOOP
END SUB
FUNCTION stReplace$ (a AS STRING, b AS STRING, c AS STRING)
DIM i AS INTEGER
DIM g AS STRING
DIM r AS STRING
FOR i = 1 TO LEN(a)
g = MID$(a, i, 1)
IF g = b THEN
r = r + c
ELSE
r = r + g
END IF
NEXT
stReplace = r
END FUNCTION
Shoot first and shoot people who ask questions, later.