Winter Holiday Tag

Winter Holiday Tag
Free Mission Lesson Plan

Winter Holiday Tag

Students program their CodeX to pass a digital present around the room with radio messages, then play it as a class game of tag.

⏰ 50 min 🎯 Grades 6-12 💻 CodeSpace 🎮 CodeX 🐍 Python
View Lesson Outline
Four CodeX boards framed by holiday lights. Three show an orange target and one shows a wrapped present.
📋

Overview

Winter Holiday Tag is an easy coding project for the whole class. Students use their CodeX and radio communication to pass a pixel image of a present from device to device, like a digital game of hot potato. Students can simply pass the gift around, or you can turn it into a game that ends when you stop the passing. Whoever is holding the present can be the winner or the loser, depending on how you organize the game.

Three extensions take the project to an intermediate level, and each one gives a different version of the game. Instructions are also included to make this visual game accessible to vision-impaired students.

🎯 Mission Goal: Students will write a program that uses radio messages to pass a digital present between CodeX devices in a class game of tag.

🎬

Watch the Project

🎯

Learning Targets

  • I can display a pixel image.
  • I can use a Boolean variable to determine which image to display.
  • I can convert an integer to a string.
  • I can use a compound condition.
  • I can use an infinite loop to send and receive radio messages.
  • I can generate a random number.
  • I can define and call a function with a parameter.
💡

Key Concepts

  • This is a class project. Each student writes their own program and plays the game on their own CodeX.
  • All CodeX on the same radio channel (1 through 13) can send and receive messages to each other.
  • Radio messages are strings, so each CodeX number has to be converted with str() before it is compared or sent.
  • A Boolean variable (have_present) keeps track of which CodeX is holding the present.
  • A function lets students write the display code once and use it anywhere.
  • Only the CodeX with the present sends a message, and it must never tag itself.
✅

Assessment Opportunities

  • Students run their program and see the present on the CodeX that has it, and a different image on the CodeX that does not.
  • Observe the class game: the present passes from CodeX to CodeX without getting lost.
  • Students explain what each step of the program does, such as the Boolean variable, the function, and the radio loop.
  • If students complete an extension, they explain how the control CodeX, timer, or counter works.
☑️

Success Criteria

  • Copy the starter code into a new file in the Sandbox and run it
  • Create the NUM_PLAYERS and MY_NUM constants
  • Use the have_present Boolean variable to track who has the present
  • Write a function that displays the correct image
  • Turn on the radio and set the class channel
  • Send and receive radio messages inside an infinite loop
  • Pass the present to a different CodeX, never to themselves
🧰

Classroom Materials

  • ▸CodeX (one per student is best)
  • ▸USB-C cable
  • ▸Computer with a CodeSpace account for each student
  • ▸Optional: one extra CodeX to be the game stopper (Extension 1)
  • ▸Optional: music for playing Tag or Musical Chairs
🚀

Extensions & Cross-Curricular

ExtensionExtension 1: Use an additional CodeX as a control. The first CodeX still starts the game, but the control CodeX stops it. It is not a player in the game of tag.
ExtensionExtension 2: Add a timer to the code, used by the first CodeX. Generate a random amount of time to play the game. When time is up, see who is "holding" the gift.
ExtensionExtension 3: Add a counter to each CodeX. When the game ends, each CodeX without the gift displays the number of times it was "tagged." The CodeX with the gift is the winner and keeps showing the present.
ExtensionHave students create their own pixel art images to display on their own CodeX devices.
ExtensionLearn about displaying JPG images on the display screen. Have students find an image and compress it for the CodeX. Use a button press to end the program and clear the screen, or display an ending message.
ExtensionMake a list of built-in images. After the game ends, someone has the gift. After a short delay, randomly select an image from the list and display it, like the present is opened.
Lang ArtsHave students write a story about gift giving, playing a childhood game, or a holiday memory.
MathExtension 3 adds a counter to each CodeX. Play the game several times and keep track of the counts. Create a graph, calculate the mean, median and mode, and find the probability of each CodeX ending up with the present.
Comp SciThe messages sent in this project are open, without security. Have a discussion on digital security measures and/or encryption. This also meets additional CSTA and computer science standards.
Comp SciComputer data is digital, but radio waves are analog. Have a lesson about converting analog and digital data.
ScienceLearn about radio signals.
SELHave a discussion about being gracious during gift giving, or winning and losing.
📐

Standards

▾

CSTA Standards - Grades 6-8

2-CS-02 2-CS-03 2-AP-11 2-AP-12 2-AP-13 2-AP-14

CSTA Standards - Grades 9-10

3A-CS-03 3A-AP-13 3A-AP-16 3A-AP-17 3A-AP-18

CSTA Standards - Grades 11-12

3B-DA-06 3B-AP-10 3B-AP-14 3B-AP-16
📝
Preparing for the Lesson
  • Download the project slides and the starter code (see Digital Resources), and make the starter code available to students.
  • Be familiar with the final code before class.
  • Read through the Lesson Outline below.
  • Students should already have an account in CodeSpace. It is best if each student has their own CodeX and USB-C cable.
  • Decide how many players there will be and how you want to play: Tag, Musical Chairs, or just passing the present.
  • Optional: if you have a visually impaired student, review the audio accessibility instructions at the end of the Lesson Outline.

