├── .github └── workflows │ └── python-publish.yml ├── .gitignore ├── AutomatonRule30.py ├── FlowerOfLife.py ├── LorenzAttractor01.py ├── LorenzAttractor02.py ├── README.md ├── Ribow.py ├── SeedOfLife.py ├── Spirograph01.py ├── Tourus.py ├── arcesoftware.py ├── mandelbrot.py ├── module4.py ├── module5.py ├── optimized_fibonacci_spirograph.py ├── random_complex.py ├── spirograph.py ├── watch.py └── xcvcv.JPG /.github/workflows/python-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will upload a Python Package to PyPI when a release is created 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries 3 | 4 | # This workflow uses actions that are not certified by GitHub. 5 | # They are provided by a third-party and are governed by 6 | # separate terms of service, privacy policy, and support 7 | # documentation. 8 | 9 | name: Upload Python Package 10 | 11 | on: 12 | release: 13 | types: [published] 14 | 15 | permissions: 16 | contents: read 17 | 18 | jobs: 19 | release-build: 20 | runs-on: ubuntu-latest 21 | 22 | steps: 23 | - uses: actions/checkout@v4 24 | 25 | - uses: actions/setup-python@v5 26 | with: 27 | python-version: "3.x" 28 | 29 | - name: Build release distributions 30 | run: | 31 | # NOTE: put your own distribution build steps here. 32 | python -m pip install build 33 | python -m build 34 | 35 | - name: Upload distributions 36 | uses: actions/upload-artifact@v4 37 | with: 38 | name: release-dists 39 | path: dist/ 40 | 41 | pypi-publish: 42 | runs-on: ubuntu-latest 43 | needs: 44 | - release-build 45 | permissions: 46 | # IMPORTANT: this permission is mandatory for trusted publishing 47 | id-token: write 48 | 49 | # Dedicated environments with protections for publishing are strongly recommended. 50 | # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules 51 | environment: 52 | name: pypi 53 | # OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status: 54 | # url: https://pypi.org/p/YOURPROJECT 55 | # 56 | # ALTERNATIVE: if your GitHub Release name is the PyPI project version string 57 | # ALTERNATIVE: exactly, uncomment the following line instead: 58 | # url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }} 59 | 60 | steps: 61 | - name: Retrieve release distributions 62 | uses: actions/download-artifact@v4 63 | with: 64 | name: release-dists 65 | path: dist/ 66 | 67 | - name: Publish release distributions to PyPI 68 | uses: pypa/gh-action-pypi-publish@release/v1 69 | with: 70 | packages-dir: dist/ 71 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | *.vsix 3 | *.vscode/ 4 | *.log 5 | *.user 6 | -------------------------------------------------------------------------------- /AutomatonRule30.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Sun Jan 15 15:18:06 2023 4 | 5 | @author: Arce 6 | """ 7 | import turtle 8 | 9 | # Initial state of the pattern, represented as a 32-bit binary number 10 | state = 1 << 31 11 | 12 | # Set up turtle graphics window with width and height of 800 pixels 13 | turtle.screensize(canvwidth=7680, canvheight=4800, bg='black') 14 | # Set turtle speed to be the fastest possible 15 | turtle.speed('fastest') 16 | turtle.color('red') 17 | # Pick the pen up and move turtle to starting position 18 | turtle.penup() 19 | turtle.setpos(0, 0) 20 | 21 | # Create an empty 2D array to store the pattern 22 | data = [] 23 | 24 | # Iterate over 32 rows 25 | for i in range(32): 26 | # Create an empty list for the current row 27 | row = [] 28 | # Iterate over 64 columns 29 | for j in range(64): 30 | # Append 1 to the current row if the corresponding bit in state is 1, else append 0 31 | row.append(1 if state >> j & 1 else 0) 32 | # Append the current row to the data array 33 | data.append(row) 34 | # Update the state using bitwise operations 35 | state = (state >> 1) ^ (state | state << 1) 36 | 37 | for i in range(36): 38 | for j in range(64): 39 | if data[i][j] == 1: 40 | turtle.dot() 41 | turtle.forward(10) 42 | turtle.setpos(0, turtle.ycor() - 10) 43 | 44 | # Wait for a mouse click before exiting turtle graphics window 45 | turtle.exitonclick() 46 | -------------------------------------------------------------------------------- /FlowerOfLife.py: -------------------------------------------------------------------------------- 1 | """ 2 | Created on Fri Jan 13 10:55:16 2023 3 | 4 | @author: Arce 5 | """ 6 | import turtle 7 | import math 8 | turtle.screensize(canvwidth=7680, canvheight=4800, bg='black') 9 | 10 | def seed_of_life(radius): 11 | skk = turtle.Turtle() 12 | skk.color("red") 13 | skk.speed(3) 14 | skk.penup() 15 | skk.goto(0,0) 16 | skk.pendown() 17 | 18 | for i in range(6): 19 | angle = i * 60 20 | x = radius * math.cos(math.radians(angle)) 21 | y = radius * math.sin(math.radians(angle)) 22 | skk.penup() 23 | skk.goto(x, y) 24 | skk.pendown() 25 | skk.circle(radius) 26 | turtle.done() 27 | 28 | radius = int(input("Enter the radius of the circles: ")) 29 | seed_of_life(radius) 30 | -------------------------------------------------------------------------------- /LorenzAttractor01.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Dec 27 02:24:01 2022 4 | 5 | @author: Juan Arce 6 | """ 7 | import turtle 8 | import numpy as np 9 | from math import atan2 10 | 11 | # Set the values of ρ, σ, and β 12 | rho = 28 13 | sigma = 10 14 | beta = 8/3 15 | scale = 10 16 | dt = 0.01 # time step 17 | 18 | # Set the initial conditions 19 | x, y, z = 1.0, 1.0, 1.0 20 | dx, dy = 0.0, 0.0 # initialize the x velocity 21 | # Create a turtle and set the pen size 22 | t = turtle.Turtle() 23 | t.speed('fastest') 24 | t.pensize(1) 25 | t.pencolor('red') 26 | t.radians() 27 | t.pendown() 28 | 29 | while True: 30 | t.setpos(x*scale, y*scale) 31 | t.setheading(atan2(dy, dx)) 32 | 33 | # Solve the differential equations 34 | dx = (sigma * (y - x)) * dt 35 | dy = (x * (rho - z) - y) * dt 36 | dz = (x * y - beta * z) * dt 37 | 38 | x += dx 39 | y += dy 40 | z += dz 41 | 42 | # Keep the window open until it is closed 43 | turtle.mainloop() 44 | -------------------------------------------------------------------------------- /LorenzAttractor02.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import numpy as np 3 | from math import atan2 4 | from scipy.integrate import odeint 5 | turtle.screensize(canvwidth=7680, canvheight=4800, bg='black') 6 | # Set the values of ρ, σ, and β 7 | rho = 43.5 8 | sigma = 10.0 9 | beta = 8.0 / 3.0 10 | d0 = 19.0 / 3.0 11 | scale = 10 12 | 13 | def f(state, t): 14 | x, y, z, y1, z1 = state # Unpack the state vector 15 | return sigma * (y - x), x * (rho - z) - y, x * y - x * y1 - beta * z, x * z - 2 * x * z1 - d0 * y1, 2 * x * y1 - 4 * beta * z1 # Derivatives 16 | 17 | state0 = [1.0, 1.0, 1.0, 1.0, 1.0] 18 | t = np.arange(0.0, 40.0, 0.01) 19 | 20 | states = odeint(f, state0, t) 21 | 22 | # Create a turtle and set the pen size 23 | t = turtle.Turtle() 24 | t.speed('fastest') 25 | t.pensize(1) 26 | t.pencolor('red') 27 | t.radians() 28 | t.pendown() 29 | 30 | i = 0 31 | while i < len(states): 32 | x, y, z, y1, z1 = states[i] 33 | t.setpos(x*scale, z*scale) 34 | t.setheading(atan2(z1, y1)) 35 | 36 | # Set the pen color to a random color 37 | t.pencolor(np.random.rand(3)) 38 | 39 | i += 1 40 | 41 | # Keep the window open until it is closed 42 | turtle.mainloop() 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | - 👋 Hi, I’m @spirographfibonacci 2 | - 👀 I’m interested in AI and Quantum computing 3 | - 🌱 I’m currently learning AWS SageMaker 4 | - 💞️ I’m looking to collaborate on data science 5 | - 📫 How to reach me ...here... 6 | 7 | 11 | -------------------------------------------------------------------------------- /Ribow.py: -------------------------------------------------------------------------------- 1 | 2 | import turtle 3 | from turtle import * 4 | from random import randint 5 | import math 6 | 7 | #number of sides 8 | n = 6 9 | #lenght of the sizes 10 | l = 9 11 | s = math.sqrt(2) 12 | 13 | turtle.screensize(canvwidth=10000, canvheight=10000,bg="white") 14 | wn = turtle.Screen() 15 | wn.bgcolor("black") 16 | wn.title("Armadillo") 17 | skk = turtle.Turtle() 18 | skk.speed(0) 19 | colormode(255) 20 | skk.width(0) 21 | skk.goto(-150, -150) 22 | 23 | memo = {} 24 | def fibonacci(n): 25 | if n in memo : 26 | return memo[n] 27 | if n <= 2: 28 | f = 1 29 | else: f = fibonacci(n-3) + fibonacci(n-5)+ fibonacci(n-9) + fibonacci(n-7) 30 | memo[n] = f 31 | return f 32 | 33 | def star1(fibonacci): 34 | for i in range(n): 35 | skk.color(randint(0, 255),randint(0, 255),randint(0, 255)) 36 | skk.forward(fibonacci(n*s)) 37 | skk.left(fibonacci(n)) 38 | 39 | def star2(fibonacci): 40 | for i in range(l): 41 | skk.color(randint(0, 255),randint(0, 255),randint(0, 255)) 42 | skk.forward(fibonacci(n*s)) 43 | skk.right(fibonacci(l)) 44 | 45 | while True: 46 | star1(fibonacci) , star2(fibonacci) -------------------------------------------------------------------------------- /SeedOfLife.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import math 3 | turtle.screensize(canvwidth=680, canvheight=800, bg='black') 4 | def seed_of_life(radius): 5 | skk = turtle.Turtle() 6 | skk.color("red") 7 | skk.speed(0) # Set maximum speed for faster drawing 8 | skk.hideturtle() # Hide the turtle pointer 9 | initial_rotation = 90 # Rotate the pattern by 90 degrees 10 | positions = [ 11 | ( 12 | radius * math.cos(math.radians(i * 60 + initial_rotation)), 13 | radius * math.sin(math.radians(i * 60 + initial_rotation)) 14 | ) 15 | for i in range(6) 16 | ] 17 | # Draw circles 18 | for x, y in positions: 19 | skk.penup() 20 | skk.goto(x, y) 21 | skk.pendown() 22 | skk.circle(radius) 23 | turtle.done() 24 | seed_of_life(180) 25 | 26 | -------------------------------------------------------------------------------- /Spirograph01.py: -------------------------------------------------------------------------------- 1 | 2 | import turtle 3 | from turtle import * 4 | # import random 5 | from random import randint 6 | import math 7 | 8 | #number of sides 9 | n = 17 10 | #lenght of the sizes 11 | l = 29 12 | s = math.sqrt(2) 13 | 14 | turtle.screensize(canvwidth=10000, canvheight=10000,bg="white") 15 | wn = turtle.Screen() 16 | wn.bgcolor("black") 17 | wn.title("Armadillo") 18 | skk = turtle.Turtle() 19 | skk.speed(0) 20 | colormode(255) 21 | skk.width(0) 22 | skk.goto(-150, -150) 23 | 24 | memo = {} 25 | def fibonacci(n): 26 | if n in memo : 27 | return memo[n] 28 | if n <= 2: 29 | f = 1 30 | else: f = fibonacci(n-3) + fibonacci(n-5)+ fibonacci(n-9) + fibonacci(n-7) 31 | 32 | memo[n] = f 33 | return f 34 | 35 | def star1(fibonacci): 36 | for i in range(n): 37 | skk.color(randint(0, 255),randint(0, 255),randint(0, 255)) 38 | skk.forward(fibonacci(n*s)) 39 | skk.left(fibonacci(n+45)) 40 | 41 | def star2(fibonacci): 42 | for i in range(3,9,2): 43 | skk.color(randint(0, 255),randint(0, 255),randint(0, 255)) 44 | skk.forward(fibonacci(n*s)) 45 | skk.right(fibonacci(n+45)) 46 | 47 | while True: 48 | star1(fibonacci) , star2(fibonacci) 49 | -------------------------------------------------------------------------------- /Tourus.py: -------------------------------------------------------------------------------- 1 | #Arce Software/(The Ouroborus Cataphractus)/March 2022 Costa Rica | Juan Arce 2 | import turtle 3 | #number of sides 4 | n = 13 5 | #lenght of the sizes 6 | l = 55 7 | wn = turtle.Screen() 8 | wn.bgcolor('black') 9 | wn.screensize(canvwidth=7680, canvheight=4800, bg='black') 10 | wn.title("Armadillo") 11 | skk = turtle.Turtle() 12 | skk.speed(0) 13 | 14 | def fibonacci(n): 15 | fibo = [] 16 | for i in range(n): 17 | if i == 0 or i == 1: 18 | fibo.append(i) 19 | else: 20 | f = fibo.append(fibo[i-1] + fibo[i-2]) 21 | fibo[n] = f 22 | return f 23 | 24 | def sprirograph(fibonacci): 25 | skk.goto(100 , -175) 26 | for i in range(n): 27 | for colors in [ 28 | #reddish colors 29 | (1.00, 0.00, 0.00),(1.00, 0.03, 0.00),(1.00, 0.05, 0.00),(1.00, 0.07, 0.00),(1.00, 0.10, 0.00),(1.00, 0.12, 0.00),(1.00, 0.15, 0.00),(1.00, 0.17, 0.00),(1.00, 0.20, 0.00),(1.00, 0.23, 0.00),(1.00, 0.25, 0.00),(1.00, 0.28, 0.00),(1.00, 0.30, 0.00),(1.00, 0.33, 0.00),(1.00, 0.35, 0.00),(1.00, 0.38, 0.00),(1.00, 0.40, 0.00),(1.00, 0.42, 0.00),(1.00, 0.45, 0.00),(1.00, 0.47, 0.00), 30 | #orangey colors 31 | (1.00, 0.50, 0.00),(1.00, 0.53, 0.00),(1.00, 0.55, 0.00),(1.00, 0.57, 0.00),(1.00, 0.60, 0.00),(1.00, 0.62, 0.00),(1.00, 0.65, 0.00),(1.00, 0.68, 0.00),(1.00, 0.70, 0.00),(1.00, 0.72, 0.00),(1.00, 0.75, 0.00),(1.00, 0.78, 0.00),(1.00, 0.80, 0.00),(1.00, 0.82, 0.00),(1.00, 0.85, 0.00),(1.00, 0.88, 0.00),(1.00, 0.90, 0.00),(1.00, 0.93, 0.00),(1.00, 0.95, 0.00),(1.00, 0.97, 0.00), 32 | #yellowy colors 33 | (1.00, 1.00, 0.00),(0.95, 1.00, 0.00),(0.90, 1.00, 0.00),(0.85, 1.00, 0.00),(0.80, 1.00, 0.00),(0.75, 1.00, 0.00),(0.70, 1.00, 0.00),(0.65, 1.00, 0.00),(0.60, 1.00, 0.00),(0.55, 1.00, 0.00),(0.50, 1.00, 0.00),(0.45, 1.00, 0.00),(0.40, 1.00, 0.00),(0.35, 1.00, 0.00),(0.30, 1.00, 0.00),(0.25, 1.00, 0.00),(0.20, 1.00, 0.00),(0.15, 1.00, 0.00),(0.10, 1.00, 0.00),(0.05, 1.00, 0.00), 34 | #greenish colors 35 | (0.00, 1.00, 0.00),(0.00, 0.95, 0.05),(0.00, 0.90, 0.10),(0.00, 0.85, 0.15),(0.00, 0.80, 0.20),(0.00, 0.75, 0.25),(0.00, 0.70, 0.30),(0.00, 0.65, 0.35),(0.00, 0.60, 0.40),(0.00, 0.55, 0.45),(0.00, 0.50, 0.50),(0.00, 0.45, 0.55),(0.00, 0.40, 0.60),(0.00, 0.35, 0.65),(0.00, 0.30, 0.70),(0.00, 0.25, 0.75),(0.00, 0.20, 0.80),(0.00, 0.15, 0.85),(0.00, 0.10, 0.90),(0.00, 0.05, 0.95), 36 | #blueish colors 37 | (0.00, 0.00, 1.00),(0.05, 0.00, 1.00),(0.10, 0.00, 1.00),(0.15, 0.00, 1.00),(0.20, 0.00, 1.00),(0.25, 0.00, 1.00),(0.30, 0.00, 1.00),(0.35, 0.00, 1.00),(0.40, 0.00, 1.00),(0.45, 0.00, 1.00),(0.50, 0.00, 1.00),(0.55, 0.00, 1.00),(0.60, 0.00, 1.00),(0.65, 0.00, 1.00),(0.70, 0.00, 1.00),(0.75, 0.00, 1.00),(0.80, 0.00, 1.00),(0.85, 0.00, 1.00),(0.90, 0.00, 1.00),(0.95, 0.00, 1.00) 38 | ]: 39 | skk.color(colors) 40 | for i in range (37): 41 | if i==n or i == l: 42 | skk.forward(n) 43 | skk.forward(l) 44 | skk.left(n) 45 | skk.left(l) 46 | while True: 47 | sprirograph(fibonacci) 48 | -------------------------------------------------------------------------------- /arcesoftware.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | from random import randint 3 | turtle.colormode(255) 4 | # Create Fibonacci Cache 5 | fibonacci_cache = {} 6 | 7 | def fibonacci(n): 8 | #If we have cached the valued, then return it 9 | if n in fibonacci_cache: 10 | return fibonacci_cache[n] 11 | 12 | # Compute the Nth term 13 | if n == 1: 14 | value = 1 15 | elif n == 2: 16 | value = 1 17 | elif n > 2: 18 | value = fibonacci(n-1) + fibonacci(n-2) 19 | 20 | # Cache the value and return it 21 | fibonacci_cache[n] = value 22 | return value 23 | 24 | wn = turtle.Screen() 25 | wn.bgcolor("black") 26 | wn.title("Arce") 27 | wn.setup(width=600, height=500) 28 | turtle.bgcolor("black") 29 | turtle.reset() 30 | turtle.hideturtle() 31 | turtle.width() 32 | turtle.speed(200) 33 | 34 | def fib(fibonacci): 35 | for i in range(fibonacci): 36 | turtle.color(randint(0, 255), randint(0, 255), randint(0, 255)) 37 | turtle.forward(i) 38 | turtle.right(90) 39 | 40 | 41 | 42 | while True: 43 | fib(fibonacci(50)) 44 | turtle.exitonclick() -------------------------------------------------------------------------------- /mandelbrot.py: -------------------------------------------------------------------------------- 1 | """ 2 | Created on Tue Dec 27 23:22:20 2022 3 | 4 | This code uses the turtle library to generate a graphical representation of the Mandelbrot set, which is a fractal that is defined by the behavior of a complex function known as the Mandelbrot function. The code starts by defining the maximum number of iterations and the escape time function, which is used to determine the number of iterations it takes for a given complex number, c, to escape the Mandelbrot set. 5 | 6 | The turtle's screen size is set to 7680x4800 pixels, with a black background color. Then, the turtle's pen color is set to white and the pen size to 1 pixel. The turtle's speed is set to the maximum to ensure that the program runs as quickly as possible. 7 | 8 | The code then iterates over the complex plane by using two nested for loops that range from -400 to 400. Within these loops, the code sets the value of c to be the current position on the complex plane divided by 200, and then passes this value to the escape time function. The returned value, i, is then used to determine whether or not the current point on the complex plane is a member of the Mandelbrot set. 9 | 10 | If the point is a member of the set, the turtle's dot method is called at the current position, which will draw a point on the screen. If the point is not a member of the set, no dot is drawn. Once all points in the complex plane have been evaluated, the turtle is hidden and the screen is left open so that the user can view the final image. 11 | 12 | The code uses the turtle library to generate an image of the Mandelbrot set, which is a fractal that is defined by the behavior of a complex function. The turtle's screen size and maximum number of iterations are set at the beginning of the code. The code then uses two nested for loops to iterate over the complex plane, and uses the escape time function to determine if each point on the complex plane is a member of the Mandelbrot set. Points that are members of the set are then plotted on the screen using the turtle's dot method. 13 | 14 | One of the most interesting aspects of this code is the use of the turtle library to generate an image of the Mandelbrot set. The turtle library is traditionally used for drawing simple shapes and figures, but this code demonstrates how it can be used to create more complex and dynamic images, such as the Mandelbrot set. 15 | 16 | Furthermore, the code uses the complex data type to represent the points on the complex plane, which allows for the use of complex arithmetic and operations. This is important as the Mandelbrot set is defined by the behavior of a complex function, and the use of the complex data type allows for a more accurate representation of the set. 17 | 18 | Overall, this code provides a great example of how the turtle library can be used in an unexpected way, and how the complex data type can be used to represent mathematical concepts in a more accurate way. It also highlights the power of iteration and nested loops in generating dynamic images and exploring mathematical concepts. 19 | 20 | @author: Arce 21 | """ 22 | import turtle 23 | # Set the screen's background color 24 | turtle.bgcolor("black") 25 | # Set the turtle's pen color to white 26 | turtle.pencolor("white") 27 | # Set the turtle's pen size to 1 pixel 28 | turtle.pensize(1) 29 | # Set the turtle's speed to the maximum 30 | turtle.speed(0) 31 | # Set the screen size and the maximum number of iterations 32 | turtle.screensize(canvwidth=7680, canvheight=4800, bg='black') 33 | max_iterations = 256 34 | 35 | # Define the escape time function 36 | def escape_time(c): 37 | z = 0 38 | for i in range(max_iterations): 39 | z = z*z + c 40 | if abs(z) > 2: 41 | return i 42 | return max_iterations 43 | 44 | # Iterate over the complex plane 45 | for x in range(-400, 400): 46 | for y in range(-400, 400): 47 | c = complex(x/200, y/200) 48 | i = escape_time(c) 49 | if i == max_iterations: 50 | turtle.goto(x, y) 51 | turtle.dot() 52 | 53 | # Hide the turtle and keep the screen open 54 | turtle.hideturtle() 55 | turtle.exitonclick() 56 | -------------------------------------------------------------------------------- /module4.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | from random import randint 3 | import math 4 | 5 | # Number of sides and length of the star 6 | n = 12 # Number of segments in the star pattern 7 | s = 10 # Size scaling factor for each Fibonacci step 8 | 9 | # Set up the screen 10 | turtle.screensize(canvwidth=10000, canvheight=10000, bg="black") 11 | wn = turtle.Screen() 12 | wn.bgcolor("black") 13 | wn.title("Symmetrical Fibonacci Design") 14 | 15 | # Set up the turtle 16 | skk = turtle.Turtle() 17 | skk.speed(0) # Fastest drawing speed 18 | turtle.colormode(255) # Enable RGB color mode 19 | skk.width(2) # Set the pen width 20 | skk.goto(0, 0) 21 | 22 | # Memoization for Fibonacci 23 | memo = {} 24 | 25 | def fibonacci(n): 26 | """Generate Fibonacci sequence with custom rules.""" 27 | if n in memo: 28 | return memo[n] 29 | if n <= 2: 30 | f = 1 31 | else: 32 | f = fibonacci(n-2) + fibonacci(n-3) # Adjust Fibonacci relation 33 | memo[n] = f 34 | return f 35 | 36 | # Function to draw one "petal" of the pattern 37 | def draw_petal(fib_num): 38 | """Draw one petal of the symmetrical flower pattern.""" 39 | skk.color(randint(50, 255), randint(50, 255), randint(50, 255)) # Random but somewhat harmonious colors 40 | for i in range(n): 41 | skk.forward(fib_num * s) # Length based on Fibonacci number 42 | skk.left(360 / n) # Equal angle turns to maintain symmetry 43 | 44 | # Function to draw the full pattern 45 | def draw_pattern(): 46 | """Draw a beautiful and symmetrical pattern.""" 47 | for i in range(10, 30, 2): # Loop to create a pattern with increasing Fibonacci numbers 48 | fib_num = fibonacci(i) 49 | draw_petal(fib_num) # Draw one petal 50 | skk.right(360 / 5) # Rotate to make the pattern symmetrical 51 | skk.hideturtle() 52 | 53 | # Start the drawing 54 | draw_pattern() 55 | 56 | # Hide the turtle and finish drawing 57 | turtle.done() 58 | 59 | -------------------------------------------------------------------------------- /module5.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | from random import randint 3 | import math 4 | 5 | # Set up the screen 6 | turtle.screensize(canvwidth=10000, canvheight=10000, bg="white") 7 | wn = turtle.Screen() 8 | wn.bgcolor("black") 9 | wn.title("Armadillo") 10 | 11 | # Set up the turtle 12 | skk = turtle.Turtle() 13 | skk.speed(0) # Fastest drawing speed 14 | turtle.colormode(255) # Enable RGB color mode 15 | skk.width(1) # Set the pen width 16 | skk.goto(-150, -150) 17 | 18 | # Memoization for Fibonacci 19 | memo = {} 20 | 21 | def fibonacci(n): 22 | if n in memo: 23 | return memo[n] 24 | if n <= 2: 25 | f = 1 26 | else: 27 | f = fibonacci(n-3) + fibonacci(n-5) + fibonacci(n-9) + fibonacci(n-7) 28 | memo[n] = f 29 | return f 30 | 31 | # Number of sides and length of the star 32 | n = 37 33 | l = 59 34 | s = math.sqrt(2) 35 | 36 | # Function to draw the first star with more complex angles 37 | def star1(fib_num): 38 | for i in range(n): 39 | # Using Fibonacci number to modify the pen color 40 | skk.color(randint(0, 255), randint(0, 255), randint(0, 255)) 41 | # Draw forward with modified length 42 | skk.forward(fib_num * s) 43 | 44 | # More intricate turn with sin and cos to create complex angle 45 | angle = (fib_num + math.sin(i * math.pi / 4) * 50) # Apply sine to vary the angle 46 | skk.left(angle) 47 | 48 | # Function to draw the second star with a more complex rotation 49 | def star2(fib_num): 50 | for i in range(n): 51 | skk.color(randint(0, 255), randint(0, 255), randint(0, 255)) 52 | skk.forward(fib_num * s) 53 | 54 | # Adding more mathematical complexity to the angle with cosine and powers of Fibonacci 55 | angle = (fib_num + math.cos(i * math.pi / 5) * 30) # Apply cosine to vary the angle 56 | skk.right(angle) 57 | 58 | # Function to draw a complex pattern with enhanced rotation logic 59 | def draw_pattern(): 60 | for i in range(10, n, 5): # Loop to create multiple patterns with different Fibonacci numbers 61 | fib_num = fibonacci(i) 62 | 63 | # Draw the first star with more complex rotation 64 | star1(fib_num) 65 | 66 | # Add a slight rotation to give variety to the pattern 67 | skk.right(fib_num * 2) # Rotate by Fibonacci number 68 | 69 | # Draw the second star with more complex rotation 70 | star2(fib_num) 71 | 72 | # Adjust angle between patterns for a more complex structure 73 | skk.left(fib_num * 3) 74 | 75 | # Start the drawing 76 | draw_pattern() 77 | 78 | # Hide the turtle and finish drawing 79 | skk.hideturtle() 80 | turtle.done() 81 | 82 | -------------------------------------------------------------------------------- /optimized_fibonacci_spirograph.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import turtle 3 | #number of sides 4 | n = 13 5 | #lenght of the sizes 6 | l = 55 7 | turtle.screensize(canvwidth=7680, canvheight=4800, bg='black') 8 | def fibonacci(n): 9 | fibo = [] 10 | for i in range(n): 11 | if i == 0 or i == 1: 12 | fibo.append(i) 13 | else: 14 | f = fibo[i-1] + fibo[i-2] 15 | fibo.append(f) 16 | return fibo 17 | 18 | fibonacci_numbers = fibonacci(n) 19 | df = pd.DataFrame(fibonacci_numbers, columns=['Fibonacci Number']) 20 | print(df) 21 | 22 | def sprirograph(fibonacci_sequence): 23 | for f in fibonacci_sequence: 24 | turtle.color('red') 25 | turtle.speed(0) 26 | for i in range(37): 27 | if i == n or i == l: 28 | turtle.forward(n) 29 | turtle.forward(l) 30 | turtle.left(n) 31 | turtle.left(l) 32 | 33 | i = 0 34 | while i < 10: 35 | sprirograph(fibonacci(1000)) 36 | i += 1 37 | -------------------------------------------------------------------------------- /random_complex.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | from random import randint 3 | import math 4 | 5 | 6 | # Set up the screen 7 | turtle.screensize(canvwidth=10000, canvheight=10000, bg="white") 8 | wn = turtle.Screen() 9 | wn.bgcolor("black") 10 | wn.title("Armadillo") 11 | 12 | # Set up the turtle 13 | skk = turtle.Turtle() 14 | skk.speed(0) # Fastest drawing speed 15 | turtle.colormode(255) # Enable RGB color mode 16 | skk.width(1) # Set the pen width 17 | skk.goto(-150, -150) 18 | 19 | # Memoization for Fibonacci 20 | memo = {} 21 | 22 | def fibonacci(n): 23 | if n in memo: 24 | return memo[n] 25 | if n <= 2: 26 | f = 1 27 | else: 28 | f = fibonacci(n-3) + fibonacci(n-5) + fibonacci(n-9) + fibonacci(n-7) 29 | memo[n] = f 30 | return f 31 | 32 | # Number of sides and length of the star 33 | n = 37 34 | l = 59 35 | s = math.sqrt(2) 36 | 37 | # Function to draw the first star 38 | def star1(fib_num): 39 | for i in range(n): 40 | skk.color(randint(0, 255), randint(0, 255), randint(0, 255)) 41 | skk.forward(n) 42 | skk.left(l) # Turn by Fibonacci number plus some constant 43 | 44 | # Function to draw the second star 45 | def star2(fib_num): 46 | for i in range(n): # Use odd steps to make the pattern more complex 47 | skk.color(randint(0, 255), randint(0, 255), randint(0, 255)) 48 | skk.forward(n) 49 | skk.right(l) # Turn by Fibonacci number plus some constant 50 | 51 | # Function to draw a complex pattern 52 | def draw_pattern(): 53 | for i in range(n): # Loop to create multiple patterns with different Fibonacci numbers 54 | fib_num = fibonacci(i) 55 | star1(fib_num) # Draw the first star pattern 56 | skk.right(n) # Slight rotation for variety 57 | star2(fib_num) # Draw the second star pattern 58 | skk.left(l) # Adjust angle 59 | 60 | # Start the drawing 61 | draw_pattern() 62 | 63 | # Hide the turtle and finish drawing 64 | skk.hideturtle() 65 | turtle.done() 66 | -------------------------------------------------------------------------------- /spirograph.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | screensize(canvwidth=7680, canvheight=4800, bg='black') 3 | def fibonacci(n): 4 | fibo = [] 5 | for i in range(n): 6 | if i == 0 or i == 1: 7 | fibo.append(i) 8 | else: 9 | f = fibo.append(fibo[i-1] + fibo[i-2]) 10 | fibo[n] = f 11 | return f 12 | def sprirograph(fibonacci): 13 | for i in range(13): 14 | color('red') 15 | for i in range (37): 16 | if i==13 or i == 55: 17 | forward(13) 18 | forward(55) 19 | left(13) 20 | left(55) 21 | while True: 22 | sprirograph(fibonacci) 23 | -------------------------------------------------------------------------------- /watch.py: -------------------------------------------------------------------------------- 1 | 2 | """ turtle-example: 3 | ------------------------------------ 4 | spirographfibonacci 5 | ------------------------------------ 6 | """ 7 | import turtle 8 | from turtle import * 9 | from datetime import datetime 10 | import colorsys 11 | # taking input for the number of the sides of the polygon 12 | n = 17 13 | # taking input for the length of the sides of the polygon 14 | l = 29 15 | # taking input for the speed of the growth of the polygon 16 | v = 0 17 | 18 | wn = turtle.Screen() 19 | wn.bgcolor("black") 20 | wn.title("Armadillo") 21 | angle = (n-9)/n**0.5 22 | skk = turtle.Turtle() 23 | x = 129 #left_right 24 | y = -46 #up_down 25 | colors = [ 26 | #reddish colors 27 | (1.00, 0.00, 0.00),(1.00, 0.03, 0.00),(1.00, 0.05, 0.00),(1.00, 0.07, 0.00),(1.00, 0.10, 0.00),(1.00, 0.12, 0.00),(1.00, 0.15, 0.00),(1.00, 0.17, 0.00),(1.00, 0.20, 0.00),(1.00, 0.23, 0.00),(1.00, 0.25, 0.00),(1.00, 0.28, 0.00),(1.00, 0.30, 0.00),(1.00, 0.33, 0.00),(1.00, 0.35, 0.00),(1.00, 0.38, 0.00),(1.00, 0.40, 0.00),(1.00, 0.42, 0.00),(1.00, 0.45, 0.00),(1.00, 0.47, 0.00), 28 | #orangey colors 29 | (1.00, 0.50, 0.00),(1.00, 0.53, 0.00),(1.00, 0.55, 0.00),(1.00, 0.57, 0.00),(1.00, 0.60, 0.00),(1.00, 0.62, 0.00),(1.00, 0.65, 0.00),(1.00, 0.68, 0.00),(1.00, 0.70, 0.00),(1.00, 0.72, 0.00),(1.00, 0.75, 0.00),(1.00, 0.78, 0.00),(1.00, 0.80, 0.00),(1.00, 0.82, 0.00),(1.00, 0.85, 0.00),(1.00, 0.88, 0.00),(1.00, 0.90, 0.00),(1.00, 0.93, 0.00),(1.00, 0.95, 0.00),(1.00, 0.97, 0.00), 30 | #yellowy colors 31 | (1.00, 1.00, 0.00),(0.95, 1.00, 0.00),(0.90, 1.00, 0.00),(0.85, 1.00, 0.00),(0.80, 1.00, 0.00),(0.75, 1.00, 0.00),(0.70, 1.00, 0.00),(0.65, 1.00, 0.00),(0.60, 1.00, 0.00),(0.55, 1.00, 0.00),(0.50, 1.00, 0.00),(0.45, 1.00, 0.00),(0.40, 1.00, 0.00),(0.35, 1.00, 0.00),(0.30, 1.00, 0.00),(0.25, 1.00, 0.00),(0.20, 1.00, 0.00),(0.15, 1.00, 0.00),(0.10, 1.00, 0.00),(0.05, 1.00, 0.00), 32 | #greenish colors 33 | (0.00, 1.00, 0.00),(0.00, 0.95, 0.05),(0.00, 0.90, 0.10),(0.00, 0.85, 0.15),(0.00, 0.80, 0.20),(0.00, 0.75, 0.25),(0.00, 0.70, 0.30),(0.00, 0.65, 0.35),(0.00, 0.60, 0.40),(0.00, 0.55, 0.45),(0.00, 0.50, 0.50),(0.00, 0.45, 0.55),(0.00, 0.40, 0.60),(0.00, 0.35, 0.65),(0.00, 0.30, 0.70),(0.00, 0.25, 0.75),(0.00, 0.20, 0.80),(0.00, 0.15, 0.85),(0.00, 0.10, 0.90),(0.00, 0.05, 0.95), 34 | #blueish colors 35 | (0.00, 0.00, 1.00),(0.05, 0.00, 1.00),(0.10, 0.00, 1.00),(0.15, 0.00, 1.00),(0.20, 0.00, 1.00),(0.25, 0.00, 1.00),(0.30, 0.00, 1.00),(0.35, 0.00, 1.00),(0.40, 0.00, 1.00),(0.45, 0.00, 1.00),(0.50, 0.00, 1.00),(0.55, 0.00, 1.00),(0.60, 0.00, 1.00),(0.65, 0.00, 1.00),(0.70, 0.00, 1.00),(0.75, 0.00, 1.00),(0.80, 0.00, 1.00),(0.85, 0.00, 1.00),(0.90, 0.00, 1.00),(0.95, 0.00, 1.00) 36 | ] 37 | 38 | memo = {} 39 | def fibonacci(n): 40 | if n in memo : 41 | return memo[n] 42 | if n <= 2: 43 | f = 1 44 | else: f = fibonacci(n-1) + fibonacci(n-2) 45 | memo[n] = f 46 | return f 47 | 48 | def jump(distanz, winkel=0): 49 | penup() 50 | right(winkel) 51 | forward(distanz) 52 | left(winkel) 53 | pendown() 54 | 55 | def hand(laenge, spitze): 56 | fd(laenge*1.15) 57 | rt(90) 58 | fd(spitze/2.0) 59 | lt(120) 60 | fd(spitze) 61 | lt(120) 62 | fd(spitze) 63 | lt(120) 64 | fd(spitze/2.0) 65 | 66 | def make_hand_shape(name, laenge, spitze): 67 | reset() 68 | jump(-laenge*0.15) 69 | begin_poly() 70 | hand(laenge, spitze) 71 | end_poly() 72 | hand_form = get_poly() 73 | register_shape(name, hand_form) 74 | 75 | def clockface(radius): 76 | reset() 77 | pensize(7) 78 | pencolor("#96FF33") 79 | for i in range(60): 80 | jump(radius) 81 | if i % 5 == 0: 82 | fd(25) 83 | jump(-radius-25) 84 | else: 85 | dot(6) 86 | jump(-radius) 87 | rt(6) 88 | 89 | def setup(): 90 | global second_hand, minute_hand, hour_hand, writer 91 | mode("logo") 92 | make_hand_shape("second_hand", 70, 25) 93 | make_hand_shape("minute_hand", 150, 25) 94 | make_hand_shape("hour_hand", 100, 25) 95 | clockface(160) 96 | second_hand = Turtle() 97 | second_hand.shape("second_hand") 98 | second_hand.color("#96FF33", "#96FF33") 99 | minute_hand = Turtle() 100 | minute_hand.shape("minute_hand") 101 | minute_hand.color("#96FF33", "#96FF33") 102 | hour_hand = Turtle() 103 | hour_hand.shape("hour_hand") 104 | hour_hand.color("#96FF33", "#96FF33") 105 | for hand in second_hand, minute_hand, hour_hand: 106 | hand.resizemode("user") 107 | hand.shapesize(1, 1, 3) 108 | hand.speed(0) 109 | ht() 110 | writer = Turtle() 111 | #writer.mode("logo") 112 | writer.ht() 113 | writer.pu() 114 | writer.bk(85) 115 | 116 | def wochentag(t): 117 | wochentag = ["Monday", "Tuesday", "Wednesday", 118 | "Thursday", "Friday", "Saturday", "Sunday"] 119 | return wochentag[t.weekday()] 120 | 121 | def datum(z): 122 | monat = ["Jan.", "Feb.", "Mar.", "Apr.", "May", "June", 123 | "July", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."] 124 | j = z.year 125 | m = monat[z.month - 1] 126 | t = z.day 127 | return "%s %d %d" % (m, t, j) 128 | 129 | def tick(): 130 | t = datetime.today() 131 | sekunde = t.second + t.microsecond*0.000001 132 | minute = t.minute + sekunde/60.0 133 | stunde = t.hour + minute/60.0 134 | try: 135 | tracer(False) # Terminator can occur here 136 | writer.clear() 137 | writer.home() 138 | writer.color("#96FF33") 139 | writer.forward(65) 140 | writer.write(wochentag(t), 141 | align="center", font=("SanSserif", 14, "bold")) 142 | writer.back(150) 143 | writer.write(datum(t), 144 | align="center", font=("SanSserif", 14, "bold")) 145 | writer.forward(85) 146 | tracer(True) 147 | second_hand.setheading(6*sekunde) # or here 148 | minute_hand.setheading(6*minute) 149 | hour_hand.setheading(30*stunde) 150 | tracer(True) 151 | ontimer(tick, 100) 152 | except Terminator: 153 | pass # turtledemo user pressed STOP 154 | 155 | def star(fibonacci): 156 | skk.goto(x , y) #draw when the turtle moves 157 | skk.speed(v) 158 | for i in range(n): 159 | for colors in [ 160 | #reddish colors 161 | (1.00, 0.00, 0.00),(1.00, 0.03, 0.00),(1.00, 0.05, 0.00),(1.00, 0.07, 0.00),(1.00, 0.10, 0.00),(1.00, 0.12, 0.00),(1.00, 0.15, 0.00),(1.00, 0.17, 0.00),(1.00, 0.20, 0.00),(1.00, 0.23, 0.00),(1.00, 0.25, 0.00),(1.00, 0.28, 0.00),(1.00, 0.30, 0.00),(1.00, 0.33, 0.00),(1.00, 0.35, 0.00),(1.00, 0.38, 0.00),(1.00, 0.40, 0.00),(1.00, 0.42, 0.00),(1.00, 0.45, 0.00),(1.00, 0.47, 0.00), 162 | #orangey colors 163 | (1.00, 0.50, 0.00),(1.00, 0.53, 0.00),(1.00, 0.55, 0.00),(1.00, 0.57, 0.00),(1.00, 0.60, 0.00),(1.00, 0.62, 0.00),(1.00, 0.65, 0.00),(1.00, 0.68, 0.00),(1.00, 0.70, 0.00),(1.00, 0.72, 0.00),(1.00, 0.75, 0.00),(1.00, 0.78, 0.00),(1.00, 0.80, 0.00),(1.00, 0.82, 0.00),(1.00, 0.85, 0.00),(1.00, 0.88, 0.00),(1.00, 0.90, 0.00),(1.00, 0.93, 0.00),(1.00, 0.95, 0.00),(1.00, 0.97, 0.00), 164 | #yellowy colors 165 | (1.00, 1.00, 0.00),(0.95, 1.00, 0.00),(0.90, 1.00, 0.00),(0.85, 1.00, 0.00),(0.80, 1.00, 0.00),(0.75, 1.00, 0.00),(0.70, 1.00, 0.00),(0.65, 1.00, 0.00),(0.60, 1.00, 0.00),(0.55, 1.00, 0.00),(0.50, 1.00, 0.00),(0.45, 1.00, 0.00),(0.40, 1.00, 0.00),(0.35, 1.00, 0.00),(0.30, 1.00, 0.00),(0.25, 1.00, 0.00),(0.20, 1.00, 0.00),(0.15, 1.00, 0.00),(0.10, 1.00, 0.00),(0.05, 1.00, 0.00), 166 | #greenish colors 167 | (0.00, 1.00, 0.00),(0.00, 0.95, 0.05),(0.00, 0.90, 0.10),(0.00, 0.85, 0.15),(0.00, 0.80, 0.20),(0.00, 0.75, 0.25),(0.00, 0.70, 0.30),(0.00, 0.65, 0.35),(0.00, 0.60, 0.40),(0.00, 0.55, 0.45),(0.00, 0.50, 0.50),(0.00, 0.45, 0.55),(0.00, 0.40, 0.60),(0.00, 0.35, 0.65),(0.00, 0.30, 0.70),(0.00, 0.25, 0.75),(0.00, 0.20, 0.80),(0.00, 0.15, 0.85),(0.00, 0.10, 0.90),(0.00, 0.05, 0.95), 168 | #blueish colors 169 | (0.00, 0.00, 1.00),(0.05, 0.00, 1.00),(0.10, 0.00, 1.00),(0.15, 0.00, 1.00),(0.20, 0.00, 1.00),(0.25, 0.00, 1.00),(0.30, 0.00, 1.00),(0.35, 0.00, 1.00),(0.40, 0.00, 1.00),(0.45, 0.00, 1.00),(0.50, 0.00, 1.00),(0.55, 0.00, 1.00),(0.60, 0.00, 1.00),(0.65, 0.00, 1.00),(0.70, 0.00, 1.00),(0.75, 0.00, 1.00),(0.80, 0.00, 1.00),(0.85, 0.00, 1.00),(0.90, 0.00, 1.00),(0.95, 0.00, 1.00) 170 | ]: 171 | skk.color(colors) 172 | for i in range (37): 173 | if i==n or i == l: 174 | skk.forward(n) 175 | skk.forward(l) 176 | skk.left(n) 177 | skk.left(l) 178 | def main(): 179 | tracer(False) 180 | setup() 181 | tracer(True) 182 | tick() 183 | star(fibonacci) 184 | return "EVENTLOOP" 185 | 186 | while __name__ == "__main__": 187 | 188 | mode("logo") 189 | msg = main() 190 | print(msg) 191 | mainloop() 192 | -------------------------------------------------------------------------------- /xcvcv.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arcesoftware/spirographfibonacci/cb6f320b62c30660b20a01abaeda946cfbf70664/xcvcv.JPG --------------------------------------------------------------------------------