Monday, June 29, 2015

Programming class (grade 5 and 6)

Grade 5

Homework
We started out with everyone showing their homework programs (drawing our names in Thai and English) and telling us one thing they really liked about the program and one thing that they found challenging.



Here are a couple of highlights from the discussion

  1. Repurposing commands: Tatia and Chunly both made use of dots instead of drawing explicit curves. This led us to talk about two different approaches: getting a program to implement a known method (e.g., draw your name the way you would move your hand) vs inventing a new method that uses the tools the computer already knows. There are strengths and weaknesses of each approach and the name programs show a mix.
  2. Reusing code: when do you write something new or just use code you have already written? We compared these two programs พิชชี่  and Pitchee. In the first, every component/character of the name is drawn with unique code, even though there are two identical letters (ช) and the vowel _ิ is a subcomponent of _ี. In contrast, the English version has two e's that are drawn with identical code. 
  3. Simultaneity: Jung was the only one (including last year) to have the idea of using multiple turtles to draw different components of her name. This extends the first point of our discussion: doing things with the computer differently than our organic methods. we only touched on this briefly, but it will be good to return to it.


Multiple turtles
Again, we talked about syntax related to hatching multiple turtles. This time, we started with this code:
e = hatch plume.b = hatch redb.fd 100
The puzzle was: why doesn't turtle b (our red one) move? Two possible corrections:

  • change the second line to b = hatch red
  • change the third line to e.b.fd 100

We talked a little about what e.b meant in the second line and whether we would prefer the first correction or the second correction.

For loops
After the homework conversation, I wanted to continue the theme of using repeated code, the idea that the computer will faithfully and precisely repeat the same commands again and again. The idea that this is a major difference between a machine and a person, and to start finding ways to make use of that.  Naturally, looping provides a key example.

To start, we wanted to get the mechanics right with a simple square:
pen blue
for [1..4]
  fd 100
  rt 90
Even doing this, there are a lot of little details to discuss:

  • what is this funny punctuation: "[" ".." and "]"
  • why do the third and fourth lines have to be indented? what if they aren't?
  • the different views between code and blocks. This is one case where the blocks really work nicely to show the commands captured by the loop

After this, we did several experiments:

  1. adding a new command to the loop (for example, making a dot at each vertex)
  2. changing into a triangle instead of a square
  3. modifying the size of the shape
  4. moving commands into and out of the loop

Possibilities for next time
There were many ideas I'd prepared for class that we didn't have time to cover:
Homework
The challenge this week is to draw a 2 color yin-yang like in the center of the Korean flag. This is mostly an exercise in understanding arcs, but let's see if anyone uses a for loop or multiple turtles!

Grade 6

Debugging
I wanted to continue some of the if and or ideas from last time. In addition, all of the students have been a bit stuck on their projects because they are having trouble understanding code examples from other people's programs. I thought that some debugging work would be helpful for both of these.

Challenge 1: This program (from last week) has an error: TurtleRace. What is wrong? How can we investigate?

Since we had seen a complete example of this program last time, everyone understood that turtle boongie was not making the dots that were intended.

We explored several strategies to investigate why this was happening:

  1. comment out lines of code using # or sections of code using ###: This let's us investigate whether a particular code is causing a problem, not doing what we intend, or simply not doing anything. For example, in our turtle race program. commenting out line 30 does not change the output. That tells us something is wrong.
  2. Add test code that has a function we clearly understand. In particular, for conditional statements, we can add code that helps us verify whether the conditions are being treated the way we want. In this case, we could have added a new drawing command at line 31 or a write to give us a message.
  3. reduce the number of iterations and trace line by line: this is a brute force approach. 

The error in this program is subtle and an example of something that often happens: we have a slight error, but the overall line of code looks familiar, so it makes it harder to spot the problem.

Challenge 2: My program doesn't work properly: FactorGameWindows.
  1. How do the windows move and how does the program make them stay along one line?
  2. What doesn't work properly?
  3. Can we fix it?


This is a much more complicated challenge, partly because the code is more complex, but also because the program itself is less familiar. However, investigating this program was part of the homework for both Titus and Win, so really this challenge amounted to working on the homework together.

Some of the earlier techniques for debugging came back into play. In particular, Win experimented by commenting out code and seeing the effect.

