All Activities

Harvesting Crops with 'Loops'

Harvesting Crops with 'Loops'
Green highlight

Write and run simple loop-based programs to harvest crops on a grid, automating repeated actions and observing how loops save steps.

Orange shooting star
Background blob
Challenge Image
Skill Badge
Table of contents

Step-by-step guide to Harvesting Crops with Loops

What you need
Paper with a 5x5 grid, pencil, eraser, small tokens such as buttons or coins, coloring materials like crayons or markers, ruler optional

Step 1

Draw a clear 5 by 5 grid on your paper using the ruler so each square is the same size.

Step 2

Place one token on every square to act as a crop so the whole field is full.

Step 3

Pick the top left square as your starting spot and mark it with a colored dot showing the robot faces right.

Step 4

On the paper write the three commands you will use as single words on a list: HARVEST FORWARD TURN_RIGHT.

Step 5

Write out the long command sequence to harvest the first row without a loop as this exact list: HARVEST FORWARD HARVEST FORWARD HARVEST FORWARD HARVEST FORWARD HARVEST and count how many commands you wrote.

Step 6

Write a loop version on the paper that does the same row using fewer commands like this: HARVEST then repeat 4 times { FORWARD HARVEST }.

Step 7

Type or drag the row loop version into your coding tool exactly as you wrote it so the robot can run it.

Step 8

Run the program and watch the robot harvest the first row to check the loop worked.

Step 9

Now write a full field program in your coding tool using this precise pseudocode so it harvests all five rows:

Step 10

Run the full field program and watch the robot harvest every token on the 5 by 5 grid.

Step 11

Count how many individual commands you would have had to write without loops for the whole field then count how many commands your looped program used and write down the difference to see how many steps you saved.

Step 12

Share a photo or description of your finished harvesting program and what you learned about loops on DIY.org

Help!?

What can I use instead of the tokens, ruler, or coding tool if I don’t have them?

Use coins, buttons, or cereal pieces as tokens, use a book edge or straight object as a ruler, mark the top-left start with a sticker or colored pen, and if your usual coding tool is unavailable type the exact loop text into any simple text editor before copying it into the platform.

My robot didn’t harvest the first row when I ran the program — what should I check?

Verify the top-left square is marked with a colored dot showing the robot faces right and that you typed or dragged the row loop exactly as 'HARVEST then repeat 4 times { FORWARD HARVEST }' into your coding tool, correcting any misspelled command, wrong repeat number, or missing braces.

How can I change the activity for younger or older children?

For younger kids, shrink the task to a 3x3 grid and have an adult place tokens and enter 'HARVEST then repeat 2 times { FORWARD HARVEST }', while older kids can expand to a 7x7 grid, add TURN_RIGHT obstacles between rows, or create nested loops and compare command counts as in the counting step.

How can we extend or personalize the harvesting challenge after finishing the basic program?

Personalize the field with different colored tokens or stickers, alter the pseudocode to include TURN_RIGHT steps for row changes exactly as in the full-field program, time your looped run, and then write down and share the command-savings comparison and a photo on DIY.org.

Watch videos on how to Harvest Crops with Loops

0:00/0:00

Here at SafeTube, we're on a mission to create a safer and more delightful internet. 😊

How scientists are working with farmers to develop the crops of the future

4 Videos
How scientists are working with farmers to develop the crops of the future

How scientists are working with farmers to develop the crops of the future

Farmers use ropes to carry crops upward from low ground

Farmers use ropes to carry crops upward from low ground

Handheld Rice Harvester in Action: Efficient Small-Field Harvesting Technique

Handheld Rice Harvester in Action: Efficient Small-Field Harvesting Technique

How American Farmers Harvest 9.97 Million Tons of Rice by Machine | Farming Documentary

How American Farmers Harvest 9.97 Million Tons of Rice by Machine | Farming Documentary

Facts about introductory programming and loops

🌾 Loops can replace dozens (or hundreds) of repeated steps with just a few lines of code — saving time and preventing mistakes.

🤖 Karel the Robot, created in 1981 by Richard E. Pattis, is a classic educational robot used to teach loops and grid-based programming.

🐢 Logo’s turtle graphics helped generations of kids learn loops by drawing repeating patterns like spirals and grids.

🔁 Nested loops (a loop inside a loop) are perfect for walking every square of a grid — great for harvesting rows and columns automatically.

🚜 Real farms use repetitive patterns too: harvesters and agricultural robots often follow straight rows, just like looped programs do on a grid.

How do you run the Harvesting Crops with Loops activity?

Set up a grid representing a field and place crop markers in some squares. In a block or text coding editor (like Scratch or Blockly), write a short loop such as “repeat 5: move forward; harvest” to automate repeated actions. Run the program, watch the avatar harvest, then tweak the loop count or add turns to cover rows. Count manual steps versus looped steps to see how loops save effort and simplify the program.

What materials are needed for Harvesting Crops with Loops?

You need a computer, tablet, or laptop with a kid-friendly coding platform (Scratch, Blockly, Code.org). Optional supplies: a printed grid or whiteboard, crop tokens or stickers, pencil and paper for planning, and a timer. An adult or teacher can help set goals and explain loop logic. No special hardware is required—many classrooms use free web-based editors to run simple loop programs.

What ages is the Harvesting Crops with Loops activity suitable for?

This activity fits children roughly ages 6–12. Younger kids (6–8) do well with block-based editors and guided help, using simple “repeat” loops. Ages 9–12 can learn nested loops and plan multi-row harvests independently. For preschoolers, use a hands-on version with tokens and an adult turning a crank or counting repeats, while older teens can extend it with variables and optimization challenges.

What are the benefits of learning loops through the harvesting activity?

Practicing loops builds computational thinking: recognizing patterns, sequencing, and breaking tasks into repeatable steps. Children learn efficiency by comparing many single-step commands to a short loop, which strengthens problem-solving and debugging skills. The activity also reinforces counting and planning, encourages perseverance when programs don’t work first try, and makes abstract coding concepts concrete and fun through a hands-on, game-like scenario.

Ready to create?

Drop Files here
Make

To create a safe space for kid creators worldwide!

Create

Vibe Coding

Kids GPT

All Tools

Kibu

Resources

Worksheets

SafeTube

Blog

FAQ

Account

Pricing

Log-in

Sign-up

Data Deletion

Company

About

Community Guidelines

Privacy Policy

Terms of Service

2025, URSOR LIMITED. All rights reserved. DIY is in no way affiliated with Minecraft™, Mojang, Microsoft, Roblox™ or YouTube. LEGO® is a trademark of the LEGO® Group which does not sponsor, endorse or authorize this website or event. Made with love in San Francisco.