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.

Moon Landing Lab: A Safe Spot at the South Pole, Searching Real Ground for a Landing

Grades 9-12 · 45 minutes · Computer science

Level 11 of Moon Landing Lab puts the lander over a crater wall at the Apollo 11 site: straight down, it lands on 22 degrees and tips. The starter program searches the ground before it moves, nearest spot first, out to 150 m each way, with lander.slope_at(), and flies to the first spot it finds. But it looks for less than 20 degrees, and the legs take 12: it tips on 19.4. Students change one number, and the lander lands on 3.9 degrees, 55 m west. Then the same program goes to the south pole, real ground from the LOLA 5 m maps, where the sun skims the horizon and the camera cannot see into the shadows: it finds a 5.7 degree spot 70 m west. Last, students compare three ways to write the search, nearest first, west to east, and the flattest spot, by the fuel and the distance each costs.

At a glance

Essential question

How can a program choose a safe place to land on ground it cannot see?

Objectives

Students will be able to:

  • explain how a search loop finds the first spot that meets a condition
  • choose a safe threshold for the slope and justify it with the legs' limit and the data's error
  • trace a nested loop that searches outward, nearest spot first
  • compare three versions of a search by fuel, distance and readability
  • explain why a program can land where a camera cannot see

Vocabulary

Slope, Linear search, Threshold, Nested loop, Hazard map, Tradeoff

Standards

3A-AP-15, 3B-AP-10, HS-ETS1-4

Time and materials

45 minutes, grades 9-12.

  • 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/moonlandinglab?lesson=a-safe-spot-at-the-south-pole-searching-real-ground&ref=tpt-moonlandinglab-4 once on a student computer, which checks that your school's filter allows the app, and follow the short guide yourself: about fifteen minutes, less with Speed up.

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: the bike on the hill in the dark.Answer the warm-up on the worksheet.
5 to 13Direct instruction (I do)
Model it
Project Level 11. The Moon's gray ground fills the view in low sunlight, with Earth in the black sky. The lander hangs 500 m up. The readout gives the height, the speed (up or down), the throttle and the fuel. The box at the top says the level's goal and, after each run, what happened and why, with the run's own numbers. The strip under the scene draws the height and the speed as the lander comes down, with a line at 3.05 m/s, the fastest the legs take. Point at the colored strip on the ground: green under 6 degrees, amber to 12, red over 12. Read the search aloud: for k from 0 to 30, check k x 5 m east, then k x 5 m west, and keep the first spot under 20 degrees. Trace the first three passes on the board: 0, then 5 and -5, then 10 and -10. Ask where it will land, then show the Search, then fly slide.

It's working when: spot is None is what stops the search at the first match: once spot has a value, the condition is false for every later e. Without it, the loop would keep the last match instead, the farthest.

Fill in the vocabulary, and trace the first three passes on the worksheet.
13 to 22Guided practice (We do)
Fix it, then the pole
Students open the link or scan the QR code. A short guide runs the starter (it tips on 19.4 degrees), changes 20 to 6, and takes the same program to Level 12, the south pole. Speed up and Slower, under the scene, change how fast time runs, up to 16 times. The landing comes out the same at any speed, because the program runs on the lander's own clock. The round play button runs the program from the start; the arrow beside it puts the lander back, hovering 500 m up.

Watch for: Students who pick 12, the legs' limit. It lands, on 8.9 degrees here and 11.4 at the pole, with almost no margin; ask what an error of 2 degrees in the map would do.

Follow the guide. Copy each print line and landing into the table.
22 to 37Independent practice (You do)
Three searches
Students replace the search with two other versions (on the worksheet): west to east, one loop from -150 to 150, and the flattest spot, which keeps the lowest slope it has seen. They run each on Level 11 and Level 12 (Levels, in the menu bar) and record the spot, its slope, the fuel used and the time. Walk the room with the What to look for questions.

If they ask: "At the pole, change 6 to 1. What does the print line say, and why does the program stop?" No match

Watch for: Students who decide from Level 11 alone. The three searches differ by 4 kg there and by 63 kg at the pole: one test case is not enough.

Fill in the comparison table, and answer the questions.
37 to 45Closure
Which search would you fly? And exit ticket
Show the closure slide and take answers. Push for a justification in terms of fuel, distance, safety margin and how easy the code is to read and check. Hand out the exit ticket.Discuss, then answer the exit ticket.

Before you teach: a fifteen-minute walkthrough

