2015-12-03 Complete TreeLab + ExtraCredit

posted Dec 2, 2015, 7:45 PM by Samuel Konstantinovich   [ updated Dec 2, 2015, 7:47 PM ]
TreeLab part 2: (final version due Monday)

3: Advanced Tree (to look organic) Try to get these 5 parts added in your advanced-tree function.

3a) Make the angle change (smaller or bigger) every time you call the tree. This means the angle can also be passed as a parameter and modified as you go. (Stop using the slider inside the function, instead pass it in as the starting value.)

;now you should have:
to advanced-tree [ n angle]
   ??? ;the angle should change a little bit when advanced tree calls itself. Like: (angle + random 5 - random 5) 
end

Hint -- Parenthesis are not required for this but you can use them to help you read the code:
       advanced-tree (n - 1)  (angle + 1)


3b) Make the branch size decrease by a small amount every time you call tree.  This requires that the branch size be a parameter of your tree function. 

;now you should have:
to advanced-tree [ n angle branch]
   ???; angle changes randomly, and the branch (length) will decrease a little when the recursive call is made.
end

Hint -- Parenthesis are not required for this but you can use them to help you read the code:
     advanced-tree (n - 1) angle (branch * .75)  

3c) Same as 3b, you can use the pen-size as a parameter that decays as well!
;now you should have:
to advanced-tree [ n angle branch penwidth]
   ???; same as before but penwidth decreases like the branch length
end

3d) Color! It can get darker, lighter, randomized or anything you want. Look at the tools : color picker   to get an idea of what colors have which numbers. 
;now you should have:
to advanced-tree [ n angle branch penwidth treecolor]
   ???; same as before but tree color changes... you decide how.
end

3e) Can you make a turtle "stamp" a leaf at the tips of the branches?


EXTRA CREDIT 
Due Monday: You do NOT have to do this.
Make the coolest looking tree function you can. I will compare them in class and choose the coolest looking ones. (My opinion judges) You can work on them at home, I will give you until Monday. Your goal could be to make a better more interesting looking tree, or to make a really complex but very viewable tree. Don't just make rainbows... Also don't just copy my Sakura tree demo with the falling leaves. You can animate this if you like, but it should be better than the completed advanced tree. 
Comments