Where: at school
When: 2 hours Monday morning
Goals:
1) Review for loop
2) Introduction to writing functions
What we did today:
0) Discussing the homework. They showed the car they modified last time
1) We started with a short program which shows a for loop and and if statement. This program draws a 20 pointed star:
speed 100
pen red
for x in [1..20]
fd 80
rt 100
if x is 10
pause 2
2) The children were then asked to create 20 pointed stars in 2 more colors. Then I showed them how to use function so that they can call the function to draw stars of their color choices.
speed 100
star = (color) ->
pen color
for x in [1..20]
fd 80
rt 100
if x is 10
pause 2
star red
3) Then we played with how to make command buttons. Again, initial program supplied and then asked to extend the program to have more buttons. I showed that button can do complicated things like drawing the 20 pointed stars as in previous example or even drawing a wheel of a car that was part of their homework last time.
pen sienna
button 'R', -> rt 10
button 'F', -> fd 10
button 'D', -> dot 'green'
4) Last we played with a program that takes user inputs. It seems effective to have them play around with the program initially and then ask them to extend it in a certain way. In this case, I ask them to extend the program to also take user input for the size of the polygon. This one was a bit challenging for them and it was very gratifying to me to see them struggle with it before arriving at the answer.
await read "Color?", defer color
await read "Sides?", defer sides
pen color
for [1..sides]
fd 30
rt 360/sides
Homework
Draw a flower garden or a forest.
No comments:
Post a Comment