Monday, December 30, 2013

Lesson 44 - Pentagram

Today we started with some math. The task was to calculate the correct angle for drawing a pentagram, where the you turn around 720 degrees, i.e. two full circles. So we calculated 360 * 2 and then divided it by 5 to factor in the 5 vertices of the pentagram. It proved non-trivial to write and read numbers in the range of 0..1000, so we did some practise on that too.

Then we wrote the program on paper first and I drew the pentagram for her there, simulating the Turtle Roy environment with pen and paper. So, here's her sketch.

She remembered that you use sequence or s to do things sequentially and that you have to put the things into a list. She didn't remember the repeat or r function that is used to repeat things. I explained her that you have to wrap the repeated things in parentheses and she drew huge parentheses around the sequence. Will she remember that later? Will see.

At first she was not very enthusiastic and was very slow and sleepy. But she picked up speed quite quickly and in the end she wrote the program to Turtle Roy all by herself, copying it from the paper sketch.

Right now she's teaching mom the same things. She really enjoys teaching people so this is good. And they both learn coding from each other. Win-win.

Using pen and paper first feels good. Will use more often.

Oh and meanwhile the younger girl had painted herself a dark brown Hitler moustache.

Saturday, December 21, 2013

Lesson 43 - Back to the Roots

It's been a while since we've done stuff on the command-line, so today it was time to get back to basics. So we wrote a birthday song for the Owl. It was fun using vim again. What we made was a simple 4-line script that recitates the Happy Birthday song. Once again, we had to set file permissions using chmod etc. She was quite proud of the result and ran the script several times. She even brought the Owl (a teddy one, made by mom) to listen to the song.

Then we made another birthday song using Scratch, featuring a rocking owl and her singing. Was fun. No time to write more.

Friday, December 13, 2013

Sudden Breakthrough

Today, while I was happily hacking some Haskell in the livingroom and assumed the girls were playing, they were actually coding. She had assembled her first Scratch script by her own, combining three elements:
  • When "green flag" is clicked
  • Wait 1 second
  • Say "Hello"
I'm quite impressed that she knew where to drag all these elements from: you have to switch to a different tab containing about a dozen different elements. Yet she had managed to do this all by herself.

So now when you click on the "green flag", Santa Claus says "Hello". Santa is a figure she drew earlierly. With a little help from me she made Santa Claus play a drum beat and the other guy sing. (you can record your singing with Scratch too). She's in fact coding right now, trying out different drum beats. Gotta go, she wants to show me something!

Lesson 42 - Answer to the Ultimate Question of Life

We had another Scratch session a couple of days ago. I forgot to blog about it and now I can only say that we made an animated crab that said "Hello" and made some awkward moves.

Sunday, December 8, 2013

Lesson 41 - Painting and animation

For the record, we did some painting and animation stuff with Scratch yesterday. Maybe we'll come up with an interactive xmas card by xmas. Maybe with something else. I'll try to sneak in as much programming as possible. 

Yesterday it was just a simple sequence of "repeat forever: wait 1 second, next costume". In scratch the different animation frames for the sprites are called costumes. Why on earth?

In general, I'm still quite impressed by Scratch. I'm sure we'll be spending countless hours hacking on it. The downside is that you don't learn typing with it, because you can just drag and drop stuff around. So, we'll keep up our other activies too. Learn typing on the command-line and geometry and math in Turtle Roy.

Monday, December 2, 2013

Reaktor Kids Kode Skool III - Scratch

Today we had our 3rd Reaktor Kids Kode Skool event at the office with 8 (or so) kids. This time we tried the Scratch learning environment. And it was great fun. With Scratch, you can assemble simple (and even complex) programs by dragging visual building blocks together. It's easy to move and animate sprites (figures), add sounds and control logic to them.

It was fun to find out that you can use similar structures as you'd use in Turtle Roy, for chaining and repeating things. But in Scratch you can compose them visually, which seems to make the program structure easier to build and understand.

I strongly recommend trying out Scratch. It took me like 30 minutes to familiarize myself with the system before the event, so that I can show it to the others. Before that I had only heard about Scratch, so you can say I started from scratch.

Here's a video depicting one of the greatest masterpieces produced by the kids. I hope you won't get an epileptic seizure from watching this.


Sunday, December 1, 2013

Lesson 40 - High fives, Low fives

Today we started with a discussion on typing. She often struggles with finding the letters when typing, and thus types slowly. I show her how cool touch typing is by typing everything she said while she was speaking, without looking at the keyboard. And she got interested. I was afraid her hands are too small for touch typing but in fact she was perfectly able to place the four fingers of her left and right hands on top of the letters ASDFJKLÖ. Then we pracised typing those letters without moving any fingers. Then a bit with her eyes shut. I think we might be able to learn to touch type if we just practised hard. And in fact that might pay off too. If you can type without looking at (or even thinking about) your hands, you'll free a lot of brain capacity for higher-level functions, right? Dunna.

Then we tried changing the keyboard repeat rate using System Preferences. She tried different rates and ended up with the fastest possible, of course. We practised switching windows with Cmd-Tab as well as by pointing at the windows with the trackpad cursor. I tried to convince her that Cmd-Tab is way faster but she didn't buy it.

Next up was writing a Christmas wish list with vim. First we discussed what the file should contain (a line for gifts, another for food, third for company and a fourth for songs). Then I left the room and let her work on her own. In 5 minutes she invited me back and the file was like this:

    parpi vauva kemiaa

That translates roughly to "barbie, toy baby, chemistry set". We didn't make it to the second line this time. Instead we saved the file and copied the contents to the clipboard using

    cat lahjat|pbcopy

And then sent it to mom in email.

This lesson was fun and relaxed. I pretended to fall asleep each time she did things slowly and that was fun for both. When she succeeded, we did high fives with hands and low fives with feet. That's it!