KTurtle/Examples

From KDE UserBase Wiki
Revision as of 12:45, 8 July 2010 by Pipesmoker (talk | contribs) (Created page with '{{EduBreadCrumbs|parent=KTurtle}} {{Construction}} ==Koch curve== This is a fractal curve. You can find more information about this at [http://en.wikipedia.org/wiki/Koch_snowfl...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Home » Applications » Education » KTurtle » Examples

Under Construction

This is a new page, currently under construction!


Koch curve

This is a fractal curve. You can find more information about this at Wikipedia.

Logo script:

# Koch curve

reset
canvassize 850550
go 125350
turnright 90

learn koch $x$t {
  if($t>0{
    $t=$t-1
    $x=$x/3
    koch $x$t
    turnleft 60
    koch $x$t
    turnright 120
    koch $x$t
    turnleft 60
    koch $x$t
  } else {
  forward 3*$x 
  }
}
koch 2006

Result:

Sierpinski Triangle

Another famous fractal is the Sierpinski triangle.

Logo script:

# Sierpinski triangle

learn sierp $l {
  if $l > 2 {
    repeat 3 {
      sierp $l/2
      forward $l
      turnleft 120
    }
  }
}

reset
canvassize 600533
go 50483
turnright 90
sierp 500

Result: