Sitemap
Computing Macroxela

Computing Macroxela

Computer Science educator, programmer, & algorithm enthusiast who loves explaining interesting CS/Math topics and pedagogy

CS Classroom Activity: Escape Room

7 min readJun 11, 2025
Press enter or click to view image in full size
Designed by Freepik

Most subjects have various activities to engage students in the classroom while staying relevant to the topic. Vocabulary bingo, Jeopardy, foldables, scavenger hunts, debates, and many others are quite common in math, language, social studies, and science classrooms. Many of these can also be applied to CS classrooms with some adjustments. A particularly interesting one is an escape room. An escape room is a game in which players are locked in a room and have to solve a sequence of puzzles to escape. Of course we don’t actually have to lock students in but the puzzle aspect can be quite useful and fun to reinforce certain concepts. Instead of locking students in, we can lock in the next puzzle, a solution or hint to another puzzle, or a prize.

John Dutton from the Cleveland Teaching Collaborative provides an example of an escape room he designed for his students. This version requires a huge time investment as well as monetary but we can make it simpler. As long as we keep the fundamental idea of the activity, we can work with cheaper and more accessible options. The fundamental idea is to require students to solve certain puzzles/problems before progressing to the next one. This can easily be done with a worksheet whose problems need to be solved in order. But that’s too boring. It misses the whole point of an escape room. So let’s design a more interesting one together.

For this activity, we need to consider a few things. What kinds of puzzles will we use? What concepts do we want to reinforce? What questions do we use and how many? What are potential bottlenecks in the activity? What theme do we want for the escape room? We will determine each one individually.

When designing the escape room we need to think about what the puzzles will be and how they will be organized. Escape rooms usually require solving the puzzles in a certain order or using the solutions of a few of them before progressing. Dutton’s example uses combination locks, actual puzzle pieces, and some programs he created. The latter two can take quite some time to prepare so instead we will stick with combination locks (alphabetical & numerical) and password protected Word documents. It’s actually pretty easy to password protect Word documents, instructions can be found here and here, but unfortunately Google Docs does not support password protection yet. The solution to every puzzle is used as the combination or password for the lock or document. The puzzles themselves will be coding challenges the students need to solve whether through code tracing or writing actual code. We can lock each puzzle behind a lock/document or have combined solutions of all of them to unlock the grand prize. One way we can combine them is to lock USB flash drives containing the password protected documents along with the challenges to determine the passwords. How the problems are organized will be up to you and how the resources you have.

We also need to think about what concepts we want to reinforce in these puzzles. Reinforce not introduce. Escape rooms (and most activities) aren’t a good way of introducing concepts, they’re better applied to reinforcing concepts students have been exposed to already. For this example we choose to reinforce code tracing, loops, and conditionals. These are foundational concepts that all CS students need to master so it is a good option for our escape room. So let’s create some problems on these topics. The problems should progress from easier to more challenging. Let’s start with the first one.

Challenge #1: Determine the output of the following code. The combination for the lock are the values of a, b, and the number of lines of code in that order.

a = 27
b = a%5+4
a = a + b
b = a - b
a = a - b
print(a, b)

This one should be relatively simple. It only requires arithmetic and knowing how the modulo operator works. It can be used as a sample problem or the first problem students should solve. We can change the numbers and operations on the variables to anything we want as long as we select 3 numbers from the code to use as a combination for the lock.

Challenge #2: Use the previous values of a and b to determine the output of the following code. The printed numbers are the combination for the second lock.

combination = ""
c = int((b-a)/3)
for i in range(a, b-c, c):
combination += str(i) + " "
print(combination)

This one requires a bit more work than the previous one. Not as much math but students need to know how to iterate through a for loop and update values within it. It also requires students to solve the first challenge before taking on this one since it requires them to use values from the previous challenge. This guarantees that students will solve the challenges in a particular order but if we don’t want that we can simply provide values for a and b.

Get Computing Macroxela’s stories in your inbox