Projects:
Challenge 2 amounted to project work for Titus and Win. For the other two, we had private conversations about
- The program Sounds with Boongie
- Correction to bomb program for Gun

Homework
- Titus: (same as last week) make a rocket that moves side to side
- Win: (same as last week) make a care that moves side to side
- Gan: combine the bomb code with the target+points programs to complete his project
- Boongie: get more sound-file links from

Saturday, June 27, 2015

Math pictures

We adopted a warm-up activity from Mathematics Mastery that the kids have really enjoyed. We look at interesting pictures and make mathematical comments.

The MM team developed a series of great cartoon pictures based around various fairy tales where the pictures link naturally with particular lessons.

As substitutes, I've found some publicly available pictures to use at home. Naturally, these won't necessarily link with a particular lesson, but there is always something interesting to discuss. If you find others you like, let me know in the comments, please!

How do we use these pictures
The point is to use the pictures as triggers for the students to say full sentences or questions with some math content. There is no real limit or bound on what is allowed. Here are some examples of the typical types of comments (taken from actual conversations):

  • I see 3 flowers.
  • There are more people than chairs.
  • The windows are rectangle shapes.
  • Half of the plates are empty.
  • The stars are arranged like 5 dots on a dice.
  • This tree is smaller than this tree (pointing at the picture).
  • The dog is in front of the horse.
  • The bricks on the path make a 3x4 array.

As you can see, this is mostly about shape and number.

Examples from the web
Symphony orchestra, from http://metropolitanchamberorchestra.com/


Floating market from http://morenus.org/carlyn/thailand/floatingmarket3.jpg


Family room, from http://www.featurepics.com/online/Room-Interior-1311236.aspx


Hello Kitty Bakery from http://topbestappsforkids.com/best-kids-apps-hellokitty/

Coral reef scene from http://thumbs.dreamstime.com/z/coral-reef-illustration-children-happy-colorful-31303749.jpg



Other ideas
Without a picture, you can do a similar activity around your house.  The number scavenger hunt was suggested at Kid's Quadrant.  Go take a look: here!

Thursday, June 25, 2015

A cheating friend (or funny dice)

who: J1 and J2
when: at dinner

The basic puzzle

In class recently, we've been using a warm-up puzzle where we tell the students we have two secret numbers and give them two clues: the sum of the numbers and their difference. The challenge is to find the two secret numbers.

This is a simple algebra problem that can also be attacked easily by guess-and-check (for small values) or by a systematic table of trials. These are the methods being used by the 2nd and 3rd graders, so the puzzles result in a lot of arithmetic practice as well as reinforcing different number bonds.

Our twist

Over dinner, I told the kids that a friend gave me a similar puzzle, but with a slight twist. This friend rolled a 6-sided dice twice and told me the sum and the difference of the values. Sounds the same, but easier, right...?

