Teaching at home? The family edition is the same lesson, written for a parent and one to three kids.

Slides for the board (PowerPoint, 12 slides) Lesson PDF Google Slides: upload the PowerPoint file to Google Drive and open it with Google Slides.

Map Robot Lab: Stuck at the Lake, Why a Plan Looks Ahead

Grades 5-8 · 45 minutes · Computer science

Level 4 of Map Robot Lab sends the delivery van across town to the Library, with a lake in the way. The starter program heads for the goal, and the van stops at the lake's edge after 2 blocks. Students press Watch the ripple and step through a route planner: it spreads out from the van like a ripple on a pond, gives each corner a bubble with the cost so far, and always makes the cheapest bubble solid next. When the Library's bubble turns solid, the shortest way is found. Students put plan a route and follow the route in their program, and the van arrives in 11 blocks. Then they compare the two algorithms: one decides one move at a time, the other looks at the whole town first.

At a glance

Essential question

Why does a program that always heads for the goal get stuck, and how does a plan fix it?

Objectives

Students will be able to:

  • explain why heading for the goal stops at the lake
  • step through the ripple and say which bubble turns solid next
  • explain why the cheapest bubble is made solid first
  • program the van to plan a route and follow it
  • compare a rule that decides one move at a time with a plan that looks ahead

Vocabulary

Greedy algorithm, Plan, Ripple, Bubble, Cost, Shortest path

Standards

1B-AP-08, 2-AP-17

Time and materials

45 minutes, grades 5-8.

  • One computer or Chromebook per student
  • A projector
  • The worksheet and exit ticket, one copy each per student
  • The rubric, one copy per student if you grade the work

Prep

Make copies of the worksheet and exit ticket. Before class, open mytekdev.com/try/maprobotlab?lesson=stuck-at-the-lake-why-a-plan-looks-ahead&ref=tpt-maprobotlab-2 once on a student computer, which checks that your school's filter allows the app, and follow the short guide yourself: about ten minutes.

Assessment

  • Formative: the questions under What to look for, asked while students work, and the exit ticket (answer key included).
  • Summative: the worksheet, scored with the rubric.

Technology and privacy

Runs in any browser, Chromebooks included, with nothing to install. Students need no account and no email: the link works signed out, and nothing they do is stored on our server unless they choose to save.

Lesson sequence

MinutesStageWhat you doWhat students do
0 to 5Warm-up
Hook
Show the title, essential question and Today I can slides (about 1 minute). Then the warm-up: walking straight toward the far side of a pond.Answer the warm-up on the worksheet.
5 to 13Direct instruction (I do)
Model it
Project Level 4 with the starter. The town fills the view from above: a lake in the middle, a green avenue around the edge where each road takes 1 minute, gray streets that take 2, and Main Street, stuck in traffic, at 5. Each road shows its minutes. The card at the right says the level's goal and, after each run, what happened, with the run's own numbers. The Trip log counts blocks, minutes, school roads and plans made, and the charts under the map keep every route tried on the trip. Open Blocks: the program heads for the goal, the rule from the last lesson. Ask where it will stop, then press play: 2 blocks, stuck at (2,2). Show the Stuck slide, then the ripple slide.Predict, watch, and fill in the vocabulary on the worksheet.
13 to 23Guided practice (We do)
Stuck, then the ripple
Students open the link or scan the QR code. A short guide walks them through the stuck run, Watch the ripple with Step, and putting plan a route to the goal and follow the route in their program. Slower, Real time and Speed up, under the map, change only how fast the van moves on the screen; the minutes do not change. Step moves the van one block, or the ripple one corner. The round play button runs the program from the start.

Watch for: Students who leave the repeat loop around the plan. It still arrives, because the loop ends when the van has arrived, but the plan alone is enough here.

Follow the guide. Write each run's result on the worksheet.
23 to 37Independent practice (You do)
Number the ripple
On the worksheet, students number the first corners of the ripple by hand, from the Depot at 0, every road costing 1. Then they press Watch the ripple and Step to check, and answer the comparison questions. Walk the room with the What to look for questions.

If they ask: "Why does the Library's bubble turn solid last of all?" The last bubble

Watch for: Students who number the corners in the order they look along roads, not by cost. The ripple goes by cost: every corner at 1 before any at 2.

Number the ripple, check it with Step, and compare the two algorithms.
37 to 45Closure
Why does the plan work? And exit ticket
Show the closure slide and take answers. Name the two algorithms: a greedy rule that decides one move at a time, and a plan that looks ahead. Hand out the exit ticket.Discuss, then answer the exit ticket.

Before you teach: a ten-minute walkthrough

