browser icon
You are using an insecure version of your web browser. Please update your browser!
Using an outdated browser makes your computer unsafe. For a safer, faster, more enjoyable user experience, please update your browser today or try a newer browser.

Computer Science Blog # 1: Analyzing the Turtle Art

Posted by on February 12, 2019

My chosen turtle art

Turtle Art: Snowfall

Overall code

Based on my first inspection, I thought it is mostly made by iteration to randomize the size and the position of falling snows and the ices (at the bottom). In addition, the increment of the shade of ices and snows was impressive since darker snows and ices really look further away from me. After I looked at the codes in turtle art, I was surprised by not only the secret techniques of portions to present the illusion of darker snows and ices look further away from me but also the length of those codes, which is too precise. I separated into three parts of analysis: two sub-procedures, and one final code.

1. Analysis of snow:

The main point in the snow part is how to illustrate the increment sizes and shades and various shapes of snows with the random positions.

First of all, the secret technique to create an illusion is not only the shade of snows but also the size of the snows were slightly incremented, from darker to brighter and smaller to bigger. However, the main secret is that the designer set a particular incrementing ratio of sizes and shades of the snows. For instance, the shade of snows is incremented by adding 0.9 in each iteration(Yellow part in the picture below). Since I was curious about what does the number 0.9 influence, I kept putting another number. As a result, I found out that 0.9 is also related to the size of snows since the size of snow is designed as shade/10. Therefore, the sizes of the snows increase dramatically as the shade increases in each iteration. When I put 5, 10, 15, and 20 instead of 0.9, the snows became too big at the end, and when I put 0.5 and 0.7 instead of 0.9, the snows were so small and gray so that the final draw

 

looks like the snows are only located at the back. Furthermore, as I mentioned before, the size was set as shade/10, therefore as the snows became brighter, the snows also became bigger(purple part in the picture). Since I was also curious about number 10 at the denominator, the snows were too small when the number was greater than 10 and snows were too big when the number was smaller than 10. Since we are repeating it 100 times, the differences of sizes and shades exponentially change. Another key technique that is used to make the overall code simple is related to math. Snow is designed by repetition of moving forward and backward with changing the angles. Since the center angle of a circle is 360, the designer created a new parameter that is randomized from 8 to 12 and set this parameter as the number of repeating the forward and backward and divide 360 by the parameter. Therefore, snow can be drawn with simply four codes: iteration, forward, back, and right(Purple and Red part). Finally, by setting the x coordinate and y coordinate as random -350 to 350 and 10 to 270, respectively, and repeating this random coordination, the snows could be positioned differently. Besides these important codes, the pensize is set as 2, and the initial shade is set as 10.

 

2. Analysis of Ice:

Codes for making ground filled with snows and ices are even simpler than the snow. It only requires five steps in one repetition. The main key is the decrementing of shade. The shade of the ices decrements based on the Y-Coordinate. The shade is specifically set as y-coordinate/ -2.8, so as the ices are randomly positioned at higher y-coordinate, ices are darker and create the scenography(the purple part at the picture below). Same as Snow, the designer set ices’ X, Y coordinate as random with a specific range in order to set all ices at the bottoms. Ice is simply illustrated by forward code with random range, from 40 to 100. This random range will determine the length of ices. In addition, the role of Seth 90 is to enable to solely draw horizontal ices. The size of the ices is random by setting the pensize as random from 5 to 10.

 

3. Analysis of final code

In the final code, it sets the background color and combines two sub-procedures. The background color is set as black through the color of -9999 and a shade of 0. The final code also decides a color of the entire objects since the designer didn’t separately set the color in the sub-procedure. Hence, we can simply change the color of snow and ice at the final code.

final code

Comments are closed.