For a teacher with a class? The classroom edition has the full plan, slides and standards.

Homeschooling PDF

Family edition

Map Robot Lab: Plans Change, Re-planning and the Order of Stops

Ages 11-14 ยท about 45 minutes, in one sitting

In Map Robot Lab your child programs a delivery van to plan again when a road turns out to be closed, then to choose the order of three deliveries.

What you need

Before you start: try it once yourself

Open mytekdev.com/try/maprobotlab?lesson=plans-change-re-planning-and-the-order-of-stops&ref=fam-maprobotlab-4. A short guide opens over Level 6, Road closed. 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. One plan. The starter blocks plan the fastest route to the Hospital and follow it. Press play: 8 blocks and 8 minutes, then the cones pop up at (5,5), and the van stops.
  2. Plan again. Put repeat until arrived under when started, with plan a route to the goal and drive one block of the route inside it. The van plans 12 times and arrives in 12 blocks and 18 minutes. The Trip log's best, knowing the closure from the start, is 14 blocks in 14 minutes.
  3. Level 8. Open Levels and start Level 8. The same program delivers in the job list's order, Zoo, Pizza Place, Library: 29 blocks, 31 minutes. The table lists all six orders: 31, 22, 19, 18, 26 and 34 minutes.
  4. Closest next. While there are stops left: set the best to none and its minutes to 1000; for each stop, if minutes to the stop is less, keep it; go to the best next; plan a route; follow it. Pizza Place, Library, Zoo: 16 blocks, 18 minutes, the best here.
  5. 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.
A program that plans once and follows on Level 8 delivers only to the Zoo, the first stop, and the card says two are still to deliver. Closest next is the best order in this town, but not in every town: a child can build one on Level 9 where it is not.

The ideas, in plain words

The van learns about a closed road only when it gets there, so a plan made at the start cannot know. Planning again after every block uses everything learned so far. Real map apps keep getting news while you drive, such as traffic and closed roads that other drivers report, and they plan again when something changes. That is how they reroute you.

Ordering stops gets slow fast: 3 stops have 6 orders, 10 have 3,628,800. Delivery apps use shortcuts like closest next, then try swapping stops to do better. Closest next is quick, but it isn't always the very best. 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).

Do it together

  1. Open mytekdev.com/try/maprobotlab?lesson=plans-change-re-planning-and-the-order-of-stops&ref=fam-maprobotlab-4 together and press play.

    You'll know it worked when: The van drives 8 blocks and stops at (5,5), where a road turns out to be closed.

  2. In Blocks, put repeat until arrived? under when started, and inside it plan a route to the goal and drive one block of the route. Back in Simulator, press play.

    If you get stuck: Take out follow the route: it drives the whole plan before the van can plan again.

    You'll know it worked when: 12 blocks in 18 minutes, after 12 plans.

  3. Open Levels and start Level 8. Press play.

    You'll know it worked when: All three delivered in the job list's order: 31 minutes. The table under the Trip log lists all six orders.

  4. Follow the card's hint to go to the closest stop next, using the Stops blocks, and play.

    You'll know it worked when: Pizza Place, Library, Zoo: 16 blocks in 18 minutes, the best of the six orders here.

Talk about it

Ask these while you work together. A child who has understood it can answer them without help:

The second question is the one that matters. A child who says "so it can plan again with what it just learned" understands re-planning. A child who says "it's slower" has noticed the plans but not why.

For younger and older kids

Younger: For a younger child, stop after Level 6, and talk about a time a plan had to change on the way.

Older: For an older child, work out how many orders 4, 5 and 10 stops have.

Keep going

Bring it into other subjects

For your records

Ready to copy into an hour log, a portfolio or a transcript.

LessonMap Robot Lab: Plans Change, Re-planning and the Order of Stops
SubjectsComputer science
Time45 minutes
What we didProgrammed a simulated delivery van to re-plan around a closed road and to choose the order of three deliveries, and compared every order of the stops.
Skills practicedRe-planning; Decomposing a problem; Comparing orders

Map Robot Lab: Plans Change, Re-planning and the Order of Stops

Activity sheet (optional)

Name: ______________________________ Date: ______________

Open the app: scan the QR code, or go to mytekdev.com/try/maprobotlab?lesson=plans-change-re-planning-and-the-order-of-stops

Essential question: What should a program do when the world changes, and how do you choose the order of several jobs?

Warm-up: The road ahead is closed. What do you do? What does a map app do? ________________________

  1. Vocabulary. Re-planning, decompose, order, closest next, heuristic, brute force: write each in your own words.
  2. Level 6. One plan: stopped at (____ , ____) after ____ blocks. Plan again every block: ____ blocks, ____ minutes, ____ plans.
  3. Level 8, all six orders. Zoo, Pizza Place, Library: ____ min. Zoo, Library, Pizza Place: ____. Pizza Place, Zoo, Library: ____. Pizza Place, Library, Zoo: ____. Library, Zoo, Pizza Place: ____. Library, Pizza Place, Zoo: ____.
  4. Closest next. Order: ________________. ____ blocks, ____ minutes. The best of the six? ____

1. Why does the van plan again after every block, and not just once?

2. How many orders would 5 stops have? Why don't apps check them all for 30 stops?

Quick check

Name: ______________________________

1. The van finds a closed road only when it gets there. A good program: (A) plans once at the start (B) plans again as it learns (C) stops and waits

2. Three stops have how many orders? (A) 3 (B) 6 (C) 9

3. A friend says closest next always finds the best order. Use what you learned today to answer.

Answers

QuestionAnswerWhy
1BEach new plan uses what the van has learned, so it goes around the closure.
2B3 choices for the first stop, 2 for the second, 1 for the last: 3 x 2 x 1 = 6.
3Open answerIt found the best here, 18 minutes, but it is a shortcut: it only looks at the next stop, so in another town it can miss the best order. Checking every order finds the best, but gets too slow as the stops grow.

If your state or umbrella school asks, this lesson covers CSTA 2017 2-AP-13, CSTA 2017 2-AP-12, CSTA 2017 1B-AP-08.