Open mytekdev.com/try/moonlandinglab?lesson=a-safe-spot-at-the-south-pole-searching-real-ground&ref=tpt-moonlandinglab-4. A short guide opens over Level 11, A safe spot. The Moon's gray ground fills the view in low sunlight, with Earth in the black sky. The lander hangs 500 m up. The readout gives the height, the speed (up or down), the throttle and the fuel. The box at the top says the level's goal and, after each run, what happened and why, with the run's own numbers. The strip under the scene draws the height and the speed as the lander comes down, with a line at 3.05 m/s, the fastest the legs take. On this level a colored strip on the ground shows the slope along the lander's line, and the readout adds how far the lander is from the start.

  1. The starter. Before the loop the program searches: for k from 0 to 30, it checks k x 5 m east, then k x 5 m west, and keeps the first spot where lander.slope_at() is under 20. It prints the spot. Then it flies there as Level 10 taught: lean toward it, come down slowly until it is over it, then land on the shrinking target speed. lander.target() counts from the start, so lander.target() + spot is how far the spot still is.
  2. Level 11. Play. The print reads "spot: 5 m east, slope 19.4 degrees", and the lander tips on 19.4 degrees after 51.0 seconds. Change 20 to 6: "spot: -55 m east, slope 3.5 degrees"; it lands on 3.9 degrees after 66.8 seconds, using 309 kg. The landing reads a little steeper than the spot because it touches down half a meter short.
  3. Level 12. Next. The same program at the south pole: "spot: -70 m east, slope 5.7 degrees"; it lands after 89.0 seconds on 410 kg. There is no colored strip here, and the camera cannot see into the shadows; slope_at() reads the map either way.
  4. Speed. Speed up and Slower, under the scene, change how fast time runs, up to 16 times. The landing comes out the same at any speed, because the program runs on the lander's own clock. The round play button runs the program from the start; the arrow beside it puts the lander back, hovering 500 m up. The descent has no randomness: the same program lands the same way on every run and every computer.
  5. Numbers to expect. Level 11 thresholds: 20 tips on 19.4; 15 tips on 14.7; 12 finds 50 m west and lands on 8.9 (307 kg); 6 lands 55 m west on 3.9 (309 kg); 3 lands 60 m west on 0.3 (310 kg). West to east under 6: 80 m west, 313 kg. The flattest: 60 m west, 310 kg. Level 12: 12 lands 50 m west on 11.4 (389 kg); 6 lands 70 m west on 5.7 (410 kg); 3 lands 90 m west on 2.8 (427 kg). West to east under 6: 150 m west, 473 kg, 103.1 s. The flattest: 105 m west on 1.8, 439 kg, 95.6 s. Steps of 1 m: 69 m west, 408 kg; steps of 20 m: 80 m west, 419 kg.
  1. West to east. In place of the four search lines: spot = None then for e in range(-150, 151, 5): then if spot is None and lander.slope_at(e) < 6: then spot = e (the if inside the loop, spot = e inside the if).
  2. The flattest. In place of the four search lines: spot = 0 then for e in range(-150, 151, 5): then if lander.slope_at(e) < lander.slope_at(spot): then spot = e (the if inside the loop, spot = e inside the if).
The slopes along the line every 10 m, as slope_at() reads them from the start. Level 11: 0 m 22.2, -10 20.2, -20 21.4, -30 17.6, -40 15.1, -50 8.2, -60 0.2, -70 2.5, -80 5.0. Level 12: 0 m 17.0, -20 15.2, -40 13.2, -50 11.4, -60 8.9, -70 5.7, -80 3.8, -90 2.8, -150 3.5. At the pole a threshold of 1 finds nothing within 150 m, spot stays None, and the program stops at the line d = lander.target() + spot with "TypeError: unsupported operand type(s) for Add: 'int' and 'NoneType' (line 15)".

Background for the teacher

Both sites are real ground. The Apollo 11 site comes from the Lunar Reconnaissance Orbiter camera's terrain model, a height every 2 m. The south pole is the ridge between Shackleton and de Gerlache craters from the Lunar Orbiter Laser Altimeter's 5 m maps (Barker et al. 2021). Those maps give their own slope error as about 1.5 to 2.5 degrees, which is one reason to search for 6 and not 12. The Apollo Lunar Module's landing gear was designed for a mean slope of 6 degrees or less and 12 at most, the same numbers the app uses.

At the south pole the sun stays within a degree or two of the horizon, so shadows run for kilometers and some crater floors never see sunlight. A camera cannot judge slopes there; a laser can, and landers now carry ones that map the ground from hundreds of meters up. Slopes matter: in 2024 the IM-1 lander came down faster than planned on a slope of about 12 degrees, broke a leg and tipped over.

