Lesson plan

Chicken or the Egg

Students code an agent to build enclosures, clone chicken coops, and run a timed experiment to test if chickens lay more eggs with more space.

Chicken or the Egg
Download lesson files
Ages
Ages 11-13
Essential question

Do chickens produce more eggs when given more living space?

Overview

Students investigate whether free-range chickens lay more eggs by designing and automating an agricultural experiment in Minecraft. By comparing egg production across a 5x5 fenced yard, a 10x10 fenced yard, and individual coops, learners combine biological data collection with computer science tools.

Using Code Builder, students script an agent using repeat loops to assemble fence boundaries and use the clone command to duplicate chicken coops using relative or world coordinates. After populating each area, students run a timed trial to record egg counts from chests and analyze differences in their findings.

Learning objectives

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

  • Program an agent using repeat loops to build fenced enclosures of two different sizes.
  • Duplicate an existing chicken coop four times using the clone command with relative or world coordinates.
  • Execute chat commands to spawn designated numbers of chickens into experimental test areas.
  • Collect and interpret egg production data to determine patterns and draw conclusions.

Blocks and items used in this lesson

Key vocabulary

Repeat Loop
A coding structure that repeats a set of instructions multiple times to make programs shorter and more efficient.
Clone Command
A command that captures a rectangular volume of blocks and copies it to another designated location.
Relative Position
Coordinates indicated by tilde marks (~) that represent positions based on the player's current location.
World Coordinates
Specific numerical coordinates that pinpoint an exact three-dimensional location in the world.

Before class

Lesson sequence

  1. Introduction & Setup

    Introduce the engineering challenge: determining if chickens produce more eggs when granted more space. Review the role of loops in reducing code length and explain that students will test a 5x5 area, a 10x10 area, and cloned coops.

  2. Agent Enclosure Construction

    Students open Code Builder to script their agent using chat commands, repeat loops, teleportation, placement toggles, movement, and turns. The agent constructs perimeter fencing around both a 5x5 space and a 10x10 space.

  3. Cloning Chicken Coops

    Students replicate an existing chicken coop to make four adjacent copies. They choose between using relative coordinates (~x ~y ~z) based on player position or entering fixed world coordinates for the lower and upper corners of the coop cuboid.

  4. Spawning & Running the Trial

    Students write a chat command with a repeat loop to spawn five chickens inside the 5x5 pen and five inside the 10x10 pen. They then use a chicken spawn egg to place one chicken into each of the four coops. The experiment runs for roughly 10 minutes while eggs accumulate in chests.

  5. Data Analysis & Reflection

    Learners gather egg counts from each chest and record them individually or compile a shared class data set. The class evaluates whether more space yielded more eggs and discusses the differences between relative and world coordinates.

Assessment: success criteria

  • Agent successfully builds perimeter fences around both 5x5 and 10x10 areas using repeat loops.
  • Four functional chicken coops are created in a row using the clone command.
  • Correct numbers of chickens are spawned into fenced areas and individual coops.
  • Egg count observations are documented and analyzed to answer the central experimental question.

Differentiation

Support

Allow students to work in pairs and offer a coordinate reference sheet to help configure relative clone values.

Stretch

Have advanced students program their coops using world coordinates instead of relative positions and test additional perimeter sizes.

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. 1Why are repeat loops recommended when coding the agent to build fences?

  2. 2How many chickens are spawned into each of the two fenced test areas?

  3. 3What do the tilde symbols (~) indicate in a clone command?

  4. 4How is a chicken placed into each of the four individual cloned coops?

  5. 5For approximately how long should students let the experiment run before counting eggs?

Resources

Part of the Code for STEM curriculum

This is lesson 5 of 20 in Code for STEM.

  1. 3-D Fractions
  2. Aquarium
  3. Build a Dam
  4. Canyon Arch Bridge
  5. Chicken or the Egg
  6. Creeper Tower Test
  7. Energy Transfer
  8. Forces
  9. Hour of Code: AI for Good
  10. Minecraft Code Town
  11. Molecules
  12. Number Line Railroad
  13. Plate Motions
  14. Road Construction Ahead
  15. Scale
  16. Slope
  17. Surface Area and Perimeter
  18. Units of Measurement
  19. Walled Fortress
  20. Wave Properties

Frequently Asked Questions

Can students complete this lesson in groups?

Yes. Teachers can organize students individually or in small groups depending on their comfort level with Code Builder commands.

Where are the laid eggs gathered during the experiment?

Chicken eggs accumulate in chests at each testing station or coop, where students can easily count and record them.

Adapted from Chicken or the Egg by John Miller on Minecraft Education, last updated Jun 3, 2022. 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