Remembering Recursive Procedures

Sanjana Shah, Girls Innovate! Teen Committee
ThinkImagineProgram (Session 4)

“Believe you can and you’re halfway there.” – Theodore Roosevelt

We have completed half of the sessions of ThinkImagineProgram and there is still so much more for us to learn. We started the session on how to represent arrays using activities that we did in the previous sessions like Tic-Tac-Toe, 4-in-a-Row, and Deck of Cards. This was followed by a Memory Game, which the girls played in groups of three. The objective of this game was to collect the greatest number of matching pairs. Over the course of the game, it became obvious as to where the cards were located. Participants with good memory were able to remember where they had already seen its pair. Two girls played against each other. The third girl was supposed to act as the computer or a person with perfect memory. She was allowed to take notes on a 4 x 6 grid to remember where these alphabets appeared on the screen. We discussed on how it would be very inefficient if the memory game was a 10,000 x 10,000 grid. After that, we went through an example of a game of Magic Squares, where 9 numbers were represented in a 3×3, and any 3 numbers in a row had the total value of 15.

Before the break, the participants were introduced to the concept of procedures via Lightbot, a programming game where the participants guide a robot to light up blue squares. With procedures, we can use a set of commands multiple times and see how the command, once complete, returned back from procedure to the main block. This game was played up to level 2. We will continue with more levels in the upcoming session. We then revisited loops, if-else conditions, nesting, and stressed on the importance of indentation in reading the code.

Gradually, we moved on to recursion through 8 Queens Problem, where eight queens were supposed to be put on a chessboard so that no queen takes another queen, knowing the fact that a queen can move diagonally, horizontally or vertically. This game got divided into 2 groups. The first group was called the ‘guessing’ group, those who just wanted to keep moving the queens around in an ad-hoc way, until they got the answer. The other group was called the ‘thinking’ group, who planned and followed an algorithm, similar to what the computer would do. Four girls, including me, decided to take the algorithm path. Rest of the 17 girls decided to do the ad-hoc way. There were around 4 moms, who also decided to do this problem using the ad-hoc way. We were given around 5-10 minutes and one could easily see the girls using erasers and backtracking to finish the game. Three girls were done within the time allocated. It was fun to see how the girls were so eager to solve this problem. Some of them even said that they wanted to go home to finish up this problem before doing anything else.

In the upcoming sessions, we will focus on data representation, and answer more questions that have been unanswered in the past sessions. There would also be final presentations that the girls would be doing on anything that they learned in ThinkImagineProgram or they can come up with their own creations, like a game represented in a 2-dimensional grid or something similar. We are all ready to work together as a group, applying all our thinking and imagining strategies to program!

Leave a Comment

Your email address will not be published. Required fields are marked *