Elementary · Grade 4 / Science / 20–30 minutes
Build-a-Habitat
Change a habitat. Follow the ripple effects.
Plan your lesson
Teacher notes
Explore how water, sunlight, temperature, and organisms shape a wetland. Predict a change, run the simulation, and explain what happened.
The full guide below comes from the artifact’s original README. Its development and validation notes describe the original build.
Download teacher notes (.md)Build-a-Habitat
Open the app
Double-click index.html in this folder. Keep all app files together, including habitat.png and organisms-atlas.png. It works without installation, internet, an account, or a server. Use a current Chrome, Edge, Firefox, or Safari browser. No student responses leave the browser; reloading clears the session.
What students learn
Fourth graders investigate how water, light, temperature, food, and nutrient recycling connect organisms. They predict, change conditions, observe several years, explain causes, and revise an experiment. The wetland food web is plants → pond snails → ducks, with fungi and bacteria recycling nutrients. Real ducks eat other foods; this deliberately simplified model uses only snails as their prey.
Bars and icons show relative abundance, not exact counts. One added group represents a small starting population. Consumers respond to the previous year's food supply, so some effects take time. Habitat Health combines the presence of food-web roles, plant abundance, water stress, and annual population change; it is a classroom clue, not a scientific ecosystem score. Gentle difficulty slows changes. No randomness or scores reward clicking.
A 20–30 minute lesson
- Notice (3 minutes): Open the starting habitat together. Identify producers, herbivores, predators, and decomposers. Ask what each needs.
- Predict (4 minutes): Students change just one condition, or choose one challenge. Choose or write a prediction and give a reason.
- Test and observe (5 minutes): Select Run the Habitat. Review the year buttons after it finishes. Describe which population changed first and which changed later.
- Explain (5 minutes): Read the brief explanations and complete “I changed… / This caused… / I think this happened because…”. Use the bars and earlier years as evidence. Surprising predictions are opportunities to investigate, not wrong answers.
- Revise (5–8 minutes): Share the written explanation before changing controls. Reset, make one different change, and predict again. Compare the experiments aloud or record them on paper. Ask: “What would you change next?”
Each run begins with the groups and conditions currently selected, not the previous run's final populations. Changing controls clears the old prediction, results, and explanation fields so each experiment has its own prediction. Reset Habitat restores the teacher's saved starting settings and clears the challenge. It works during an animation, too.
Exactly where to customize
- In the app: Open Teacher Settings near the bottom. Change the activity title, ecosystem name, organism names and availability, starting conditions, difficulty, challenge availability, and simulated years (3–8). Apply Teacher Settings starts a fresh habitat. These settings last until the page is reloaded.
- Permanent classroom content: Edit the clearly labeled CLASSROOM CONFIGURATION in config.js.
CLASSROOM_CONFIGholds the title, ecosystem, years, difficulty, starting conditions, and organism list. Each organism needs a uniqueid,name,role,emoji, startinggroups(0–6), andenabled. Keep roles asplant,herbivore,predator, ordecomposer. TheENVIRONMENTandCHALLENGESarrays below it hold labels and descriptions. - Another ecosystem: Change that configuration, replace habitat.png, and update its image description in index.html. Also revise species-specific explanations in app.js and the food-web assumptions and environmental responses in simulation.js. Changing a name alone does not make wetland relationships appropriate to a desert or ocean.
- Model behavior: simulation.js contains the pure, deterministic
HabitatModel.simulatefunction and comments describing assumptions. Water reflects starting water, rainfall, and heat. Growth also depends on light and nutrients. Challenges apply in Year 1; drought rainfall recovers after Year 2, while its ecological effects can persist. The disappearing-plant challenge removes the first present plant species in the configured list. - Organism placement:
HABITAT_VISUALSat the bottom of config.js maps each organism ID to a sprite cell, a habitat zone, a size, and stable anchor points. The atlas is a 3-column, 2-row transparent PNG. The scene preserves the backdrop’s 3:2 ratio so these points stay on the same land or water at every screen size. Add a visual mapping for each new organism ID; unmapped organisms still appear in controls and population totals. - Appearance and layout: styles.css controls color, type, responsive layout, and animation. Reduced-motion preferences are respected.
- Interface and result language: app.js controls input, playback, predictions, explanations, and teacher settings. index.html contains the page structure and reflection prompts.
Limits worth discussing with students
This model omits migration, disease, seasons, age groups, alternate prey, and many other factors. A population at zero does not reappear by itself. The plant-loss challenge can therefore permanently remove a species. Empty habitats are valid experiments. Populations can increase and later decrease; use the timeline instead of only the final year. Explanations describe model relationships, not proof of a single real-world cause.
Validation notes
The simulation and interface-controller checks passed, including all environmental controls, organism bounds, challenge choices, prediction requirements, year navigation, reset during playback, empty habitats, and teacher settings. The model was also checked across 200 condition combinations. Visual browser verification could not be completed because the available preview browser blocks local-file URLs. Browser layout and native control behavior still need a classroom-device check.
Improved habitat illustrations
Ducks use a swimming illustration with submerged feet. Grasses are anchored to marsh banks, lilies to open water, and decomposer fungi to logs on land. Snails appear on submerged rocks in a labeled, magnified pond-bottom view. Only surface organisms bob gently; rooted plants and fungi remain still. Groups retain their positions as populations change.
The mushroom illustration represents visible decomposer fungi, not bacteria. Bacteria also occur in water and sediment and are not visible at this scale. The scene key makes this distinction. Snails graze on algae and other plant material; the model still combines plant food into one simplified producer resource.
Background reading: Missouri Department of Conservation: pond snails and National Park Service: decomposing fungi.
Artwork generation
organisms-atlas.png was created with the built-in image-generation tool. Final prompt: “A transparent 1536×1024 sprite atlas, exactly 3 columns × 2 rows. Top row: rooted green marsh grass with muddy base; white water lily on a flat lily pad; mallard swimming low with feet and lower belly submerged and a small water ripple. Bottom row: freshwater pond snail on an algae-covered submerged stone; tan decomposer fungi growing on a decaying log; empty transparent cell. Isolated illustrations with clear gutters, paper-cut editorial nature style in teal, leaf green, and earth brown. No text, borders, emoji styling, or visible duck feet.”
Behind the activity
The original AI prompt
Generated in ChatGPT using 5.6 High, then run in ChatGPT Codex using GPT-6 Astra Medium. The text is preserved as supplied; it describes the requested build, rather than a guarantee that every requirement was implemented exactly.
Read the full creation prompt
Build a polished, interactive educational web app called “Build-a-Habitat” for elementary students in 4th grade. GOAL The app should help students understand that organisms depend on environmental conditions and on one another, and that changing one part of an ecosystem can have consequences elsewhere. This should feel like a small interactive science simulation, not a worksheet or quiz. TECHNICAL REQUIREMENTS - Create a self-contained browser-based app that runs locally with no installation, login, API key, backend, or internet connection. - Prefer a simple structure such as index.html plus CSS and JavaScript. - Do not use external APIs. - Make it responsive and attractive on both a classroom projector and student laptop/tablet. - Use large readable text, strong visual hierarchy, accessible controls, and age-appropriate design. - Avoid excessive text. - Include a prominent “Reset Habitat” button. - Keep code organized and easy for another teacher or developer to modify. CORE EXPERIENCECreate an illustrated ecosystem scene in which the student can build and change a habitat. Start with a wetland ecosystem, but design the app so the teacher can easily substitute another ecosystem later. Include adjustable environmental variables such as: - rainfall - temperature - sunlight - available water Include selectable organisms from different roles such as: - plants/producers - herbivores - predators - decomposers Students should be able to add or remove organisms and adjust environmental conditions. After making choices, the student clicks a button labeled:“Run the Habitat” Simulate several years of ecosystem change. Show visible changes in: - plant abundance - herbivore population - predator population - overall ecosystem stability Use simple, educationally sensible relationships rather than pretending to model ecology precisely. For example: - too little water should reduce plant growth - fewer plants should eventually reduce herbivores - fewer herbivores should affect predators - adding too many predators should affect prey - changing rainfall or temperature should sometimes produce cascading effects PREDICT → TEST → EXPLAINBefore the simulation runs, ask:“What do you predict will happen?” Allow the student to select or type a short prediction. After the simulation: 1. Show what changed visually. 2. Give a concise explanation of WHY the changes occurred. 3. Compare the result with the student’s prediction. 4. Ask one short reflection question such as: “What would you change next?” VISUALIZATIONInclude: - an attractive habitat illustration - simple animated or visually changing populations - small population indicators or bars - a timeline showing Years 1–5 - a clear “Habitat Health” indicator Do not overwhelm elementary students with numerical precision. DISCOVERYInclude several optional challenge cards such as: - “A drought lasts two years.” - “A new predator arrives.” - “One plant species disappears.” - “Rainfall increases.” - “What happens if there are no decomposers?” Let students predict before applying the challenge. TEACHER MODEInclude a small “Teacher Settings” panel that can be opened or collapsed. Allow the teacher to customize: - title of the activity - ecosystem name - organisms available - starting environmental conditions - whether challenge cards are enabled - difficulty level - number of simulated years Put the easily editable classroom content in a clearly labeled configuration section in the code. PEDAGOGICAL PRINCIPLESDesign the app around:Prediction → experimentation → observation → explanation → revision. Do not reward random clicking.Do not simply tell students whether they are “right” or “wrong.”Encourage causal reasoning:“When X changed, Y changed because…” Add a “Explain My Habitat” section at the end where students complete:“I changed ______.”“This caused ______.”“I think this happened because ______.” POLISHMake this feel like something an excellent elementary science teacher would be excited to put in front of students tomorrow. Use playful but not childish visuals.Add subtle animation where useful.Include a very short onboarding instruction when the app first opens. Before finishing: - run the app - test all controls - check for broken states - verify that the simulation produces understandable cause-and-effect behavior - make improvements to the interface if anything feels confusing Finally, create a short README explaining: 1. what students learn, 2. how a teacher can use it in a 20–30 minute lesson, 3. exactly where a teacher can customize the content.
Your next experiment
Make it your own
Start with Teacher Settings inside the activity. For a larger change, copy the original prompt and change the grade, subject, learning goal, and scenario. Keep the prediction, evidence, explanation, and revision cycle.
Ask the AI to explain the changes and the model’s assumptions. Try the revised activity yourself before teaching with it, including unusual inputs and the classroom devices students will use.
These adaptation suggestions were added for this resource hub; they are not part of the original prompt.