[kde-edu]: Recursion in KTurtle?

Matthias Messmer matthias at familie-messmer.de
Fri Oct 5 18:31:19 CEST 2007


Hi!

Ralf Gesellensetter wrote:
> she failed implementing Koch-curves or fractals.

# preparing...
reset
canvassize 300,301
direction 90

# recursive definition
learn snow x [
  if x == 0 [
   fw 10
  ]
  else [
   snow x-1
   tl 60
   snow x-1
   tr 120
   snow x-1
   tl 60
   snow x-1
  ]
]

# GO!
go 0,50
snow 1

go 0,150
snow 2

go 0,250
snow 3


More information about the kde-edu mailing list