The search is a linear search, nearest first: each pass of the outer loop steps 5 m further out, and the inner loop checks east, then west. The guard spot is None keeps the first match. A loop from west to east is simpler to read but finds the westernmost match, not the nearest. Keeping the flattest is finding a minimum. With the guard, slope_at() is not called again once a spot is found; the flattest search calls it twice on every one of its 61 passes.

Guidance engineers write programs like these. The Apollo landing programs came from MIT's Instrumentation Lab, and their last phase held a descent rate the commander could step by 0.3 m/s. Aerospace engineers earned a median of $134,960 in May 2025 (U.S. Bureau of Labor Statistics), and guidance, navigation and control is one of their specialties.

What to look for

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

The fourth question is the one that matters. A student who says "at the Apollo site the first spot from the west happened to be close, at the pole it was 150 m away, so you need more than one test" understands why algorithms are compared on several cases. A student who says "west to east is worse" has the result but not the reason.

Cross-curricular extensions

Vocabulary

SlopeHow steep the ground is, in degrees. The legs take 12 degrees or less.
Linear searchChecking items one at a time until one meets the condition.
ThresholdThe number the condition compares against: slope_at(e) < 6.
Nested loopA loop inside a loop. Here the outer one steps the distance out, the inner one checks east and then west.
Hazard mapA map of where it is unsafe to land, made from height data: here, the slopes along the lander's line.
TradeoffGaining one thing by giving up another: a flatter spot that is farther away costs more fuel.

Differentiation

English learners

  • Keep the vocabulary slide up, and point at the lander, the readout or the strip under the scene as you say each word: the picture carries the meaning.
  • Give a sentence frame on a card: I would choose ____ because it uses ____ kg of fuel and lands ____ m away, but it ____.
  • Act it out: a row of desks is the ground, each with a slope on a card; one student walks out from the middle, nearest first, and stops at the first card under 6.

Students with IEPs or 504 plans

  • Pair students, one at the keyboard and one recording results.
  • Give the two other searches on a printed card to copy in.
  • Where the IEP allows a modified assignment, score the first two rubric rows only.

Students who need more support

  • Trace the nearest-first loop together for k = 0 to 3 on the board, with the slopes from the teacher notes.
  • Run the three searches on the projector at Level 12 first, and let students fill in the table from it.
  • The box at the top says what happened after every run, with the slope and the distance.

Students ready for more

  • At the pole, a threshold of 1 finds no spot, and the program stops with an error. Change the program so it lands somewhere safe even then, and explain the choice.
  • Change the steps from 5 m to 1 m and to 20 m. What does a finer search buy, and what does it cost?
  • Open Level 13, On target, least fuel. Which parts of this program would you reuse there?

Adapting for other grades

Younger students: In middle school, run the starter and the fix together on the board, then let pairs try three thresholds (20, 12, 6) at both sites and stop there. Score the first two rubric rows, total 8, and 6 meets the objectives.

Older students: In AP Computer Science, write each search as a function that returns the spot, count how many times each one calls slope_at(), and discuss early return against the spot is None guard.

Moon Landing Lab: A Safe Spot at the South Pole, Searching Real Ground for a Landing

Student worksheet

Name: ______________________________ Date: ______________

Open the app: scan the QR code, or go to mytekdev.com/try/moonlandinglab?lesson=a-safe-spot-at-the-south-pole-searching-real-ground

Essential question: How can a program choose a safe place to land on ground it cannot see?

Warm-up: Parking a bike on a dark hill with a flashlight that shows only the ground under you: how do you find a flat spot? ________________________

  1. Vocabulary. Slope, linear search, threshold, nested loop, hazard map, tradeoff: write each in your own words.
  2. Trace it. The spots checked on passes k = 0, 1 and 2: ________________________.
  3. Level 11 and Level 12. Under 20: spot ____, slope ____, result ____. Under 6 at Level 11: spot ____, landed on ____ degrees, ____ kg. Under 6 at Level 12: spot ____, ____ degrees, ____ kg.
  4. Three searches. West to east: one loop, for e in range(-150, 151, 5):, with the same if inside. The flattest: spot = 0, then one loop from -150 to 150 that keeps e whenever lander.slope_at(e) < lander.slope_at(spot). Level 11, fuel: nearest ____ west to east ____ flattest ____. Level 12, spot and fuel: nearest ____ west to east ____ flattest ____.

1. Why is 6 a safer threshold than 12?

2. Which search would you fly at the pole, and what does it give up?