Open mytekdev.com/try/maprobotlab?lesson=stuck-at-the-lake-why-a-plan-looks-ahead&ref=tpt-maprobotlab-2. A short guide opens over Level 4, The lake. The town fills the view from above: a lake in the middle, a green avenue around the edge where each road takes 1 minute, gray streets that take 2, and Main Street, stuck in traffic, at 5. Each road shows its minutes. The card at the right says the level's goal and, after each run, what happened, with the run's own numbers. The Trip log counts blocks, minutes, school roads and plans made, and the charts under the map keep every route tried on the trip.

  1. Stuck. The starter blocks head for the goal: repeat until arrived, drive east if the Library is east and the van can, else west, north or south. Press play: 2 blocks and 4 minutes, then the van stops at (2,2), with the lake to the east.
  2. The ripple. Press Watch the ripple, then Step. The Depot is 0; the three corners one block away get 1 and turn solid first; then every corner at 2, and so on. All 39 land corners turn solid, the Library last, at 11. Press play to watch the rest.
  3. The plan. In Blocks, replace the loop with plan a route to the goal and follow the route, from Plan. The van arrives in 11 blocks and 33 minutes: the fewest blocks, because every road costs 1.
  4. Speed. Slower, Real time and Speed up, under the map, change only how fast the van moves on the screen; the minutes do not change. Step moves the van one block, or the ripple one corner. The round play button runs the program from the start. The town has no randomness: the same program drives the same way on every run and every computer.
The minutes are not the point of this lesson: the plan counts blocks, so it drives past slow roads. Students who notice the 33 minutes have found the next lesson, What does best mean?

Background for the teacher

Heading for the goal is a greedy algorithm: it takes the move that looks best right now. In an open town it works, and quickly. When something is in the way it can walk into a dead end, because it never looks further than one block.

The planner is a shortest-path search. Each corner gets a bubble with the cost so far; the cheapest bubble is made solid, and its neighbors get bubbles, or smaller numbers if this way in is cheaper. Once a bubble is solid, no cheaper way can turn up, so when the goal's bubble turns solid the route is traced back to the van. With every road costing 1, the numbers are blocks. The ripple is a simple version of what computer scientists call Dijkstra's algorithm, worked out in 1956 and published in 1959. Real map apps use the same idea with extra tricks that make it fast enough for millions of roads, and they get news while you drive, such as traffic and closed roads other drivers report.

Software engineers who build maps and delivery apps write route planners like this one, and logistics planners decide what a route should cost: time, fuel, tolls or safety. Software developers earned a median of $133,080 in May 2024 (U.S. Bureau of Labor Statistics).

What to look for

Ask these while students work. A student who has understood the lesson can answer them without help:

The third question is the one that matters. A student who says "dashed is the best so far, solid is sure" understands why the planner can trust the route. A student who says "solid means visited" has half of it.

Cross-curricular extensions

Vocabulary

Greedy algorithmAn algorithm that always takes the move that looks best right now, without looking further ahead.
PlanA whole route worked out before the van moves.
RippleHow the planner spreads out from the van, corner by corner, like a ripple on a pond.
BubbleThe number at a corner: the cost so far to get there. It can still go down until the bubble turns solid.
CostWhat a road counts as. In this lesson every road costs 1, so the cost is the number of blocks.
Shortest pathThe way from start to goal with the lowest total cost.

Differentiation

English learners

  • Keep the vocabulary slide up, and point at the van, the road numbers or the Trip log as you say each word: the picture carries the meaning.
  • Give a sentence frame on a card: The rule got stuck because ____. The plan worked because ____.
  • Draw the ripple on the board with circles that fill in as you say "solid".

Students with IEPs or 504 plans

  • Pair students, one at the keyboard and one recording results.
  • Give the ripple worksheet with the first ring of numbers filled in.
  • Where the IEP allows a modified assignment, score the first two rubric rows only.

Students who need more support

  • Run Watch the ripple together on the projector and press Step as a class, saying each number aloud.
  • Put the two plan blocks on the board in order before students start.
  • The card says where the van stopped and what to try after every run.

Students ready for more

  • Open Python and write the plan with a cost: def cost(road): return road.minutes(). Run Level 4: does the route change, and what happens to the minutes?
  • Press Watch the ripple and count how many bubbles turn solid before the Library. Why so many?
  • Draw a town where heading for the goal works and one where it fails, and test both on Level 9.

Adapting for other grades

Younger students: In grade 4, do the whole lesson on the projector: the stuck run, the ripple with Step as a class, then the two plan blocks. Score the first two rubric rows, total 8, and 6 meets the objectives.

Older students: In high school, name the planner: a simple version of Dijkstra's algorithm with a priority queue. Have students write the ripple by hand on a small graph and compare it with breadth-first search, then go on to What does best mean?, the next lesson.

