## Monday, March 25, 2013

### Passive Agressive Magic Roses Explain Binary

This week the two older kids (10 and 6 ) and I are reading a really amazing book, Computational Fairy Tales by Jeremy Kubica. It's \$3.03 on the Kindle, so it doesn't exactly break the bank.
The entire book presents programming concepts using little stories about a medieval kingdom and a girl who needs to finish a quest.
I love this book because it does a great job of presenting the logic of programming, and programming concepts -- so far we've read about boolean logic (AND, OR, and NOT), loops, if-else statements, algorithms, binary, variables, variable names, and so forth. Each section introduces an idea and uses a humorous story to illustrate it.
My 6 year old really liked the story for binary, which involved some magical roses with the passive-aggressive tendency to turn blue when they hadn't had any rain. Only they didn't all turn blue. They had an algorithm for turning blue as the days passed, which just happened to show the number of days. In binary!
In order to really help her understand, I made up a little craft today to play passive-aggressive roses with her.

I cut out five strips of paper and fitted them to a paper towel tube. Basically, make them long enough to go all the way around, with a small overlap.
Then, I marked each one with a column: 1s, 2s, 4s, 8s, 16s, and The Girl drew a blue flower and a red flower for each strip.
I taped each strip to the paper towel tube so that the column names would stick up like tabs and the paper strips would easily slide around the tube.
Just like this. Make sure the 16s are on the left, counting down to the 1s column all the way on the right.
They also put a pink wizards hat on Gandalf (they lost the grey one) so we could have someone play the part of Marcus the magician who owns the roses.

After a night of rain, all the roses are red. Red stands for 0 or off or false, or whatever. We'll call it 0, since we're talking binary here. Each column with a red flower gets a zero. All zeros add up to 0. So it's been 0 days of no rain.

The next day, the first flower turns blue, because it didn't rain. So the ones column gets a 1, and 1 of the ones equals 1. 1 day since it rained.
It doesn't rain again. So the ones flower flips again. The flower on his left always flips colors when the flower to his right flips to red (AND ONLY RED). So the second flower flips, and the other flowers to his left don't. 1 in the twos column plus 0 in the ones column equals 2.
And again, the ones flower flips, but since it flipped to blue, the twos flower stays blue. 1 two plus 1 one equals 3.
And still no rain! Poor flowers. The ones flower flips to red, which makes the twos flower flip, too. The twos flower flipped to red, so the fours flower flips! 1 four plus 0 twos plus 0 ones equals 4.
Keep on going, to see five.
Six.
And two days later, eight! Which is a really fun one, of course.

Something tells me she'll remember binary numbers. :)