Monday, February 23, 2015

Send me a message and projects 3 (programming class 17)

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

Reminder, this is our standard lesson plan for the rest of the term:
  1. New or review concepts
  2. Exercises related to the projects
  3. Project work

New/Review

Today, we had three new concepts: while loops, objects, and message passing. This was clearly too much for everyone to understand everything, so I focused on the while loops. My reason for introducing the other ideas and short programs was to give Titus some tools for his project.
These exercises and discussions were based on these two programs from the pencilcode guide:
While
Talking about while gave a natural opportunity to talk about for again. We had two segments to the conversation, first comparing while vs for, then deciding which is best for different scenarios.
  • Do you know how many iterations you want, before you start to loop? If so, use a for loop, if not, while.
  • Eating: while hungry, eat. If you use a for loop, you may either still be hungry or explode!
  • brushing teeth: while mouth feels dirty, brush your teeth.
  • Putting on socks: for [1..2] put on a sock
  • Cleaning vegetables for stir fry: while veggie bowl has food, clean and chop veggies
  • Adding eggs to a cake: for [1..numEggs], crack an egg and add it to your wet ingredients
  • etc 
This was a really good conversation as each kid had a chance to think about the funny outcome if you used a for when while was more sensible.

Shared Memory
We didn't talk extensively about the concept of an object. Like while/for, objects would pair naturally with arrays, but we also haven't talked a lot about them. For now, the kids should understand that the object is something like a chest of drawers with the drawers given their own names.

As our exercise, we extended the pencilcode guide program to use a button and add an extra value to create this program where the turtle's angle of rotation is entered through the input boxes and the distance moved each step is increased by the button:

Message Passing
Like shared memory,we didn't spend a lot of time on this new concept. However, inspired by Kan wondering why the program stopped responding to his button clicks, we slightly modified the guide program to use a while loop instead of the for loop. Our version is here.

Project exercises

Next week, I will focus the practice/exercises/review on concepts we've learned that are being used in the projects.

Projects and homework

As a reminder, I have stored copies of their work up to the start of today's class in this folder: Project Directory. The homework this week:
  • Kan: finish drawing his maze. Next module is to decide what penalty he wants when the turtle runs into the wall. This is the same assignment as last week. Unfortunately, he overwrote his maze drawing program sometime during the week.
  • Boongie. implement the penalty when the turtle runs into the wall, the turtle bounces back to a previous shell in the maze. There are several ways to do this and I'm curious to see his approach.
  • Win: create functions to ask subtraction, multiplication, and division questions. Another area to think about are gradations in how hard the questions are.
  • Titus: Use the shared memory and message passing code ideas we learned about today to check to see if the player chooses a match.

No comments:

Post a Comment