Coding activity
Pattern Trains
Build colorful pattern trains using blocks, LEGO, or colored paper. Each train car follows a pattern rule. Can you keep the pattern going?
Materials and setup
- colored blocks or LEGO bricks
- paper
- markers
How this changes by age
Pre-K (ages 3–4)
Build colorful pattern trains using blocks, LEGO, or colored paper. Each train car follows a pattern rule. Can you keep the pattern going?
Steps
- Line up colored blocks or LEGO bricks in a pattern: red-blue-red-blue.
- Say: 'This is a pattern train! What color comes next?'
- Child extends the pattern by adding 3-4 more cars.
- Try a new pattern: red-red-blue-red-red-blue (AAB).
- Let the child create their own pattern train for you to continue!
- Tell a grown-up one thing that surprised you.
Learning objectives
- Recognize and extend repeating patterns with 2 elements
- Understand that patterns follow a rule that repeats
- Create original patterns for others to follow
Kindergarten (ages 5–6)
Create complex pattern trains and learn to write the pattern rule. Translate patterns between colors, shapes, and sounds. Discover patterns in code!
Steps
- Build an ABBC pattern with blocks: red-blue-blue-green-red-blue-blue-green.
- Write the pattern rule using letters: A-B-B-C.
- Translate the same pattern to sounds: clap-stomp-stomp-snap.
- Create a pattern with 4+ elements and write its rule.
- Discuss: 'In coding, loops are patterns that repeat. Your pattern train is like a loop!'
- Tell a grown-up one thing that surprised you.
Learning objectives
- Create and extend complex patterns with 3-4 elements
- Represent patterns abstractly using letter notation
- Translate patterns across different modalities (color, sound, shape)
Early elementary (ages 6–8)
Discover and create mathematical patterns including growing patterns, Fibonacci-like sequences, and pattern rules that use operations. Write pattern rules as formulas and predict the 10th, 20th, and 100th element.
Steps
- Review repeating patterns (ABAB), then introduce growing patterns: 2, 4, 6, 8... or 1, 4, 9, 16... (squares).
- Build growing patterns with blocks: row 1 has 1 block, row 2 has 3 blocks, row 3 has 5 blocks. What comes next? Draw the pattern.
- Write the rule as a formula: 'Each row has 2 more blocks than the last' or 'Row n has (2n - 1) blocks.'
- Explore the Fibonacci pattern: 1, 1, 2, 3, 5, 8, 13... (each number is the sum of the two before it). Build it with blocks and predict the next 5 numbers.
- Create your own growing pattern with a secret rule. Write down the first 5 elements and challenge someone to figure out the rule and predict elements 6-10.
- For each pattern, predict what the 20th element would be without building all 20. Explain your reasoning.
- In one sentence, tell a parent or sibling what surprised you today.
Learning objectives
- Distinguish between repeating patterns and growing patterns
- Express pattern rules as verbal descriptions and simple algebraic formulas
- Apply pattern rules to predict elements far beyond the visible sequence
Upper elementary (ages 8–10)
Hunt patterns in the real world, then translate one into pseudocode with a FOR loop and trace it by hand to verify it matches reality.
Steps
- Go outside and find 5 patterns in nature or the built world: pinecone spirals, leaf veins, sunflower seeds, brick walls, sidewalk cracks, fence pickets, tile grout lines, etc.
- Photograph each pattern. Bring the photos back inside and lay them out.
- Pick ONE pattern that interests you most. Describe its rule in plain English first (e.g., 'each row adds 2 more bricks' or 'each spiral count is the sum of the two before it').
- Write pseudocode using a FOR loop that would print the pattern's first 10 elements. Example for a Fibonacci-like sequence: a=1, b=1, FOR i in 1..10: print(a), c=a+b, a=b, b=c.
- Trace through your code by hand on paper. Write down the value of every variable after each loop iteration in a tracing table.
- Verify that the 10 values your code prints actually match the real pattern in your photo. If they don't match, find the bug in your pseudocode and fix it.
- In one sentence, tell a parent or sibling what surprised you today.
Learning objectives
- Observe and document mathematical patterns in the natural and built environment
- Translate a real-world pattern into pseudocode using a FOR loop and variables
- Verify program correctness by hand-tracing variable state against observed reality
Safety and evidence note
Read the full activity before beginning. An adult should supervise tools, heat, food, outdoor work, movement, and experiments as appropriate. Completion records that the activity was done; the child’s explanation, work sample, photo, or demonstration is stronger evidence of learning than a completion check alone.
Related coding activities
AI Explorers
Train a pretend 'robot brain'! Show it 5 cat pictures and 5 dog pictures, then test if it can guess a new one.
Algorithm Art
Follow step-by-step drawing instructions to create a picture. The instructions are your algorithm! Each step adds one shape or line.
API Restaurant
Play restaurant! The customer tells the waiter what they want, the waiter tells the kitchen, and the kitchen makes it. The waiter is the messenger — just like how computers talk to each other!
App Design Workshop
Design your dream app! Draw what you'd see on a phone screen. What would your app do? What buttons would it have?