
- Type
- Lesson plan
- Ages
- Ages 11-13
- Skills
- Critical thinking
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
- 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.
- 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.
- 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.
- 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.
- 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
Allow students to work in pairs and offer a coordinate reference sheet to help configure relative clone values.
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.
1Why are repeat loops recommended when coding the agent to build fences?
Answer: B. Loops significantly cut down the amount of code required to perform repetitive construction tasks.
2How many chickens are spawned into each of the two fenced test areas?
Answer: C. The lesson directs students to run a spawn command that places five chickens into each fenced zone.
3What do the tilde symbols (~) indicate in a clone command?
Answer: B. Tildes represent relative positions based on where the player is currently standing.
4How is a chicken placed into each of the four individual cloned coops?
Answer: A. Students are instructed to use a chicken spawn egg to place one chicken into each coop.
5For approximately how long should students let the experiment run before counting eggs?
Answer: C. The experimental trial is designed to run for approximately 10 minutes to gather egg data.
Resources
- Lesson package (.zip)Everything the author attached to this lesson in one download.
- World FileWorld file for student use
Part of the Code for STEM curriculum
This is lesson 5 of 20 in Code for STEM.
- 3-D Fractions
- Aquarium
- Build a Dam
- Canyon Arch Bridge
- Chicken or the Egg
- Creeper Tower Test
- Energy Transfer
- Forces
- Hour of Code: AI for Good
- Minecraft Code Town
- Molecules
- Number Line Railroad
- Plate Motions
- Road Construction Ahead
- Scale
- Slope
- Surface Area and Perimeter
- Units of Measurement
- Walled Fortress
- 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.























