Grades 2–5 · STEM & Computer Science
How do you teach debugging with unplugged grid commands in Grades 2–5?
Short answer: Give students a grid, a start and goal point, a blocked square and a short command sequence. They trace one command at a time, mark the position after each step, and stop at the first move that hits a blocked square or leaves the grid. Then they repair the program without making it longer and test it again.
- Grades2–5
- Devices neededNone
- Lessons4 double lessons of 90 minutes
- Includes42-page PDF, 16 slides, 5 worksheets and keys
Young programmers often fix bugs by starting over. That works for a three-step program and fails for anything longer. Debugging as a skill means finding exactly where a program goes wrong, changing that part, and checking that the fix works.
The Unplugged Robot Debugging Cards teach that skill with paper grids and command cards. No devices are needed. Students trace commands by moving a token or drawing a path, record each position, and identify the first invalid instruction. The rule that a repair must not increase the program's length pushes students to think about the bug instead of rewriting everything.
The unit fits a computer science block, a math lesson on coordinates or an indoor recess rotation. Because the grids are small and the programs short, students get many complete debugging cycles in one lesson, and each cycle ends with a tested result rather than a guess.
Units for this topic
Unplugged Robot Debugging Cards
The lead unit: grid tracing, first-invalid-move checks and length-limited repairs.
Build a Library Search Algorithm
Building a library search algorithm continues unplugged CS with linear and binary search.
Accessible Game Design in Scratch
Accessible game design in Scratch moves testing and debugging onto a screen for Grades 3–6.
Design a Mini Golf Course on a Grid
Designing a mini golf course on a grid practices coordinates in a math context.
Test an Evacuation Route with a Paper Simulation
The paper evacuation route simulation compares routes and bottlenecks on a grid-like plan.
Coordinates and two commands
The opening case uses a coordinate grid. The robot starts at (1,1) and the goal is (4,3). The program is E E N N E. Square (3,1) is blocked. E increases x by one and N increases y by one. Students trace: the first E moves to (2,1), and the second E tries to move onto (3,1), which is blocked. That is the first invalid move.
Students then repair the program without increasing its length. Swapping the order of some moves, for example going north before the second east, avoids the blocked square and still reaches the goal in five steps.
- Write the start position
- Apply one command and write the new position
- Check the square is open and on the grid
- Stop at the first invalid move and mark it
Practice that changes one thing at a time
The second context starts at (0,0) with target (3,2) and a blocked square at (2,0). Students test E E N E N, find where it fails, and repair it. Another case asks for a shortest route from (0,1) to (3,1) with (2,1) blocked, which requires a detour and makes students argue about what shortest means when the direct path is closed.
A worksheet task adds a second blocked square at (2,1) and asks for a legal five-step program. With two obstacles, students have to plan rather than patch.
Leaving the grid counts as a bug
The transfer challenge runs W N from (0,0) on a grid with no negative coordinates. The very first command, W, would move to x = −1, so it is invalid. This surprises students who only think of blocked squares as errors, and it is a good way to introduce the idea that a program can fail by going out of bounds.
The prerequisite routine applies throughout: describe the input and expected behavior, run the trace, record what happened, and change one feature at a time. The formative note reminds students that a successful run does not prove a program works in every case.
Classroom management for unplugged CS
Pairs work well: one student reads commands, the other moves the token and records positions. Swap roles each round. A floor grid made with tape lets a student act as the robot for whole-class modeling, while desk grids keep everyone tracing during practice.
Support cards provide pre-drawn grids with coordinates labeled. Extension cards add more obstacles or ask students to write their own buggy program for a partner to debug.
A five-step sequence
-
Diagnose with a short trace
Give the check item: trace N E E from (0,0). See who records each position and who jumps to the end.
-
Model the first case
Trace E E N N E from (1,1) on the board and mark the first invalid move at the blocked square.
-
Repair without lengthening
Pairs rewrite the program in five commands that avoid (3,1) and reach (4,3), then test it.
-
Add obstacles
Use the second blocked square and the out-of-bounds challenge. Students record where each program fails.
-
Check independently
Run the 20-point learning check and score with the 100-point sheet. Use peer review for one corrected program.
Common mix-ups and what to try
If the robot does not reach the goal, start the program over.
Trace to the first invalid move and change only what is needed. The length rule reinforces this.
A bug only happens when the robot hits a wall.
Moving off the grid is also invalid. The W N case shows a program failing on its first command.
If a program works once, it is correct.
A successful run only shows it works for that case. Adding a new obstacle can break it.
More STEM & Computer Science units
Related teaching guides
Frequently asked questions
Do I need robots or computers?
No. Everything runs on paper grids and command cards. A tape grid on the floor is optional for whole-class modeling.
Is it too hard for Grade 2?
Support cards with labeled grids make it accessible to younger students. Start with the shorter traces and skip the coordinate notation if needed.
Do students need to know coordinates?
It helps, but the unit introduces the idea that E increases x and N increases y. Grade 2 students can track squares by counting.
How does this connect to coding on screens?
Tracing, finding the first error and testing a fix are the same steps students use in block-based coding later. Tracing on paper gives students a routine they can reuse when reading their on-screen code.
What if it does not match our CS scope and sequence?
Every resource is built around the curriculum you teach – and if something doesn't fit your standards, the TeachLessons Guarantee applies: we adapt it for you.
What is included for assessment?
A 20-point independent learning check with model responses and a 100-point scoring sheet, plus mini-checks after each learner input.
Ready for your next lesson?
Teach students to trace, find and fix bugs with the Unplugged Robot Debugging Cards.
View Unplugged Robot Debugging CardsInstant digital download. Every resource is built around the curriculum you teach – and if something doesn't fit your standards, the TeachLessons Guarantee applies: we adapt it for you.

