I know how I feel about computer games. Waste of time, destroyer of social connection, major parental irritant. I disconnect my internet at night so my son can’t use his laptop while I’m sleeping. And yes, he has snuck into my room and tried to get the modem from under my mattress. So why teach students computer science? Because the mindless consumption of games and the intensely mindful coding of games are opposite functions. Writing computer code answers the question, “When are we ever going to use algebra, anyway?” in a concrete manner. If inputs are not algebraically correct, the game doesn’t work. As algebra is a gateway to physics, biology, engineering, accounting, economics—in fact, all of the STEM fields, it is critical that our students gain a clear understanding of how algebra works, as my middle schoolers say, “in the real world”.
The program we use is Bootstrap. Bootstrap uses a modified Python code to teach students algebra while designing their own computer games. We begin with the order of operations. Converting math equations directly into racket code, the students see the importance of getting their code exactly right. Not just so they will get an A, but because their game won’t work. Computer Science has a built-in motivation which worksheets and grades can never match. Our second unit introduces functions, with which my students are already familiar. These functions expand beyond algebra into other datatypes which produce color and pictures. Students select the images they will use in their game. The precise skill of defining values using the correct coding syntax is next. Samples help students practice coding with simple problems. For example, game pieces will disappear off the screen unless the edges of the screen are defined. Students place their background, target, player and danger in the grid. Next, they have to make them move.
This is where the Pythagorean Theorem comes in. How do you know if a your player has captured a target? By determining string-length. That requires a hypotenuse of a pre-determined length, which requires code telling the computer which lengths to use. Boolean types, piecewise functions and modeling scenarios also enter into the mix. Students use a Design Recipe to keep track of their learning. Coding is not only math, it’s also a new language. Careful attention to detail will, in the end, result in a game to be proud of. A game you can load onto your iPhone and play, but not at night. At night your iPhone is under your mattress.
By Meg Glidden
Middle School Math Teacher
7th/8th Grade Science Teacher