Created
February 15, 2024 16:03
-
-
Save ValleyDragon888/6c9f95ef18b10d6bdf5f03ffbb23e864 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
turtle.speed(0) | |
# You can edit some of these variables to change the snowflake. | |
BRANCHES = 6 | |
MINI_BRANCHES = 4 | |
# This function creates each of the segments of a branch | |
def minbranch(): | |
#main branch | |
turtle.forward(30) | |
#left branch | |
turtle.left(45) | |
turtle.forward(30) | |
turtle.left(180) | |
turtle.forward(30) | |
turtle.left(180-45) | |
#right branch | |
turtle.right(45) | |
turtle.forward(30) | |
turtle.right(180) | |
turtle.forward(30) | |
turtle.right(180-45) | |
# This function runs minbranch() a couple of times | |
# and then puts the turtle back to the start. | |
def branch(): | |
for i in range(MINI_BRANCHES): | |
minbranch() | |
turtle.left(180) | |
turtle.forward(30*MINI_BRANCHES) | |
turtle.left(180) | |
for i in range(BRANCHES): | |
branch() | |
turtle.left(360/BRANCHES) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment