My old Turtle Graphics Fractals
#3
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
If eggs are brain food, Biden takes his scrambled.
Reply


Messages In This Thread
My old Turtle Graphics Fractals - by triggered - 06-02-2022, 03:37 PM
RE: My old Turtle Graphics Fractals - by bplus - 06-02-2022, 05:46 PM
RE: My old Turtle Graphics Fractals - by Pete - 06-02-2022, 06:14 PM
RE: My old Turtle Graphics Fractals - by bplus - 06-02-2022, 06:44 PM
RE: My old Turtle Graphics Fractals - by Pete - 06-02-2022, 06:50 PM
RE: My old Turtle Graphics Fractals - by bplus - 06-03-2022, 03:49 AM
RE: My old Turtle Graphics Fractals - by bplus - 06-03-2022, 03:45 PM
RE: My old Turtle Graphics Fractals - by vince - 06-03-2022, 05:59 PM
RE: My old Turtle Graphics Fractals - by vince - 06-03-2022, 06:31 PM
RE: My old Turtle Graphics Fractals - by bplus - 06-03-2022, 07:07 PM



Users browsing this thread: 1 Guest(s)