Memory Game

By Lillian Bozeman, 11 January, 2023

My trusty For loop is my pride and joy. The For loop is a programming statement that I love so much. It lets you go through items in a list or repeat an action a few times.

for (let i = 0; i < cards.length; i++) { 

I used this beautiful For loop in everything I built in many years of computer classes. It never let me down. This loop was my hammer and every problem was a nail.

The final assignment for my AP computer science class specifically required that a For loop was used. Since my beloved For loop has been in everything I have made before, I assumed that it would exist in everything I make. As to what kind of game to create, I was drawn to the classics: tic tac toe, rock paper scissors. I decided on a childhood favorite, the memory game.  I ferociously began to code a memory game. Using my magical keys to create functionality that had only existed in my head prior. The game was developed swiftly with beautiful solutions to every problem I faced. I thought I was at completion. I checked the requirements one last time. The For loop! My trusty, beautiful, elegant, beloved For loop had not appeared in the code! I scanned the memory game for places to insert this really useful statement, but alas there was simply no need for it.  Stricken with fear and being unable to see the light at the end of the tunnel, I went to my dad for advice. Immediately he thought of a hint to help you find the matching card when the card’s match proved elusive.  Filled with excitement and a feeling of new promise, I got to work even faster than before. Making sure to have a For loop in the code. The cute, little hint, lit up the matching card to the card you have face up on the screen. Once more, I checked the requirements before submitting. I have my precious For loop! …. Or did I? I started out with my dainty For loop, but whilst developing the hint into completion I found a better way of looping and abandoned my sweet loop for the more robust calling of functions. OH NO!

My flabbergasted self went again to my dad for help. He had the brilliant idea to deal the cards onto the screen at startup. That’s it! I got to work speedily because the deadline was quickly approaching. Before I realized it, it was 2 hours away from the deadline and I had made barely any progress.  Frazzled, but determined, I wrote the loop animation like I was a leaf on the wind. That elusive For loop is finally in the code! I am looking at it! It is there! I happily submitted the assignment and got a high grade for it. My trusty For loop and I prevailed once more.

I loved making that memory game so much and I didn’t want to loose it once the class was over. The class used an online javascript-like platform and when the year ends my much loved memory game would vanish. My dad had the best idea to put it on my original, artisanal, hand crafted html website. So I did! I converted the code from their “javascript” to vanilla javascript and inserted it onto my site. Later on, I converted my website to Drupal. So I made my memory game into a Drupal module. Now it lives happily once again. That memory game is honestly my most favorite thing on my website.