Monday, February 22, 2021

Make a Block II - The Recursive Koch Curve


   How to use Make a Block to program the famous Koch curve is the topic of this post. Below is a graphic that shows the stages (levels) of the curve's development. Instead of writing a script for each level, Make a Block and the programming technique known as recursion allows the program to be created using a single[ define recursive call side length level]script.

    Here's the working script. With side length = 297 and level as the only other input, this script will draw figures 1 through 5 as shown above.
   Teachers and/or students might like a free PDF file that steps through the development of the script shown above. The technique used in this Scratch program is applicable to many other similarity fractals like the Koch curve. It might interest you to know that mathematics still does not have an agreed upon definition for curve
   If any of the levels shown in the diagram above are drawn on the sides of an equilateral triangle the result is know as a Koch Snowflake. It can be shown that as the perimeter of the curve approaches infinity the area approaches 8/5 the area of the original equilateral triangle.

   This project can be viewed and downloaded from the Scratch MIT web site by clicking on this link:https://scratch.mit.edu/projects/11128415/

   Teachers and/or students might also be interested in the free PDF document that describes the formula for the perimeter of the curve as a function of level.
   Either or both of the documents mentioned above can be obtained by sending an email request to grandadscience@gmail.com. I send my free PDF documents to teachers and students all over the world and I have never had a single complaint.
 

Thursday, February 11, 2021

How to Use Make a Block in Scratch

   Scratch 2.0 introduced the Make a Block option that made recursion easy to implement in Scratch.
  The mechanics of using Make a Block need explaining as the process for making a block and how variables are handled in Make a Block are different than the mechanics for creating a variable under the Orange variable menu. 
   When you click on the Make a Block option the following menu appears.
   This menu was used to create the Make a Block shown below.

   Note that the define top block is red with the name square and the variable side length also in red. The arrow indicates the variable used in the move block is taken from the define block itself and not the orange variable menu. The orange and blue blocks were taken from their regular menus.
   This Make a block was used to create ten squares, each a different color and side length.

   The purpose of this project is to illustrate the mechanics of using Make a Block. A later post will focus on the programming power of Make a Block.
    Teachers and students might be interested in a free PDF tutorial that describes this project in more detail. The tutorial can be obtained by emailing a request to www.grandadscience@gmail.com.
   You can also view and download another Make a Block project by clicking on the following link.
https://scratch.mit.edu/projects/10155992