Last week I introduced a while loop to my cryptography class, and it was used for the first attempt at encryption (a simple reverse cipher). Since this is such a crucial concept, and absolutely vital to further and unavoidably more complex algorithms to come, I wanted to reinforce it with a hands-on activity.
The While Loop Game
Game is a misnomer, but it got their attention and they didn't complain, so it worked this time!
I created some paper cards, and also an electronic version of the game. Actually only round 1 exists on paper so far. Round 2 has to be on the computer.
Everything is in this file, electronic game and paper game to print and cut up:
How to Play
The While Loop Game involves constructing a while loop by arranging cards, either physically or on the computer. Here is how to play:
- The paper is the programming editor. The solid line represents the left margin. The dotted line represents a 4-space indent.
- With your partner, arrange the cards to make a working while loop. You won't need all the cards. Partners must explain their ideas and run through the loop together to make sure they agree how it works.
- Write the output of your program, in order, into the output box.
- Check your answers to see if you won.
The Outcome
The game went very well, and really improved the confidence of some of the teams (they worked in pairs). Of the 12 pairs of students, three could build a working while loop without any comments from me, and the rest could do it with just a little help here and there. In the more difficult round two, only one team could get it unaided, but several followed after a few hints. Only one team was still far away from the solution when I revealed the answers.
Actually several teams pro-actively started typing their programs into codeskulptor to check them, which I hadn't expected, and was nice to see.
No comments:
Post a Comment