Monday, January 26, 2015

Creepy Eyes (programming class 14)

Who: Baan Pathomtham Grade 5
Where: at school
when: Monday morning for 2 hours

Note: These activities were based on this program I found in the pencilcode activity directory: Son of Eyes. This was a very productive class because it helped tease out many misconceptions about functions and variables.

Homework Discussion

Reviewing the students' accounts this weekend, I saw some programs written for geometry (great!) but no more progress on the function machines and nothing that indicated they had thought about their projects for this term. As a result, we did not discuss homework today ;-<

Simple Function

The first challenge was to figure out what this program does:
makeeye = (x, y) ->
    b = new Sprite
    drawon b
    dot black, 30
    dot white, 28
    fd 7
    dot limegreen, 14
    b.clip()
    home()
    drawon window
    b.moveto x, y
    forever ->
        b.turnto lastmouse
makeeye -1, 45
ht() 
As usual, reproducing the program and watching it perform was an acceptable strategy. Through the course of this warm-up, we had a chance to review a lot of the mechanics of writing programs, particularly the use of spacing Coffeescript/pencilcode.

Creepy functions and power loops

As a next version, I gave them a suggestion to integrate this code snippet into their earlier program:
for [0...10]    x = random [-200..200]
    y = random [-200..200]
For the most part, they understood what the loop was doing and were comfortable with that piece. However, integrating it with the makeeyes function proved to be a significant challenge and was really helpful for showing that none of the students yet understand the structure of a function. Essentially, no one knew how to run the function again or to run it with new input variables. We stopped the experimenting and talked about the key components of a function:
  1. Name and definition
  2. Input variables
  3. Body
  4. function call: function name and inputs
After this discussion, they seemed to be clearer about how functions work, but we will need to review again at least one more time.

A funny surprise

I showed the students one version I made of the creepy eyes program. Gun was the first to test it out. I encourage you to try it out several times with different input variables. See if you can find the little surprise I included for one of our precocious learners.

Homework

This term, we want each of the students to work on a project of their own. The homework this week is to write out a detailed description of the project they want to develop. As no one had previously thought about potential projects, we gave them the following categories as suggestions:
  • A game: there are many types, including animated games, text-based games, playing against a computer or against a friend, etc
  • An animation or a movie
  • A drawing (for example, an animal or plant they've learned from Ajarn Wachara)
  • A tool to explain some mathematics to the younger students

No comments:

Post a Comment