Unfortunately, our friends are all a bit tricky.
First clues
So, the first clues my friend gave me were that her two numbers sum to 12 and have a difference of 4. The two talked through these clues and found the answer (which I'll leave to you).

But wait: these were supposed to come from dice throws!?

Second clues
I told them that I'd gotten the same conclusion and had challenged my friend. When confronted with this result, the friend said, "oh, there was a mistake. Actually, the difference was 12 and the sum was 4."

After a minute, but before finding a solution, the J2 realized that there was something fishy about this one, two. How can two dice rolls have a difference of 12?!!

Are there two numbers that fit the clues, even if they aren't from dice rolls? Yes, J1 and J2 found them.

Third clues
So, the friend was tricking us again. So what were the actual values? This time, the friend claimed that the sum is 7 and the difference is 2.

At this point, both were highly suspicious, but also very curious to see what would go wrong. This time, they made a table with number bonds of 7 and the differences. It looked something like this:
7+0 = 7        7-0 = 7
6+1 = 76-1 = 5
5+2 = 75-2 = 3
4+3 = 74-3 = 1

At this point, they noticed a troubling pattern in the differences: always odd. J2 suggested adding another line to the table:
7+0 = 7        7-0 = 7
6+1 = 76-1 = 5
5+2 = 75-2 = 3
4+3 = 74-3 = 1
3.5+3.5 = 73.5-3.5 = 0
Ah, now we've got an even value! From there, it took another couple of minutes to find the combination of numbers that add to 7 and have a difference of 2.

Final answer, Final puzzle
Once again, the friend seems to be tricking us: these numbers aren't on a regulation 1 to 6 die either! It was time for the final revelation: actually, all of these were from my friend's dice throws, but they just had very strangely marked dice.

Looking over our work, we saw that we had only come up with 5 different numbers as answers in our puzzles. We confirmed that, yes, the dice was 6 sided, so what was the value of the last side?

This was the last clue from the friend: the average value of the faces on her die is the same as the average value for a regular die.

So, how are the sides of my friend's die marked?

Wednesday, June 24, 2015

Deep Tic-Tac-Toe and tangram initials (1-3rd grade math games)

Note: we did 1st and 2nd grades in parallel this week.

First Grade

Warm-up

Our simple warm-up this week was a little before/after game with the days of the week and the months of the year. Starting out, we had a little discussion (debate) about what day it was (Tuesday, at the time). Then, what came immediately before and what came immediately after?

For months, no one was quite sure of the current month, so we talked about that for a moment, then talked about which months would be coming up. We should keep repeating and integrating into some other games so the students can get more comfortable with the sequence of months.

Clap and pat patterns

Moving on from the warm-up, I asked if they could guess some clapping patterns, where I would either clap my hands or pat my lap. Too easy, they both exclaimed. Okay . . .
Pattern 1: I clap 5 times and then ask them what comes next.  More claps! (admittedly, this was easy)
Pattern 2: Alternate clapping and patting (C-P-C-P-C-P) and then what comes next. Again, pretty easy for them to continue C-P-C-P. It was actually a step trickier for them to continue if I ended my sequence on a clap (so their continuation goes P-C-P-C etc)
Pattern 3: Same deal, but pattern is C-P-P- C- P-P etc. At this point, they were clapping and patting along with me to make sense of the patterns.
Pattern 4: C CP CPP CPPP CPPPP CPPPPP etc. Now, here's where it got complicated! We did this one several times.

Next time, we will do these patterns visually as well as aurally.

Tic-tac-toe Game

We played a couple rounds of classic tic-tac-toe (also called X-O here in Thailand). As we played, I asked them questions about what they noticed:

  • how many spaces are there on the game board?
  • how many lines do we draw to get those spaces?
  • What shapes are the spaces?
  • When we draw the board in the usual/lazy way (2 horizontal lines, 2 vertical) do all the spaces have the same number of border edges?
  • If we made more lines, how many spaces would we get?
  • At the end of the game, how many Xs and Os are there? Is it the same number for both?
  • Do they prefer to go first or second?
We had several reasons for playing. The first is to encourage their habits of noticing and wondering. Even in such a simple game, there are a lot of mathematical things they can see and talk about. Our second reason is to prepare for the huge number of tic-tac-toe variations that we can play with number recognition, arithmetic operations, and more involved strategy.

A colorful pattern

We continued our exploration of the 100 board and the bead abacus with a coloring activity. This time, we wanted to color the even numbers (multiples of 2) and not color the odd numbers. For both of the kids, though, they preferred to use different colors for the two types of numbers rather than leave anything entirely plain. As they worked on each new number, they used a 100 bead abacus to figure out whether the number was an even or an odd.

Before beginning the activity, I asked if they had a guess about what pattern would result at the end. There seemed to be a consensus that we would get a checkerboard pattern. After working for a while on the first row, though, one student suddenly had the idea that the evens and odds would be in alternating columns. An interesting conjecture!

I promise pictures of the results next week.

Homework

Play X-O 3 times with a parent or older sibling and finish coloring their 100 boards.

Second and Third Grade

Warm-up

We used a warm-up game similar to last week. When someone has two secret numbers, can we figure out their values if we know the sum and the difference?

Tangram intro

In class, we worked on classic tangram rabbit and fox outlines. This was a really good exercise in paying attention to detail. For most of the class, students would claim to have a solution and we would point out something in their outline that didn't match the target (for example, a horizontal line where it should be on a diagonal or vice versa).

As with tic-tac-toe for the 1st graders, there is a lot to notice and wonder about in the simple tangram puzzles. For example:
  • How many pieces are there? What are the shapes, what are the sizes?
  • If we are using only some of the pieces, can we make the same shape in different ways? Trying to make different types of right isosceles triangles is one version of this.
  • Which edges match exactly?
  • What angles can we match up?

Homework

Make their initials with the 7 piece tangram. As many versions as possible and, if they want, try out other letters/other shapes.

Class notes (grades 5 and 6 programming)

Fifth Grade

Ideas and questions from homework

  1. How do we make multiple turtles? This was actually the second exercise I planned for the day, so we reserved it for later in the session.
  2. What does dot() mean, compared with dot green, for example?
  3. Why were all three of the dots in our exercise different colors?
  4. How can we change the color of the background? For example, pink?

Background: make it big!
We started with the last question. I asked the group if they could come up with ways of doing this. The first idea was to try typing a command "background." In pencilcode, that doesn't work as this function isn't defined so they got an error message. I suggested that they already know commands they could use and then gave them more time. Shortly after that, each came up with a variation, using either dot or box to draw a very large shape of the right color.

Note: I have since noticed that background is a function in processing.JS, used in Khan Academy. I wonder if that was the source of this idea?

Dotty dots
We tackled questions 2 and 3 together. In a fairly quick discussion, the students explained to each other than dot <color> makes a dot of that color and "lightgray" is different from "gray." That left dot() a little bit unclear.

P and I explained that the parentheses told pencilcode that we had just entered a command (or function.) We had already seen another example of this with home(). Usually we would have to tell dot a color and a size. However, the system seems to have built-in defaults in case we call the command without giving extra parameters.

We explored a couple of other commands we know, fd and rt to see if they also had built in defaults and found that they do! fd()  is equivalent to fd 100 and rt() is the same as rt 90.

We also talked about which version is easier to understand and everyone was clear that it was easier to understand if we made the parameters explicit.

The Plum triangle redux
A fairly short discussion that the plum triangle was an artifact of the fact that we could only move by whole pixels, so any irrational distance can only be approximated. We all agreed that this was fine, but needs to be handled carefully in two cases:

  • If we suddenly make our drawings much larger, then the approximations may be visible and need adjustment
  • If we have a series of approximate moves, then the little errors might accumulate. One habit is to return the turtle to the origin using home() between drawing different elements of a complicated drawing.

Hatching new turtles
Falling in perfectly with my plans, the kids wanted a reminder about how to create new turtles. One student hadn't seen this before, but the others quickly remembered something like
e = hatch 'yellow'
e = rt 90
We corrected the second line to e.rt 90 and talked about the syntax (hatch creates a new turtle wearing the indicated color, e =  gives it a name, e. is how you tell the turtle e that there is a command for it to execute.
As a challenge, we got them to draw a square with the old turtle and a triangle with the new one.

Homework
The homework this week is for everyone to draw their names in Thai and English.
Last year, I had created 5 different programs that drew my name and/or animated it in different ways. Unfortunately, 2 of those seem to be broken, so I also have homework this week!

Sixth Grade

Trying to be logical
After the discussion last week, we saw that we would need to spend more time on while and logical conditions (if, and, or).  This time, I gave them sample code (you can play here):


I asked them to just focus on the gun turtle and to figure out what it does. Most of the action is in lines 22-24.
Ultimately, this led to a discussion of how many dots it would draw. We got 2 votes for 5 dots and 2 votes for 10. In the end, we created code to cover that part of the program and saw the turtle actually draws 6, so we needed to do some work to figure out why.

We stepped through the while loop and checked to see what was happening each stage.

Before moving on, we tried changing line 21 so that innerLoop would iterations from 1 to 100. Would that change turtle gun's output? Why or why not?

Projects
There was very limited progress on the projects this week. As a result, most of the homework assignments were the same, but with some extra guidance:

  • Titus and Win: look at this example program to see if you can figure out a way to get your game characters to follow the mouse, but to stay on a fixed horizontal line.
  • Boongie: look at this Thai flag program to see how to play sound files you find on the web
  • Gun: figure out a way to integrate bombs into your game


Here is Gun's progress so far:

Sunday, June 21, 2015

Triangles and Angles: a proof for 5 year olds

who: J2 (also P and J0)
what did we use: polydrons, polydron protractor

J2 and I were playing with polydrons and he got interested in measuring the various angles. Since there are three different triangles in the set, he got to test each of them and found that the angle sum was always 180 degrees. We went on to examine squares and pentagons to see what he could make of those.

In the evening, P and I were talking about about this investigation and I mentioned this proof that the interior angles of a polygon sum to $180 \times (n-2)$:



P was surprised and said that she likes this proof more:
In this version, you have to subtract the middle 360 degrees.

I was a bit surprised that I hadn't ever thought of this version or seen it elsewhere, but quickly realized we could repurpose it to finding the interior angles of a triangle itself.  Here's the picture:

Now, the argument:
  1. Angles of the large triangle are equal to the sum of the angles of the smaller triangles - 360
  2. Let x be the sum of interior angles of a triangle.
  3. Based on 1, we have x = 3x - 360
  4. Rearranging, we get x = 180.

Where we get stuck: a challenge for you

Here's the thing: the sum of interior angle measures of a triangle isn't 180 degrees. That is, it doesn't have to be if you are working in non-euclidean geometry. Here's a nice picture (not mine) of a triangle with angle sum of 270 degrees:

Comes from MathStackExchange



However, our proof doesn't seem to use any fancy postulates. Your challenge, why doesn't it work on a sphere? What extra postulate did we secretly use?

A side point about measurement

When my son was measuring the angles for an isosceles right triangle, he read 46 degrees off the protractor. I was too focused on getting to the punchline about all triangles having the same angle sum and I "corrected" the measurement to 45 degrees. He still said some things and we had a conversation about ideal mathematics and real measurement, but I felt it was a missed opportunity.

Seasonal math and dice, dice, dice

who: J1, J2, J3
what did we use: mangosteen(!), dice, a checkers set.

Queen of mathematical fruits

My condolences to everyone outside of Thailand, you are current missing some delicious pre-school math: Mangosteen!

The mathematical secrete is on the bottom of the fruit. The flower shape on the bottom has petals that correspond to sections of the fruit inside. This one will have 7 sections


Just to trick you, this is a view from a different one, with 6 fruit sections.

J3 has been having a lot of fun counting the "flower" petals, opening the fruit, then counting the segments to check.

J2 has been using these to practice subitizing (recognizing number groups without counting them). J1 has just been gobbling down the mangosteen.

Dice Games

A dotty dice puzzle
In school for the 2nd and 3rd grades, we introduced a tic-tac-toe variation using dice where the winner is the first player to make a straight line that is a multiple of 5 (more notes here). For homework, the kids played this game with other multiples, in our case 6. During one game with J1, there was an interesting scenario that I saved to discuss with J2. The board has the numbers as marked and the player has just rolled a 4. Where should you play (you can add 4 to any cell of the grid, remember that you don't want your opponent to be able to make a multiple of 6 on their turn):


Race to 20
For J3, we modified one of the games that we had played in the 1st grade class last week. In this game, two players race to be the first to 20 on a 100 board. In this version, both player has a token/marker of their own. For each move, the players roll 2 dice and choose which value to move, then count up their position on the board. First player to 20 or more wins.

The strategy here is very simple, but it was a good game for J3 to start learning about dice and the 100 board. Once she got the point of the strategy, though, she had her own idea:"I'm going to add both dice together and move that amount!"

Snakes and Ladders experiment
J1 and I tried an experiment with snakes and ladders: a race between two different teams.
Team 1: a single marker that has to move according to the roll of one hexahedral die.
Team 2: two markers, the player can choose which one to move on each turn.
The winner is the player who gets a marker to 100.

Which team has an advantage? How big is that advantage? What if you play so that the winning marker has to land exactly on 100 (otherwise bounces back)?

Knights Move

SolveMyMaths recently tweeted about Knights Move (aka Razzle Dazzle.) Since we are always looking out for more/new games to play, it sounded interesting. Also, we could repurpose existing material to play. The game is a cross between chess and basketball. Below, see J1's set-up:


Yes, we are using icosahedral dice as the balls. Also, the chess pieces on the side are spectators, they aren't part of the action (since this is played on a 7x8 board).

One of the most interesting parts was our ability to experiment with rules. Since we didn't have a definitive version, we felt free to try slight modifications. In particular, we experimented with:

  • Passing: allowing multiple (chain) passes or just a single pass on a turn.
  • Defense: moving into the 8 squares around the ball holder forces them to pass on their turn
  • back-and-forth passes: player who passed the ball has to move again before they can receive the ball (we turned the checkers upside down to indicate they couldn't receive a pass).