🧑‍🏫
Teacher Notes
  • This lesson is designed as a class project, with individual students creating their own programs.
  • This project is not included in CodeSpace. Students use the Sandbox and follow the slides, which include step-by-step instructions and code segments.
  • Almost all mistakes made by students are typing mistakes. If students get errors when they run their code, first look over the code for spelling, punctuation and especially indenting.
  • This project uses images and pixels. If you have a visually impaired student, instructions at the end of the Lesson Outline add a beep as an audio clue with the image.
  • The slides include three extensions. Any or all of them can be done, and they do not have to be done in the order given. Extension 2 builds off Extension 1. Extension 3 can be added to either Extension 1 or Extension 2.
  • If your students have done Pixel Art, or you want them to do pixel art, you can extend this project into two days. Students design their own holiday pixel art, do a Save As on the code, and use their art instead of the pixel art gift that comes with the starter code. Students will not pass their own images to other students, but when they are tagged, their own image is displayed on the screen.
🗺️

Lesson Outline

This outline gives one way to present the lesson.

🗣️Warm-up

Slide 2: Start with a short discussion about gifts during the holiday season.

Slide 2 mentions the game "hot potato." If students do not know it, give a short explanation or example. You can also change the wording to a game of tag, pass the present, or anything that makes sense for your students and age group.

💻Getting Started

Slides 3-5: Students log in to CodeSpace and open the Sandbox (the icon on the right side bar, near the bottom).

  • Create a new file named holiday_tag.
  • Copy the code from the starter code text file (holiday_tag_starter) and paste it into the new file.
  • Run the code. A gift should appear on the CodeX display screen.
  • If students are using their own image, they can replace the gift variable with their own image.
Teaching tip: This project is not in CodeSpace. Show the slides on a large screen and have the class work through each step together. Keeping the class together and letting students help each other is the suggested way to teach it.
💻Build the Program

Slides 6-23: Students build the game one step at a time.

  • Step 1 (Slides 6-7): As a class, decide how many players there are and give each student a unique number starting at 1. The last number should match the number of players. Students add the NUM_PLAYERS and MY_NUM constants.
  • Step 2 (Slides 8-9): Add a Boolean variable, have_present, to track when the CodeX has the present. Every CodeX starts as False except the first CodeX.
  • Step 3 (Slides 10-12): Define a function that displays an image. If the CodeX has the gift it shows the present, otherwise it shows a target. Students run the code twice to see both images, either by using two different numbers for MY_NUM or by changing the if statement, and then change the code back after testing. The pixel code uses a list for the colors, and students can use different colors if they want.
  • Step 4 (Slides 13-14): Briefly introduce radio communication, then add code to turn on the radio and set the channel. Everyone in the class uses the same channel.
  • Step 5 (Slides 15-18): Explain the string and integer data types and why conversion is needed. Modify the main program to use an infinite loop that calls the function and listens for a radio message.
  • Step 6 (Slides 19-20): Add code to send a radio message with BTN_U, but only when have_present is True. The placement of this if statement is important. It should be the first block of code inside the while True loop.
  • Try it (Slide 21): This is the first run as a game. Someone will press the button to pass the gift, but it may not end up anywhere. The random number can be their own number, but they already set have_present to False, so the present is lost. The next step fixes this.
  • Step 7 (Slides 22-23): Fix the problem by adding a while loop that picks a new random number if it matches MY_NUM. Now the game should work correctly.
Teaching tip: Almost all mistakes are typing mistakes. Have students check spelling, punctuation, and especially indenting before anything else.
🧑‍🤝‍🧑Play the Game

Slides 24-25: Students play the game. In this basic version there is no end. It continues until the CodeX is physically stopped. Slide 24 suggests two ways to play.

  • Tag: Play music. When the music stops, the person with the present is "it."
  • Musical Chairs: Play music. When the music stops, the person with the present is out. Change NUM_PLAYERS by one, adjust the CodeX numbers, and play again until one person remains.
  • Your own game: Make up your own rules, or just let students pass the present around.

Slide 25 shows variations: students create their own pixel art, display a compressed JPG image, or add a function that stops the program when a different button is pressed.

🚀Extensions

Slides 26-42: Three extensions are given. Choose any or all of them, or keep the project basic.

  • Extension 1: Add an additional CodeX that does not play the game but controls when to stop it.
  • Extension 2: Add a timer to stop the game after a random number of seconds. The CodeX with the gift is the winner.
  • Extension 3: Add a counter for each CodeX. When the game ends, the CodeX devices without the present display the number of times they received it.
Teaching tip: The line numbers on the extension slides may differ a little from your students' code. Have them use the section comments, like # -- Set Up --, to find their place.
🧑‍🤝‍🧑Wrap-Up (Optional)

The project does not require a wrap-up. You can use one of the extension or cross-curricular ideas above, or have students reflect on the project and something they learned.

🔊Audio Accessibility

The project uses images and colored pixel lights to show whether a CodeX has the gift. If you have a visually impaired student, help them add a few lines of code that play a beep when the gift is passed to their CodeX. The beep lets them know when to press the button and pass the gift. The code is in holiday_tag_beep.txt.

  • Add the last three lines of the beep code to the import section of the program.
  • Add the last three lines to the if statement that receives a radio message.
  • If you add Extension 3, add the beep code to the end_game() function to signal the end of the game.
  • If you are using Extension 1 or 2 instead, add the same for loop to your end_game(have_present) function. That version has only one parameter, so leave out count.
💬

Share Your Results

Join the conversation in the Firia Labs Code Collective to share how your students did!

Back to blog