A foundational 4th-grade computer science lesson that demystifies algorithms through everyday morning routines, precise classroom instructions, and maze path debugging. Students discover how computers follow exact steps and practice writing and debugging their own sequential algorithms.
A programmer wrote an algorithm to move Bot-404 across the hallway to collect the Star (⭐). But when they ran the program, Bot-404 crashed into a recycling bin!
The Buggy Code:
Step 1: Move ➡️ Right Step 2: Move ➡️ Right Step 3: Move ⬆️ Up Step 4: Move ➡️ Right (Goal ⭐)
Hint: The recycling bin is located directly ABOVE tile 2. The Star is directly straight ahead on the bottom path!
1. What is the bug? Explain why Step 3 caused Bot-404 to crash:
2. Debug the code! What should Step 3 be replaced with so Bot-404 reaches the Star safely?
🏆 Super Coder Verification: All algorithms tested, verified, and debugged!
Master Coder Stamp: [ ]
Everyday Algorithms • Student Worksheet Page 2 of 2
Step 2: ⬇️ Move Down to (2,2)
Step 3: ➡️ Move Right to (2,3)
Step 4: ➡️ Move Right to (2,4)
Step 5: ⬇️ Move Down Goal (3,4) ⚡
Alternate Valid Route (6 Steps):
Step 1: ➡️ Right (1,2) • Step 2: ⬇️ Down (2,2) • Step 3: ⬇️ Down (3,2) • Step 4: ➡️ Right (3,3 is blocked by rock!) ❌ Watch out! Students who go down to row 3 early must detour or avoid (3,3).
Evaluation Rule: Any sequence of arrow commands that leads from Start to the Battery without crossing tiles (1,3), (2,1), or (3,3) should be awarded full credit!
MISSION 4 SOLUTIONS
Bug Detective: Spot & Fix
Bug: Direction Mismatch
1. What is the bug? (Explanation):
Model Answer:"The bug is in Step 3 where the programmer wrote 'Move ⬆️ Up'. Moving up sends Bot-404 directly into the recycling bin obstacle on the upper wall instead of staying on the clear pathway."
2. How to fix it? (Correction):
Correct Code: Replace Step 3 with 'Move ➡️ Right' (or keep moving straight forward). Complete Corrected Algorithm: ➡️ Right, ➡️ Right, ➡️ Right, ➡️ Right (Collect Star ⭐).
Interactive Kinesthetic Extension: "The Human Robot"
Pair students up. Student A is the Programmer and Student B is the Robot. Tape a 4×4 grid on the floor. Student A reads their code aloud one command at a time. If the robot runs into a desk or taped wall, Student A must say "Bug found!" and rewrite the algorithm on their paper before trying again!