Commenting on a Code

Here's something I have to admit: I was too afraid to break down the "769" code that was in my previous blog post. When I opened the file, I told myself that there was no way I would ever be able to understand such a sophisticated code.

When I look back at the "769" code, I understand it so much clearer than I did before. Breaking it down helped me realize the purpose of each block and the contribution it has to create the design. It also helped me realize that I only believed it was hard because I didn't understand what a few blocks meant prior to adding comments. I made the same TurtleStitch design, but I called it "769 Commented" because I wanted to have comments next to each unique block so I can always look back at it in the future as a reference.

I encourage you all to edit comments if you know more about the blocks. If anyone could figure out and explain the reps block, it would truly make a difference to my understanding of this code. I will also try to figure it out and I will definitely give an update once I have a full understanding.

To add a comment on SNAP, Scratch or TurtleStitch:
Control+click or command+click the area next to the code and click "add comment."

Here is a snapshot of the "769 Commented" code:

Comments

  1. The variable reps is used to determine how many times we have to take (at most) "max_stepsize" steps to forward a total of "len".
    When e.g. len=96 and max_stepsize=10 we kind of want to do this 9.6 times.
    The first set "reps" block makes reps equal to 9 (round 9.6)
    Because 6 > 10/2 the second set "reps" blocks adds one extra.

    The result is that the Turtle advances 10 times 9.6 steps, in total 96 steps ...

    ReplyDelete

Post a Comment

Popular posts from this blog

What is Your Zodiac Sign?

Stitch Warnings!

Turtlestitch 2.5 - The Whizzy Needle