Skip to main content

Learning Scratch (2)

My last blog entry, I briefly talk about what is Scratch. There are ``events'' and that is the trigger of the program. In this article, I would like to talk about one of my students who made a character animation program by Scratch.

Scratch provides key events. When I push the right arrow key, then ``right arrow key push event'' is triggered. When that event happened, I add 10 to the x coordinate of the cat. This means, when the right arrow button pushed, the cat move to the right for 10 steps. If I add more programs like the up arrow moves the cat to upper direction, I can control the cat position by the arrow keys. This is a cat control program.

Today, my student used a dragon. He wrote the same program with the cat. Then, the cat and the dragon move exactly the same way. Of course they should. A current computer is very fast, very precise, and very stupid. It does only what the developer wrote. My student asked me, how he can make the dragon faster. I answered, increase the moving step. Currently one key push moves the dragon ten unit steps. A speed is a moving distance in a certain time. If the step was increased to twenty from ten, the speed of the dragon becomes twice. While after, when I came back to him, he duplicated the key events. Interesting.

His method is the following: when the right arrow push event was triggered, two programs started in parallel. One program change the dragon's x coordinate plus 10, and another program does the same. In the end, the dragon's x coordinate increased by twenty. It seems the Scratch environment takes care the parallel change (i.e., locking), so this program works correctly. When he wanted to move the dragon three times faster than the cat, he copied the program again. What an interesting idea he had! Out of the blue, I recalled one scene of a cartoon, JoJo's Bizarre Adventure. (If you don't know it, please ignore the rest of the paragraph.) It's a scene that Jotaro floated in the air using his stand. He can move in the air by pushed his stand. My idea was increase the speed of the stand, but my student idea was increase the number of stands. Two stands can push twice faster, three stands can push three times faster.

But this student's idea can only make whole number times speed. He cannot make the dragon 1.5 times faster than the cat. Of course one program can push the dragon ten steps and another program can push the dragon five steps, make it 1.5 times faster. But then, there is not so much difference from one program pushed fifteen steps. His idea is just coping all the events and nothing more, still he can change the speed twice. However, if you learn the idea of generalization from mathematics, you will realize that which method can be applied to more situations. In this case, changing the speed itself in one program is better since you are not limited to multiple of positive integer (not only fractional times speed up, but you can stop and can also go backwards). If you learn computer science, the one program is considered better since the resource consumption of multi-threading, synchronization overhead, and so on. Also code maintenance point of view, one program is much easy to manage in general compare to the multiple copies of the program. Despite these disadvantages, I still like his idea, so free and unique.

When I saw 20 key events for handing four direction's control to speedup dragon five times faster (Figure 2), I was surprised by his idea, especially how freely and creatively he can think. At the same time, I felt the importance of the learning of basic concepts. I wish he will continue to learn without forgetting this thinking way, a free and creative way of thinking.

Figure 2. Using multiple same key events

Comments

Popular posts from this blog

Why parallelogram area is |ad-bc|?

Here is my question. The area of parallelogram is the difference of these two rectangles (red rectangle - blue rectangle). This is not intuitive for me. If you also think it is not so intuitive, you might interested in my slides. I try to explain this for hight school students. Slides:  A bit intuitive (for me) explanation of area of parallelogram  (to my site, external link) . 

Geometric Multiplicity: eignvectors (2)

If eigenvectors of a matrix A are independent, it is a happy property. Because the matrix A can be diagonalized with a matrix S that column vectors are eigenvectors of A . For example, Why this is a happy property of A? Because I can find A's power easily. A^{10} is not a big deal. Because Λ is a diagonal matrix and power of a diagonal matrix is quite simple. A^{10} = SΛ^{10} S^{-1} Then, why if I want to compute power of A ? That is the same reason to find eigenvectors. Eigenvectors are a basis of a matrix. A matrix can be represented by a single scalar. I repeat this again. This is the happy point, a matrix becomes a scalar. What can be simpler than a scalar value. But, this is only possible when the matrix S's columns are independent. Because S^{-1} must be exist. Now I come back to my first question. Is the λ's multiplicity related with the number of eigenvectors? This time I found this has the name. Geometric multiplicity (GM): the number of in...

Tezuka Osamu's Black Jack, "Shrinking"

I like several novel authors. My first favorite author is probably Teduka, Osamu. I still love him. The list grows by adding Hoshi, Shinichi, Agatha Christie, Hermann Hesse, and so forth. My first favorite article of Tezuka was Atom as most of the (boy's) Tezuka fans did. But my favorite is Black Jack. I try to summarize one story, it is still quite vivid in my memory. I first read this story when I was 13 - 15 years old. I re-read it at least several times since Black Jack is composed of many short episodes. The title should be "ちぢむ (SHRINKING)" or it might be "縮む(Shrinking)". (It is not so convenient to translate this to English, since English does not have a system to say the exact same word in several ways. So I just simulate it with capital letters.) Black Jack is a genius surgeon, but he does not have the license. In short, his medical activity is illegal. His skill is top level in the world, but, the fee is also out-of-law expensive. In the story ...