Family edition
Map Robot Lab: Plans Change, Re-planning and the Order of Stops
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
- A computer or Chromebook with a current browser.
- The link: mytekdev.com/try/maprobotlab?lesson=plans-change-re-planning-and-the-order-of-stops&ref=fam-maprobotlab-4. No account, no email and nothing to install.
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.
- 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.
- 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.
- 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.
- 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.
- 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 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
- 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.
- 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.
- 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.
- 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:
- Why did the first plan drive into the closed road?
- Why is it drive one block of the route, and not follow the route, inside the loop?
- What are the three parts of the closest-next loop?
- Why did the job list's order take 31 minutes?
- Why don't apps check every order for a delivery truck?
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
- Change the closest-next program to plan with every road costing 1. Why does it take 36 minutes in the same order?
- Build a town on Level 9 where closest next is not the best order, and prove it with the table.
- How many orders do 5 stops have? 6? Make a table and say how fast it grows.
Bring it into other subjects
- Math: 3 stops have 3 x 2 x 1 = 6 orders. Write the counts for 4, 5 and 6 stops. How many times bigger is each?
- Social studies: how do school buses or mail carriers choose their routes? Ask someone who drives one.
- Writing: describe a day your plans changed, and what new information made you change them.
- Careers: look up what a logistics planner does.
For your records
Ready to copy into an hour log, a portfolio or a transcript.
| Lesson | Map Robot Lab: Plans Change, Re-planning and the Order of Stops |
|---|---|
| Subjects | Computer science |
| Time | 45 minutes |
| What we did | Programmed 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 practiced | Re-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? ________________________
- Vocabulary. Re-planning, decompose, order, closest next, heuristic, brute force: write each in your own words.
- Level 6. One plan: stopped at (____ , ____) after ____ blocks. Plan again every block: ____ blocks, ____ minutes, ____ plans.
- 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: ____.
- 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
| Question | Answer | Why |
|---|---|---|
| 1 | B | Each new plan uses what the van has learned, so it goes around the closure. |
| 2 | B | 3 choices for the first stop, 2 for the second, 1 for the last: 3 x 2 x 1 = 6. |
| 3 | Open answer | It 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.