Education Technology

## Middle School Math Meets Python Game Design

Posted 01/27/2023 by Becky Byer (@bb31415)

It’s that time again … a new calendar year, resolutions and new goals, right? What do you want to improve in your class, or do differently?

How often have you lesson planned and asked yourself, “How can I provide enrichment for this student, remediation for that student and continue to grow everyone mathematically?” How many standards need to be covered this year? How many standards need filled in from last year? How can students practice mathematical fluency in a meaningful and engaging manner?

How about incorporating some Python coding in the classroom, to achieve all those goals? My students are always interested in adding some game play to the content! If you’ve never coded before, don’t let that stop you — keep reading. Let me share some pre-built middle school activities to bring coding fun to your classroom.

Don’t let the label “middle school math” mislead you. High school students can benefit from these activities as well. But the “middle school math” audience means they have been scaffolded to make them accessible to younger audiences.

If someone asked you, what are the top four or five concepts students really need from middle school to be successful in high school math, what would you say? Go ahead … think about it.

Did numerical fluency make your list?

If students don’t understand -2 + 5 is 3, how will they understand -2x + 5x = 3x?

Isn’t factoring x2 - 3x - 10 easier if students know -5*2 = -10 and -5 + 2 = -3?

Let me challenge you to a round of Integer Darts!

Here’s how we’ll play: I give you five random problems that involve integer addition, subtraction, multiplication and/or division. You’ll earn a dart for each correct answer. Toss your earned darts and get a score. Can you earn at least 8 points?

Ok, sounds like fun practice, but isn’t that a lot of coding? No, it’s not! Because this activity is scaffolded. You’ll give students the base code in a premade TI-Nspire™ CX II file or TI-84 Plus CE Python file. Students will write 12 lines of code to generate the random problems. If you choose, students will use the Pythagorean theorem and write seven more lines to calculate the code. Haven’t taught Pythagorean theorem yet? Give your students the second premade file that already has scoring coded.

Want to a play a round? For complete activity, check out the TI-84 Plus CE Python or TI-Nspire™ CX II graphing calculator pages.

Did fractions make your top 5 list?

Doesn’t middle school 2/3+1/4 provide foundations for 2/3x+1/4y?

How about playing Fraction Tic-Tac-Toe while simultaneously practicing adding, subtracting, multiplying and dividing fractions?

Here’s the classic game with a twist. The calculator always gets to place an O each round. The student places an X only if they answer a fraction problem correctly.

No previous coding necessary. The TI-84 Plus CE Python and TI-Nspire™ CX II activities come with templates that have large sections of the project pre-coded. Students will add just twelve lines of code.

Only want to generate addition and subtraction problems? The teacher notes tell you how to make this restriction. Some students are ready for both positive and negative fractions, others might want to stick to positives. The teacher notes explain how to make these restrictions as well.

For the full activities, visit the TI-84 Plus CE Python or TI-Nspire™ CX II graphing calculator pages.

So far, we’ve looked at operations with integers and fractions. What are some other key middle school concepts?
1. Integers
2. Fractions
3. ?
4. ?

Students develop skills through middle and high school to solve single-variable equations. How do students progress through various levels of equations?

They might start with one-step equations in the form: x + a = b    x – a = b    ax = b    x/a = b

Initially, they solve with counting numbers, then progress to integer and rational numbers.

How about two-step equations such as: ax + b = c    x/a + b = c    (x+a)/b = c

Again, these initially could be counting numbers, then rational and integers.

How about a round of Equation Frisbee Golf?

This project has differentiation written all over it. The project in its entirety covers eight “types of equations:”

1. x + a = b    x – a = b
2. a + x = b
3. ax = b
4. x/a = b
5. ax +b = c
6. a(x + b) = c
7. x/a + b = c
8. (x + a)/b = c

The teacher notes are written for rational numbers but give directions for restricting to integers. Students may stop coding after any “equation” type. You might even choose to code types 1 and 2 at the beginning of the year, then add the various types as the year evolves. The game runs similar to the previously mentioned game. Students are given five random equations to solve. Each correct answer results in an additional frisbee to toss at a goal. Again, the majority of the code has been written in a template. To code only the first “type” takes five lines of code. To get the first two types of equation takes eight lines total.

For the complete activity, check out the TI-84 Plus CE Python or TI-Nspire™ CX II graphing calculator.

Last but not least, did ratios and proportions make your list?

How about putting ratios and proportions to use and make a game? Unlike the other three projects mentioned above, let’s use students’ understanding to create a game, a version of Shuffleboard.

Take a look at the shuffleboard above.
• Given a printout of this page, could your students use a ruler to determine various ratios comparing the four similar triangles?
• If students knew the screen dimensions in pixels for the largest triangle, could they use the ratios they found to find the dimensions for the three smaller triangles in pixels?

That’s exactly how this activity is set up. Before students can play shuffleboard, they use ratios and proportions to fit a shuffleboard on the calculator screen.

Then, students add 11 lines of code to a pre-coded template.

Next, students use ratios to look at …

Shots missed:

Using their observations, students program the remaining 12 lines of code to calculate the score.

Student math endeavors are rewarded with a fully functioning shuffleboard game. Get in the game yourself with the activity files for the TI-84 Plus CE Python or TI-Nspire™ CX II graphing calculator.

So, the coding is done … now what? The learning is just getting started!

• If your students have their own calculator, they now have a fully functioning math game. They can play in class, on a bus, at home … virtually anywhere.
• How about a daily or weekly warmup? Use the game as a sponge to soak up extra time after a test, or as a bell ringer.
• What about a class competition. Who can get to score ___ the quickest?
• Have students track their daily progress over a week or two. Spend five minutes a day playing the game. What patterns do students see over time?
• Frisbee Golf: Do they start earning more frisbees as the days go on?
• Integer Darts: Chart the daily high, or challenge who can get to 15 points first.
• Tic-Tac-Toe: Graph how many moves it takes to win each day.
• Code more than one project. Let students choose which one they play during a bell assignment.

This year, let Python game design help put the fun in math practice in your classroom. I know it will in mine. To see all of the activities available for middle and high school, be sure to visit the “Explorations With Coding” section for the TI-84 Plus CE Python or TI-Nspire™ CX II graphing calculator.

About the author: Becky Byer teaches math and computer science at Kelly Walsh High School in Casper, Wyoming. She is a Regional T³™ instructor, Nationally Board Certified and a reader for the AP® Computer Science Principles exam. She is passionate about integrating technology, such as computer programming, to build and enhance student understanding of mathematics.

AP® is a trademark registered by the College Board, which is not affiliated with, and does not endorse, TI products. Policies subject to change. Visit www.collegeboard.org.