Join Medium for free to get updates from this writer.

Challenge #3: The following code generates a password using a loop. Use that password to unlock the third lock.

password = ""
for num in range(30, 36):
if num % 2 == 0:
password += 'A'
elif num % 3 == 0:
password += 'B'
elif num % 5 == 0:
password += 'C'
else:
password += 'D'
print(password)

A bit different from the previous challenges since it uses a password instead of a combination. The password can be used on word combination locks or a document which is password locked. We can choose any range of numbers for the loop although it is better to pick larger than smaller numbers due to the conditionals inside the loop. The key idea behind this problem is that certain values at each iteration will result in a different letter or word. We can change these values as well to increase or decrease the difficulty.

Challenge #4: Use the password from the previous problem and determine the output of the code below. The ord() function turns the letter into ASCII code and chr turns the integer back into a character using the ASCII table. Use newPassword to unlock the fourth lock.

newPassword = ""
for i in range(len(password)-1, 0, -1):
letter = password[i]
value = ord(letter) + i*2
newLetter = chr(value)
newPassword += newLetter
print(newPassword)

Similar to the previous challenge but without the possible values of the password explicitly written in the code. This program basically goes through each letter in the original password, turns it into its corresponding ASCII code (or Unicode depending on its encoding), carries out some math on it to compute a new integer, then converts it back to a character. The math carried out on it can be any kind of math. Just keep in mind that letters exist within a certain range of integers so anything outside of that range will result in characters other than letters. Once again this password can be used on a word combination lock or a password protected document.

Challenge #5: Use the combinations from the first two challenges and the code below to determine the combination of the final lock.

def shift_left(lst): 
#Implement left shift

comb1 = [7, 27, 6] #Combination from challenge #1
comb2 = [7, 13, 19] #Combination from challenge #2

for i in range(5):
for j in range(len(comb1)):
comb1[j] += comb2[j]
comb2 = shift_left(comb2)

#Implement remainder by 40 for each element

The most challenging of all the problems we’ve used so far, it requires students to write actual code then use it to determine the final combination. We can ask students to code trace this as well although doing so removes the necessity for implementing the left shift and remainder by 40 since they can easily do it by hand. Hence it is best to let students actually code this problem if we leave it as is. Once students find this combination they can use it to unlock the final lock for the grand prize.

We now have five different problems we can use for our escape room. Assuming each one takes at least 5 minutes to solve along with a couple of minutes explaining the instructions and working with the materials, it should take students about one class period to complete. We can create more problems by changing the values or control structures for each code snippet in case students finish early. With the problems out of the way, we now need to think about the remaining aspects of the activity.

What are the potential bottlenecks? Where may students get stuck? If students tend to forget certain syntax or what some functions do, we can prepare a small reference sheet like those used on the AP CSA exam. We can also carry out a short review or warm-up exercises before the activity. Or we can prepare some tips and hints to hand out to students. Students may be allowed only a certain number of hints per problem/game which can make think more critically about when to use them.

Most of us may be used to using robots or making video games as activities in the programming classroom. Although they are good options, we can use similar activities from other classes as we have seen here. With a bit of creativity and time, we can adjust activities from other subjects to computing.

If you’re interested delving deeper into escape rooms for CS, you can look through Dutton’s resources and video shown below.

[1] Escape Rooms in the CS Classrooms by John Dutton. https://teachexcellenceaward.org/resources/escape-rooms-in-cs-classrooms/

[2] How to Make CS Escape Rooms for Cleveland Teaching Collaborative by John Dutton. https://www.youtube.com/watch?v=s8K_ODEIppY

[3] Examples of CS Escape Rooms for Cleveland Teaching Collaborative by John Dutton. https://www.youtube.com/watch?v=2wY6v6OyVLc

--

--

Computing Macroxela
Computing Macroxela

Written by Computing Macroxela

Computer Science educator, programmer, & algorithm enthusiast who loves explaining interesting CS/Math topics and pedagogy