Wednesday, June 10, 2015

Sunburst and guessing (5th and 6th grade programming)

Who: Baan PathomTham 5th and 6th grades
Where: at school
When: Monday morning

Fifth Grade

Note: My original intention was to focus on discussing the homework and making some extensions. Because one student wasn't in school and I had especially wanted to use her code, we changed plan slightly.

Other interesting code
Between classes, the students spent a lot of time exploring code they found from other people. I started by asking whether they saw anything that was interesting and they wanted to understand better. There was a quick response, focusing on two programs:

  1. The jump command in this sun: http://jung.pencilcode.net/home/sun
  2. How to make new turtles, like in this chasing game: http://tatia512.pencilcode.net/home/otherpeople/Chase1

These were really great questions and gave us two interesting examples of how to understand code that we find.

Jump (jump, jump)
Basically, I walked the student through the process I follow for understanding a new command: play with it, test it, put it in a bunch of different situations, and see what happens. We created new files (mostly with names like jumpPlay) and then started adding jump commands. It quickly became clear that we needed something to help us see what was happening, where the turtle was jumping from and to, so we started adding dot between the jump commands.

I asked them to keep playing and testing until they thought they understood jump.  While waiting, I wrote a little code with some jump lines and, for a twist, an rt 90 in between. When they said they understood, I asked them to guess what my code would do. The effect of changing the turtle's direction surprised everyone, but soon they had a new explanation.

We wrapped up this section by briefly discussing a picture of grid coordinates, but this will have to be continued next session.

Hatch
The chase game uses 3 turtles, so how do we create the extra 2? I pointed out the hatch command and then we followed some of the same steps as for jump. We didn't have time for me to do a challenge program to test their understanding, but we can include that in the next session as well.

Context
Both jump and the chase program illustrate the importance of context to understanding the code. In the case of jump, copying an isolated line from the sun program will still create sensible code, but it might not do the same thing if the turtle isn't starting in the same location or pointing in the same direction. For the chase program, though, there are many lines of code that simply can't be interpreted if taken out of context. For example, line 15:
e.jumpto -250,-100
Because this requires an object e, it has to be preceded with code that defines or creates that object.

Homework
For homework, I asked the students to notice and wonder about any interesting code they find. In addition, I wanted them to try to create the pictures on the left hand side of this set of exercises:

Sixth Grade

Guest Teacher
For sixth grade, we had a guest teacher: Win. They are currently trying to solve a problem that he attacked in his project from last term, so I asked him to talk about his prior solution. In that case, he had two loops running, one for loop to ask many calculation questions and an inner while loop to give the student several chances to get the right answer. In our case, we are currently working on improving our guessing games so that the player has multiple chances to guess.

A musical interruption
As Grade 5 had found, there is a lot of interesting code out there. Several students had found a snippet of music playing code and wanted to investigate. I have to admit I didn't handle this unexpected interest as well as I had for the earlier class. I will craft an exercise related to ABC notation and the play command for next class.

homework
Since I want to build on the guessing game, we need to finish that code. Homework this week is to add the right components so that the basic guessing game is complete:

  • a random number is chosen
  • the player gets several chances to guess the number
  • after each guess, they get feedback on whether their guess was too high or too low (if it wasn't correct)
The part that is currently challenging is to create a loop that will allow multiple chances.

No comments:

Post a Comment