Lesson plan

We Need Beets!

Program the Agent to till and plant beets across expanding farm plots using functions, loops, and code comments.

We Need Beets!
Ages
Ages 8-10
Duration
45 min
Essential question

How can functions and code comments help us simplify and organize complex programming tasks?

Overview

In this intermediate computer science lesson, students discover how to streamline their programs by creating reusable functions and documenting their logic with code comments. Learners explore how complex farming tasks can be broken down into repeatable sequences and solved using different algorithmic approaches.

Set on a rooftop farm, students transfer beet seeds to the Agent and program it to till and plant soil. As the farming space grows from a single block into an 11-block line, two rows, and eventually an 11x11 plot, students apply repeat loops, nested loops, and custom functions to guide the Agent successfully to the finishing gold block.

Learning objectives

By the end of this lesson students will be able to:

  • Build and execute a custom function to automate tilling and planting seeds.
  • Write code comments to document and track program logic during development.
  • Apply repeat loops and nested loops alongside functions to farm larger areas.
  • Test and debug code to ensure the Agent navigates plots correctly.

Blocks and items used in this lesson

Key vocabulary

Function
A named set of code instructions that performs a specific action and can be reused throughout a program.
Code Comment
A note written in a program that explains what the code does without altering how it runs.
Nested Loop
A loop positioned inside another loop to repeat actions across multiple rows or layers.
Debugging
The process of identifying, testing, and fixing mistakes in computer code.

Before class

Lesson sequence

Suggested timing: about 45 minutes in total.

  1. Warm-up and Agent Setup10 min

    Introduce the rooftop farm setting and explain that students will need to grow a large supply of beets. Have students collect beet seeds from the chest, place them into the Agent's inventory, and explore the Agent block drawer to prepare for coding.

  2. Activity 1 & 2: Single Planting to an 11-Block Line10 min

    Guide students through Activity 1 to code the Agent to till soil and plant a seed. Next, transition to Activity 2 where the Agent faces an 11-block row of dirt; students use the Plant Seed function inside a repeat loop sequence to complete the entire row.

  3. Activity 3: Two-Row Planting with Nested Loops10 min

    Introduce Activity 3, where students program the Agent to plant two parallel rows of beets. Have students incorporate nested loops to repeat their row-planting routine and reposition the Agent between lines.

  4. Activity 4: The 11x11 Farm Challenge10 min

    Present the 11x11 dirt plot framed by blue and white checker blocks. Students combine their custom functions and nested loops to fill the entire area with crops, testing and debugging until the Agent completes the field and stops on the gold block.

  5. Review and Formative Assessment5 min

    Lead a closing reflection using the performance assessment questions. Have students explain what a function does, why code comments are helpful, and how different algorithms can accomplish the same planting objective.

Assessment: success criteria

  • The Agent successfully tills and plants an 11-block dirt line using the Plant Seed function.
  • Nested loops and functions are used correctly to plant across multiple rows.
  • Code comments or notes are included to document the student's program structure.
  • The Agent completely fills the 11x11 plot and concludes on the gold block.

Differentiation

Support

Have struggling learners trace the Agent's movement for a single row before assembling nested loops for multi-row plots.

Stretch

Challenge advanced students to write an alternative algorithm that completes the 11x11 plot using fewer total code blocks.

Knowledge check

5 questions to check understanding after the lesson. Tap an answer to see if it is right; the score appears at the end.

  1. 1What is the primary purpose of a function in coding?

  2. 2Why is it valuable to include comments or notes in your code?

  3. 3How do students program the Agent to plant the 11-block line in Activity 2?

  4. 4Which programming technique is introduced in Activity 3 to manage planting multiple rows?

  5. 5On which block must the Agent finish its path after planting the 11x11 plot in Activity 4?

Resources

Part of the Coding Fundamentals curriculum

This is lesson 16 of 17 in Coding Fundamentals.

  1. Basic Moves and the Agent
  2. Coding Challenge
  3. Dinosaur Run
  4. Earth’s Moon & Mars
  5. Ganymede (Jupiter's Moon) & Saturn's Rings
  6. Gray Wolves
  7. Mercury and Venus
  8. Minecraft Space Center
  9. Panda's Protected Habitat
  10. Polar Bear Rescue
  11. Revisiting Biomes
  12. Revisiting Planets
  13. Sea Turtle Assistance
  14. The Experiment
  15. Uranus’ Rings and Neptune's Moon, Triton
  16. We Need Beets!
  17. Wild West

Frequently Asked Questions

Where do students get the beet seeds for the Agent?

Students retrieve seeds from a chest located on the rooftop farm and place them directly into the Agent's inventory before running their code.

What prior experience do students need for this lesson?

This is an intermediate lesson that builds on earlier Block 1 and Block 3 concepts, particularly basic Agent movement and simple loops, though nested loops are reintroduced during instruction.

How can student understanding be assessed at the end of the lesson?

Teachers can review the four core questions on functions, code comments, player events, and coding concepts through an oral check or by using the printable assessment sheet found in the educator guide.

Adapted from We Need Beets! by Minecraft Education on Minecraft Education, last updated Sep 16, 2023. This classroom version, the timings and the quiz were written by 9Minecraft Education.

You May Also Like

9Minecraft Education is an independent teaching resource and is not affiliated with Mojang or Microsoft. Lesson plans here are our own classroom-ready adaptations; each one links to the original resource and credits its author. © 2026 9minecraft.net