Sunday, December 15, 2013

TurtleArt Snowflakes

The snow has started to fall where I live so it is time to program TurtleArt to draw some snowflakes!

This project uses a Logo programming approach espoused by Cynthia Solomon. She helped program and develop the Logo programming language and taught students to program starting in the 1960s and continues to teach children and adults today!


Dr. Solomon encourages programmers to build small parts or tools that can be used to build bigger designs.




Snowflakes have a bit of randomness built in to their design. Supposedly no two snowflakes are alike. Our snowflake should have some randomness built in to its design, too. Our snowflake randomness will be in the diameter of the snowflake and in the length of the "barbs" along the "arms" of the snowflake. Some snowflakes will be larger than others. 

Create a new procedure from the My Blocks palette by dragging a diamond block from the top of the palette to the stage. Click on the diamond block then name it by typing ray.


To make our snowflakes randomly sized we are going to put values into the store in box1 block. Since the TurtleArt canvas size is 560 turtle steps from bottom to top, it would be nice to limit our snowflake's size so it fits in the TurtleArt window. You can change your values for how tall one arm of your snowflake will be. This is equivalent to the snowflake's radius.




Once you determine your snowflake's possible radius, program the turtle to move back and forth that distance. This creates the ray procedure.





I also want little barbs from the ray that correspond to the length of the ray the turtle drew. Use some Numbers blocks to make the turtle divide the length of the ray it just drew by four.



The barbs on the ray the turtle drew above are .25 the length of the snowflake's arm. The turtle moves a quarter of the length of the particular ray and turns left 45 degrees. It draws a simple barb shape.






Finally, reset the turtle to the beginning point of the ray:



Now we will use this simple tool to create a more complex design. 

First, some setup. We should make the screen a darker blue color. 





We can randomize the size of the pen, too.



The set color block here is redundant since we are using the set shade block to set the rays color to white. The set color block here might be useful for your remix of this project.



Finally, we can draw a six-rayed snowflake, or you can change the number of repetitions and the degrees the turtle turns.







No comments: