Pages

Monday, April 13, 2015

How Binary Code works: a visual example

The older boys have done enough programming that they kind of understand the idea of binary code, and we also talked about it a bit with switches during our electricity unit. But I liked this activity (instructions here) for its very clear illustration of that binary on/off 1/0 dichotomy.

The idea is that you draw a picture, then superimpose it on graph paper. If the picture fills more than 50% of a given box in the grid, you put a "1" in that box. If it fills less than 50%, you put a "0."

Then you read off your grid numbers out loud, while the students recreate your drawing by filling in a box when you say "1" and leaving the box empty when you say "0."
A simple airplane picture looks like this in the grid.
It's a really obvious way to show how smaller pixels make a clearer picture, too. Above you can see the various iterations of a picture of a bunny. The original picture is on the left in pink. When you re-create it in binary with a large grid, you get the not-very-good blue bunny in the middle. But with a smaller grid (smaller pixels) you get the more-accurate grey bunny on the right.

No comments:

Post a Comment