My First Algorithm: A Fun, Hands-On Coding Lesson Plan for Kids

Introduce young learners to coding with this fun, screen-free lesson plan! Using a 'robot treasure hunt' game, kids ages 5-8 will learn what an algorithm is, how to create step-by-step instructions, and the basics of debugging. A perfect first step into STEM and computational thinking.

Previous Lesson
PDF

Lesson Plan: My First Algorithm - The Secret Code for Robots!

Subject: Introduction to Coding Concepts

Target Learner: Troy (Age 7)

Estimated Time: 30-45 Minutes


Materials Needed:

  • Paper or a whiteboard
  • Crayons, markers, or a dry-erase marker
  • A small toy (like a car, an action figure, or a block)
  • A "treasure" (like a sticker, a favorite snack, or another toy)
  • (Optional) Masking tape to create a grid on the floor
  • (Optional for Extension) Building blocks like LEGOs

Learning Objectives:

By the end of this lesson, Troy will be able to:

  • Define an "algorithm" in his own words as a set of steps to finish a job.
  • Create a simple, step-by-step algorithm using pictures or words to guide a toy through a maze.
  • Test and fix (debug) his algorithm if it doesn't work the first time.

Lesson Plan

Part 1: Introduction - The Confused Robot (5 minutes)

HOOK AND OBJECTIVES

  1. Engage with a Question: "Hey Troy! Have you ever told a grown-up how to do something, and they did it in a silly way? Computers and robots are like that! They only do *exactly* what we tell them. Today, we are going to learn how to give perfect instructions, which is the first big secret to coding!"
  2. Introduce a Scenario: "Let's pretend I'm a robot who wants to pick up that crayon over there. Tell me exactly what to do. You are the programmer!" (Follow his instructions literally. If he says "walk," take one giant, clumsy step. If he doesn't say "stop," keep walking until you hit a wall. If he says "pick it up," mime trying to pick it up without bending down. Make it fun and silly.)
  3. State the Goal: "See? Giving instructions has to be super clear! Today, we're going to learn how to write a special set of instructions called an algorithm. By the end of our lesson, you'll be able to write your own algorithm to guide your favorite toy on a secret mission to find treasure!"

Part 2: Body - Building Our Code (20-25 minutes)

I DO, WE DO, YOU DO MODEL

I DO: What is an Algorithm? (5 minutes)

  1. Explain in Simple Terms: "An algorithm is just a big word for a list of steps to finish a job. A recipe for making cookies is an algorithm. The steps for brushing your teeth are an algorithm. In coding, an algorithm tells a computer or robot exactly what to do, one step at a time."
  2. Model with Simple Commands: "Let's make some command codes. We can use arrows. A straight arrow (↑) can mean 'Move one step forward.' A turning arrow (↷) can mean 'Turn right.' A different turning arrow (↶) can mean 'Turn left.' " (Draw these symbols on the paper or whiteboard.)
  3. Show a Simple Example: On a piece of paper, draw a simple 3x3 grid. Place a toy robot at the start and a "treasure" a few squares away. "Here is my robot, Bot. I want Bot to get the treasure. My algorithm would look like this." Point and say the steps as you write or draw them:
    • ↑ (Move Forward)
    • ↑ (Move Forward)
    • ↷ (Turn Right)
    • ↑ (Move Forward)
    "Now, let's test it!" Move the toy on the grid according to the steps to show that it works.

WE DO: The Human Robot Game (10 minutes)

  1. Set Up the Challenge: Create a slightly bigger grid on the floor with masking tape or on a large piece of paper. Place a toy at the start and a "treasure" at the end. Add one obstacle (like a pillow or a block) that the toy has to go around.
  2. Create the Algorithm Together: "Okay, Troy, you're the programmer! Let's write the algorithm for your toy to get the treasure. What should the very first step be?" (Guide him through each step. Write down the arrow commands on the paper as he suggests them.)
  3. Test and Debug Together: "Time to run the program! You read the code, and I will move the toy exactly as the code says." (If the toy hits the obstacle, say "Oh no! A bug in our code! A bug is just a mistake. Great coders are great at finding and fixing bugs. What step should we change to get around the obstacle?")
  4. Revise and Succeed: Work together to fix the "bug" in the algorithm and run it again until the toy successfully reaches the treasure. Celebrate your success!

YOU DO: Treasure Map Challenge (5-10 minutes)

  1. Give the Mission: "Awesome job, programmer Troy! Now you have a secret mission. I want you to create your very own treasure map and the secret algorithm to find the treasure. You can draw it on this paper."
  2. Instructions: "First, draw a starting spot and a treasure chest. You can add one or two obstacles, like a pretend river or a mountain. Then, write the algorithm—the list of arrow steps—that someone would need to follow to get from the start to the treasure. Remember our commands: ↑, ↷, and ↶."
  3. Success Criteria: "Your mission is a success if: 1. You have a clear start and end point. 2. Your algorithm has at least 4 steps. 3. I can follow your algorithm exactly and get the toy to the treasure!"

Part 3: Conclusion - Coder's Celebration (5 minutes)

CLOSURE AND RECAP

  1. Demonstrate and Assess: "Okay, code master, I'm ready to test your program!" Take Troy's map and algorithm. Carefully follow his steps with a toy. If it works, celebrate! If there's a bug, have him help you debug it. This serves as the summative assessment.
  2. Recap Key Learning: Ask questions to reinforce the concepts.
    • "What is that special word for a set of instructions?" (Algorithm)
    • "Why is it important for the steps to be in the right order?" (Because the robot will do the wrong thing!)
    • "What do we call a mistake in the code?" (A bug!)
  3. Connect to the Real World: "You were a real coder today! Every video game you play, every app on a phone, and even how a traffic light works is all because a programmer wrote a bunch of algorithms, just like you did."

Differentiation and Adaptability

  • For Scaffolding/Simpler Version: Use pre-made cards with arrows on them that Troy can arrange in order instead of drawing them. Use a very simple, small grid with no obstacles.
  • For Extension/Advanced Challenge: Introduce a new command, like a "Jump" command to go over an obstacle or a "Pick Up" command. Have Troy create a 3D algorithm for building a simple 5-block LEGO structure, writing the steps for where each block goes.
  • For Classroom/Group Setting: The "We Do" activity can be done in pairs, where one student is the "robot" and the other is the "programmer" who gives verbal commands. The "You Do" can be a gallery walk where students try to solve each other's algorithm maps.

Ask a question about this lesson

Loading...

Related Lesson Plans

How to Roller Skate for Beginners: Easy Step-by-Step Lesson on Safety, Balance, Gliding & Stopping

Master the roller skating basics with our easy-to-follow guide for beginners! Learn essential safety tips, how to balanc...

Where Do Animals Live? Fun Lesson & Crafts on Animal Habitats for Kids

Discover where animals live with this fun science lesson for kids! Explore different animal homes like nests, burrows, d...

Teaching Kids Good Manners: Fun Etiquette Lesson Plan & Activities

Easily teach children etiquette and the importance of good manners with this engaging lesson plan. Includes discussion p...

Everyone is Special: Preschool Lesson on Challenging Gender Stereotypes in Play

Engage preschoolers with this fun lesson plan about gender stereotypes, play, and friendship. Includes story time, toy s...

What Do Animals Eat? Fun & Easy Preschool Lesson Plan on Animal Diets

Engage preschoolers with this fun, interactive lesson plan about animal diets! Features matching activities and pretend ...

Fun Community Helper Lesson Plan & Activities for Preschoolers

Teach preschoolers about community helpers like firefighters, police, doctors, and teachers with this easy lesson plan f...