Earth's Moon and Mars: Debugging: Educator Guide
Earth's Moon and Mars: Debugging: Educator Guide
Block 2 – Lesson 3
45 minutes
Single Student
EDUCATION.MINECRAFT.NET
THEME OVERVIEW
Tell students:
On our way further out into the solar system, we must make a few stops first.
There are a few robots that have been sent to the surface of our Moon and Mars
that are not working exactly right. Your mission is to go and figure out what is
causing them not to work.
LESSON OBJECTIVES
By the end of the lesson, students will:
• Test and debug their code
• Use an effective debugging process
• Exercise persistence and attention to detail while solving coding puzzles
KEY VOCABULARY
Debugging – The process of finding and removing errors in cod
Persistence – Not giving up; persistence works best when you try things many
different ways, many different times
LESSON ACTIVITIES
Direct Instruction (Teacher-Led; “I Do”)
Welcome back to Coding Fundamentals! (Slide 1)
Review the lesson objectives with students. (Slide 2)
The focus of this lesson is debugging (Slide 3). Inform the students that it is
important to understand that mistakes do happen, and it is important to find
where the mistakes are, so the code runs properly. This will require persistence
and attention to detail. These are the skills that will continue to be of benefit to the
students as they move through their school career.
Tell the students: When error in code occurs, here are the steps to follow to debug
the code: (Slide 4)
Step 1:
Look at the code and read the directions for what process the code is to be
completing.
Step 2:
Run the code. Does it work? If yes, the code is correct. If no, where does the code
stop working? Identify a particular area that is broken.
Step 3:
Remove the code snippets that are wrong, if applicable, run the code one more
time. Does it execute the way you thought it would?
Step 4:
Find where the mistake in the code is and correct the error.
Step 5:
Run the repaired code. If it works you are ready to move on to your next bug. If it
does not work, repeat Steps 2-4 until the code runs successfully.
The student is teleported to the surface of the moon to resolve a debugging issue
of an Agent. The agent needs to move to the left 4 times, destroy down, and move
down. If the Agent detects a stone block forward, it needs to say, “Found the
stone!” destroy forward and collect all. If the stone is not detected, the Agent
needs to say, “No stone here!” At the end the Agent needs to move 1 block up the
surface. This activity needs to repeat 4 times.
Below you can find incorrect and correct variants of the code. The debugging
corrections will cause the activity to complete successfully.
Activity 3: Mars, Tracking Down the Rover (Slides 18-20)
Students will transition to Mars for the next stop. They would need to help find a
rover that was left there a while ago. Everything should still be working on it. Here
is what the Agent is supposed to do: While inspecting forward for a block of quartz
and not finding it, the Agent needs to move forward. If it detects a gold block
down, it needs to turn right. If it detects a block of iron down, it needs to turn left.
In the end the Agent needs to say, “Found the rover!”
It is important for students to understand that although they have the code, it is
not working. It is important to read the instructions from MakeCode carefully.
LESSON CONCLUSION
Upon completion of this lesson students should be able to answer the following
questions: (slides 29-30)
What is correcting
problems within the code
called?
What is important to
remember when you
encounter problems with
your code?