Saturday, September 21, 2013

Lesson 20 - Spider

After yesterday's repetitive practise on Turle Roy basic movements, we were quite well prepared for today's lesson. We started teaching the computer immediately and wrote (again)

    let askel = s [fd 100, lt 90]


    let neliö = r 4 askel

Then (the excitement thickens) we ran our neliö function and had the turtle draw a perfect square. And again. And again.

Then we set to implementing the "spiderweb" thing that I showed her earlierly. The idea is to draw a square, then turn right, say, 5 degrees, then rinse and repeat. So first we taught the computer to do the "square and then turn" thing, the naming of which was left to her. She chose to name it xz. And then we wrote

    let xz = s [neliö, lt 1]

She chose the 1-degree turn against my advice. And finally

    let spider = r 360 xz

And we got a very fancy picture. Not the spiderweb thing though, because of the 1-degree turn, but a cool thing anyway. Then we modified the program a bit to draw the actual spiderweb. We saved our work, so that you can try it out yourself.

This was a fun lesson! She would have wanted to do some keyboard practise in vim too, but we ran out of time.

No comments:

Post a Comment