Python Forum
Koch fractal with iteration
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Koch fractal with iteration
#1
I tried this code for generating Koch's curve:
from turtle import *

def koch(length, depth):
   if depth == 0:
     forward(length)
   else:
     koch(length/3, depth-1)
     right(60)
     koch(length/3, depth-1)
     left(120)
     koch(length/3, depth-1)
     right(60)
     koch(length/3, depth-1)

koch(300, 2)
I'm having hard time to write an iterative version of it. Any hints/helps?
Reply


Messages In This Thread
Koch fractal with iteration - by drimades - Oct-06-2017, 01:19 PM
RE: Koch fractal with iteration - by ichabod801 - Oct-06-2017, 01:40 PM
RE: Koch fractal with iteration - by drimades - Oct-06-2017, 02:00 PM
RE: Koch fractal with iteration - by ichabod801 - Oct-06-2017, 02:32 PM
RE: Koch fractal with iteration - by drimades - Oct-06-2017, 02:38 PM
RE: Koch fractal with iteration - by ichabod801 - Oct-06-2017, 04:46 PM
RE: Koch fractal with iteration - by drimades - Oct-11-2017, 02:20 PM
RE: Koch fractal with iteration - by ichabod801 - Oct-11-2017, 08:35 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020