Moon Landing Lab: A Safe Spot at the South Pole, Searching Real Ground for a Landing

Exit ticket

Name: ______________________________

1. The nearest-first search checks 0, then 5 and -5, then 10 and -10. Which spot does it check next? (A) 15 (B) -15 (C) 20

2. Without spot is None in the condition, the nearest-first search would keep: (A) the first match (B) the last match, the farthest one (C) no match at all

3. A friend says the west-to-east search is just as good, because it cost only 4 kg more at the Apollo site. Use what you learned today to answer.

Answer key: exit ticket

QuestionAnswerWhy
1AThe next pass of the outer loop is k = 3: it checks 15 m east first, then -15.
2BEvery later match would overwrite spot, so it ends at the last one found, the farthest out.
3Open answerOne test is not enough: at the pole west to east found a spot 150 m away and used 63 kg more than nearest first. Compare algorithms on several cases.

Worksheet: what students should find

BlankWhat the app shows
Trace itk = 0: 0 and 0. k = 1: 5 and -5. k = 2: 10 and -10.
Level 11 and Level 12Under 20: 5 m east, 19.4, tipped. Under 6, Level 11: -55, landed on 3.9 degrees, 309 kg. Level 12: -70, 5.7 degrees, 410 kg.
Three searchesLevel 11: nearest 309 kg, west to east 313 kg (80 m west), flattest 310 kg (60 m west, 0.3 degrees). Level 12: nearest -70 on 410 kg, west to east -150 on 473 kg, flattest -105 (1.8 degrees) on 439 kg.
Question 1The map's slopes can be off by about 2 degrees, and the lander may touch down a little off the spot: 6 leaves a margin, 12 leaves none.
Question 2Open answer, justified by fuel, distance, slope margin and how easy the code is to read.
The descent has no randomness: these numbers are the same on every run and every computer. A student whose numbers differ changed something else too, often the step of 5 or the range.

Rubric

Score each row from 1 to 4.

Name: ______________________________

Criteria4 Exceeds3 Meets2 Approaching1 Beginning
Reading the searchTraces the nested loop pass by pass and explains how spot is None stops it at the first match.Traces the first passes and says it keeps the first spot under the threshold.Says it looks for a flat spot, with no detail.No explanation.
Choosing the thresholdChooses a threshold with a margin under 12 and justifies it with the legs' limit and the map's error.Chooses a threshold under 12 that lands at both sites.Lands at one site only.Does not change the threshold.
Comparing searchesRuns three searches at both sites, records each, and justifies a choice by fuel, distance and readability.Runs three searches at both sites and records each.Runs two, or one site only.Does not compare.

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

Standards

The lesson is built for CSTA 3A-AP-15: students write the landing-spot search three ways, a nested loop nearest first, one loop west to east, and a search for the minimum, and justify the one they would fly by readability and by its performance, the fuel and distance it costs. Adapting linear search and finding a minimum to a lander is 3B-AP-10. Running the solutions in a simulation of real Moon terrain against the legs' limits and the fuel is HS-ETS1-4.

FrameworkCodeGradesStandardHow the lesson meets it
CSTA 20173A-AP-159-12Justify the selection of specific control structures when tradeoffs involve implementation, readability, and program performance, and explain the benefits and drawbacks of choices made.Students compare three control structures for the same search (a nested loop with a guard, a single loop, a running minimum) and justify their choice by readability and by performance: the fuel, distance and slope margin each gives at two sites.
CSTA 20173B-AP-1011-12Use and adapt classic algorithms to solve computational problems.Students adapt linear search to check outward from the lander, nearest first, and adapt finding a minimum to keep the flattest spot within 150 m.
NGSSHS-ETS1-49-12Use a computer simulation to model the impact of proposed solutions to a complex real-world problem with numerous criteria and constraints on interactions within and between systems relevant to the problem.Students use the simulation of real Moon terrain to model each proposed search against the criteria (slope 12 degrees or less, within 150 m) and the constraint of fuel, at two sites.

Checked November 2026 against: CSTA K-12 Computer Science Standards, Revised 2017, NGSS High School Engineering Design.

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/moon-landing-lab/lessons/a-safe-spot-at-the-south-pole-searching-real-ground/start instead of the worksheet link. Each one gets their own copy of the starter, and the same link reopens it next time.

Moon terrain in the pictures: NASA/GSFC/Arizona State University (LROC NAC terrain model and orthophoto of the Apollo 11 site); the south pole: NASA LOLA team (NASA/GSFC), Barker et al. 2021, LOLA 5 m site maps.