0

hi,

does anyone have or know were i can get some coding for a fractual curve any curve that is or may be a Dragon Curve.

thanks

4
Contributors
7
Replies
8
Views
8 Years
Discussion Span
Last Post by srk619
0

thanks for the info do you know how i can paste the code in python and see it in action

0

thanks for the info do you know how i can paste the code in python and see it in action

Select the code from webpage -> Ctrl + C
Open your favorite code/text editor -> Ctrl + V
Save As.... <File_name>.py
Run!

For your own sanity's sake you should replace the tabs with spaces... also make sure you have the modules required for xturtle

0

anyone know any other fractual curves code apart from the dragon curve which is a bit more easy and simple something like Torn Square fractal

0

You can play with this:

# draw a dragon curve fractal using Tinter's turtle
# dense version using recursion
# modified from: http://www.rosettacode.org/wiki/Dragon_curve

from turtle import *

def dragon(step, length, zig=right, zag=left):
    if step <= 0:
        forward(length)
        return
    step -= 1
    length /= 1.41421
    zig(45)
    dragon(step, length, right, left)
    zag(90)
    dragon(step, length, left, right)
    zig(45)


# set to False to speed things up (default is True)
tracer(False)

# draw in this color
color('red')

# turtle by default starts at (x=0, y=0) center of display
# lift pen up to move to the left by 130 units and up 70 units
# then drop the pen down to start drawing
up()
goto(-130, 70)
down()

# experiment with step and length
step = 12
length = 300
dragon(step, length)

# gives some viewing time ...
import time
time.sleep(7)
0

sneekula u da man thank alot that make alot more sense than the wikipedia one

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.