Map Robot Lab: Stuck at the Lake, Why a Plan Looks Ahead

Student worksheet

Name: ______________________________ Date: ______________

Open the app: scan the QR code, or go to mytekdev.com/try/maprobotlab?lesson=stuck-at-the-lake-why-a-plan-looks-ahead

Essential question: Why does a program that always heads for the goal get stuck, and how does a plan fix it?

Warm-up: Walking straight toward the far side of a pond: what happens at the water's edge? ________________________

  1. Vocabulary. Greedy algorithm, plan, ripple, bubble, cost, shortest path: write each in your own words.
  2. Stuck. Heading for the goal drove ____ blocks and stopped at (____ , ____). Why there? ________________________
  3. Number the ripple. Every road costs 1, and the Depot is 0. Write the bubble numbers on the corners near the Depot, then check them with Watch the ripple and Step. The first corners to turn solid: ____ corners at ____.
  4. The plan. Plan, then follow: ____ blocks, ____ minutes. The last bubble to turn solid: the ____, at ____.

1. Why does the planner make the cheapest bubble solid first?

2. When is heading for the goal good enough, and when do you need a plan?

Map Robot Lab: Stuck at the Lake, Why a Plan Looks Ahead

Exit ticket

Name: ______________________________

1. A van always drives toward the goal. A lake is in the way. The van: (A) goes around (B) gets stuck at the edge (C) plans a new route

2. In the ripple, the next bubble to turn solid is: (A) the cheapest one (B) the closest to the goal (C) the one reached first

3. A friend says planning is a waste of time because heading for the goal reached the Bakery. Use what you learned today to answer.

Answer key: exit ticket

QuestionAnswerWhy
1BThe rule only looks one block ahead, so it stops where it can't drive toward the goal.
2AThe cheapest bubble is made solid next, so when the goal's turns solid no cheaper way can be left.
3Open answerIt works in an open town, but when something is in the way it can get stuck, as at the lake. A plan looks at the whole town first, so it finds a way whenever there is one.

Worksheet: what students should find

BlankWhat the app shows
Stuck2 blocks, stopped at (2,2): the Library is east and the lake is east of the van.
Number the rippleThree corners at 1 turn solid first, then the corners at 2. Each corner's number is its fewest blocks from the Depot.
The plan11 blocks, 33 minutes. The last bubble to turn solid: the Library, at 11.
Question 1A solid bubble's cost is sure: no cheaper way can turn up, because every other bubble costs at least as much.
Question 2Heading for the goal is quick and fine when nothing is in the way; a plan is needed when something can block the straight way.
The town has no randomness: these numbers are the same on every run and every computer. A student whose plan gives other minutes added a cost.

Rubric

Score each row from 1 to 4.

Name: ______________________________

Criteria4 Exceeds3 Meets2 Approaching1 Beginning
Why heading for the goal failsExplains that the rule decides one move at a time and cannot see the lake, with the run's numbers.Explains that the lake is in the way and the rule does not look ahead.Says it got stuck, without saying why.No explanation.
The rippleNumbers the ripple by hand correctly and explains why the cheapest bubble goes next.Numbers the ripple by hand correctly.Numbers some corners, or out of order.Does not number the ripple.
Programming the planPlans and arrives, and compares the two algorithms' work and results.Plans a route and arrives at the Library.Puts a plan block in but does not arrive.Does not change the program.

Total: ____ / 12. A score of 9 or more meets the objectives.

Standards

The lesson is built for CSTA 1B-AP-08: students compare two algorithms for the same delivery, a greedy rule and a plan, and decide which is the most appropriate and when. Stepping through the ripple and numbering it by hand is a trace of the algorithm; changing the program from the rule to the plan and testing it is 2-AP-17.

FrameworkCodeGradesStandardHow the lesson meets it
CSTA 20171B-AP-083-5Compare and refine multiple algorithms for the same task and determine which is the most appropriate.Students compare heading for the goal with plan and follow on Level 4, refine the program from one to the other, and say when each is the most appropriate.
CSTA 20172-AP-176-8Systematically test and refine programs using a range of test cases.Students test the rule against a town with a lake, see it fail, and refine the program until it arrives.

Checked December 2026 against: CSTA K-12 Computer Science Standards, Revised 2017.

Optional: save student work in a free class

The whole lesson runs at the link on the worksheet, with no accounts and no sign-up.

To keep students' work, and see it all in one place, make a free class. It takes about ten minutes, once, and covers every lesson in this series: mytekdev.com/tools/class-setup

Students in a class open mytekdev.com/tools/map-robot-lab/lessons/stuck-at-the-lake-why-a-plan-looks-ahead/start instead of the worksheet link. Each one gets their own copy of the starter, and the same link reopens it next time.