Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- kturtle-script-v1.0
- # This script creates a leaf
- # It is an example of an
- # "iterated function system"
- # You can find out more at
- # http://en.wikipedia.org/wiki/Iterated_function_system
- @(reset)
- @(canvassize) 500@(,)500
- @(pencolor) 0@(,)255@(,)0
- $p=0
- $q=0
- # you can change the number of iterations
- # also change the maps if you like
- @(repeat) 60000 {
- $p1 = @(random) 0@(,)255
- $p2 = @(random) 0@(,)255
- $p3 = @(random) 0@(,)30
- # random pen color that is close to green
- @(pencolor) $p1@(,)$p2@(,)$p3
- $x = @(random) 1@(,)100
- $pt = $p
- $qt = $q
- @(if) $x < 86 {
- $p=0.85*$pt+0.04*$qt
- $q=-0.04*$pt+0.85*$qt+1.6
- }
- @(if) ($x >= 86) @(and) ($x < 93) {
- $p=-0.15*$pt+0.28*$qt
- $q=0.26*$pt+0.24*$qt+0.44
- }
- @(if) ($x >=93) @(and) ($x < 99) {
- $p=0.2*$pt-0.26*$qt
- $q=0.23*$pt+0.22*$qt+1.6
- }
- @(if) ($x >= 99) {
- $p=0
- $q=0.16*$qt
- }
- @(go) (50*$p+200)*1@(,) 500-(50*($q))
- @(pendown)
- @(forward) 1
- @(penup)
- @(backward) 1
- }
- @(go) 0@(,)0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement