As mountainous regions warm, the distribution of many species is pushed further and further up mountains where their preferred cooler temperature ranges can be found. But this can isolate populations, and eventually push species off the top of mountains.
Before we start coding, we need to think about what are the important aspects of how trees grow, reproduce and spread. How do these change over time, what factors ( such as temperature) effect these dynamic aspects of tree growth, and spread. Some of these we features we will build into or model, and see how the system behaves.
We will start very simply, learning about scratch programming and ecology and climate change as we go. Once we have the simplest part of the system simulated, we will go back, and add more and more behaviours that will make our simulation increasingly useful and realistic. When we finish we will know a lot of new programming techniques, we will understand how and why modelling and simulation are powerful ways to explore complex systems like ecology and climate change.
Step 1 - Biology Concept - Trees Grow
Individual tree gets taller/wider each year – the sprite’s size increases by 1 every time the “New_Year” broadcast is received, so pupils watch linear growth in real time.
Link between time and biological change is made explicit – one broadcast = one year, so learners can count years on the screen and relate that count to size gained.
Scratch / computational-thinking outcomes delivered by the code as-is
Sequential simulation loop – “New_Year” broadcast triggers a single if Sim_Is_Running block that increments age and then size, modelling discrete annual time-steps.
Boolean flow-control – the purple button flips Sim_Is_Running on/off, pausing growth without resetting anything; learners meet the idea of a flag that gates repeated behaviour.
Restart routine – green button broadcasts “ReStart”, resetting size to 20 %, demonstrating clean state initialisation before a new experimental run. This is good practice, for when a sketch or program becomes very big, complex and has many elements and actions. Responding to a broadcast is a simple way to ensure all relevant actions are taken in all places.
Direct size manipulation – change size by 1 shows how a visible property can be driven by code, forming the basis for later linkage to environmental variables.
Step 2 - Biology Concept - (that were absent before)
Determinate growth – trees stop getting taller/wider once they reach a species-specific age (Growth_Limit_Age).
Reproductive phase – adults produce cones/flowers only after that age threshold, illustrating allocation shift from growth to reproduction.
Senescence and mortality – individuals have a fixed maximum life-span (Maximum_Age); afterwards the tree dies and is visually marked as a dead stem.
Standing dead biomass & decomposition cue – gradual ghost effect mimics loss of needles and eventual disappearance, introducing nutrient cycling without extra code.
NEW blocks in the spruce sprite
Private variable My_Age (initialised to 0 on ReStart).
Constants Growth_Limit_Age = 50 and Maximum_Age = 100.
Inside New_Year:
change My_Age by 1
Growth rule: only while My_Age < Growth_Limit_Age → change size by 1
Reproduction signal: when My_Age ≥ Growth_Limit_Age and My_Age < Maximum_Age → switch costume to “spruce small flower” (cone-bearing adult).
Senescence/mortality: when My_Age ≥ Maximum_Age → switch costume to “spruce small dead” and begin fading (change ghost effect by 5 each loop until invisible → hide or deletion not yet shown).
Control sprites (images 9 & 10) – no change except the age-constant displays now list the new variables; Button4 still toggles Sim_Is_Running, Button5 still provides the 0.5 s clock and reset.
ICT / computational-thinking skills newly acquired at this stage
Private variable to track individual state – each tree now keeps its own My_Age; learners meet the idea that age ≠ simulation-year.
Compound conditional logic – if A and B block controls flowering costume, showing how several criteria combine to trigger a life-stage switch.
Sequential life-stage machine – seedling → adult → dead, implemented with costumes and Boolean tests, foreshadowing finite-state machines.
Gradual visual removal – looping change ghost effect introduces the concept of fading rather than instant deletion, a simple animation pattern.
Parameter constants – Growth_Limit_Age and Maximum_Age are stored as variables, teaching the practice of naming constants for easy adjustment instead of hard-coding numbers in multiple places.
These additions transform the previous “grow-for-ever” demo into a life-cycle model: growth ceases, reproduction is signalled, and death finally removes the individual—biological realism achieved with only a handful of new blocks.
Step 3 - Biology Concepts - newly covered in this build
Complete decomposition cycle – dead trees remain visible for exactly twice their life-span (Maximum_Age × 2), then fade away, signalling that organic matter has broken down and nutrients are returned to the soil.
Standing dead phase = habitat & carbon pool – the ghost-costume period represents snags used by insects, fungi, birds, and the slow release of stored carbon.
Time-lag between death and disappearance – learners see that ecological “removal” is gradual, reinforcing why disturbance history can be read from still-standing dead stems.
ICT / computational-thinking skills newly acquired at this stage
Compound age-check with timer-like behaviour – if My_Age > Maximum_Age * 2 introduces multiplication inside a condition and shows how to keep counting after the biologically important event (death).
Iterative fade effect – looping change ghost effect by 5 each New_Year until fully transparent teaches a simple animation pattern for gradual sprite removal without instant deletion.
State persistence beyond functional life – the sprite stays in the world for a predefined extra period, demonstrating that objects can hold visual or data value even when their main role is finished.
Constants used as multipliers – hard-coded factor of 2 makes the extra persistence time explicit and adjustable, encouraging pupils to treat magic numbers as named variables later.
These additions give the tree a full life-cycle: grow → reproduce → die → decompose, while pupils practise conditional arithmetic and controlled visual fade-out—foundations for later population-level processes such as nutrient cycling or fire fuel accumulation.
Step 4 - Biology Concept
Step 5 - Biology Concept
Step 6 - Biology Concept
Mountaintop “escalator”
Spruce growth, survival and seedling establishment all depend on the value of that slider through the orange custom block calc growth factor.
Drag the slider slowly and the band of suitable climate creeps uphill; new clones still appear because seeds can reach the newly-suitable regions—students watch the forest “crawl” upward.
Drag the slider quickly (several steps in a few simulated years) and the viable climate band jumps beyond the dispersal range; no new seedlings establish, the existing trees live out their Maximum Age, then the whole population disappears—an immediate visual of “migration debt” leading to local extinction.
Range geometry
Because the backdrop is cone-shaped, every 100 m gain in elevation removes a larger fraction of total area; population size drops faster than the temperature increase, illustrating why tropical mountaintop species are especially extinction-prone.
Time-lag between climate change and population crash
The purple run/pause button lets learners freeze time. They can inspect a forest that still looks healthy although the slider has already moved outside the species’ niche, realising that the standing trees are a legacy of past climate and that extinction debt can take decades to become visible.
Biological parameters embedded in the code
Thermal response curve (built into the calc growth factor), maximum longevity (Maximum Age), and age at first reproduction (Growth Limit Age) are the minimum set needed to produce the two outcomes above.
Students see that altering the slider speed alone decides survival versus disappearance, linking basic life-history traits to large-scale biogeography.
Complex but slow systems become explorable
A 30-second drag of the scrollbar compresses centuries of warming; the immediate response of the forest makes climate-velocity concepts tangible without extra features.
Cloning with private state – one sprite definition → unlimited trees, each owning My Age, position, and size.
Global variable driven by UI slider – Temperature shift is changed directly by the scrollbar; all clones react every tick, demonstrating shared environment variables.
Custom reporter as sub-model – calc growth factor packages the species’ climate response; learners encounter abstraction without extra blocks.
Event broadcasts for synchrony – “New Year” triggers growth, “ReStart” resets all data; pause is handled by flipping Sim_Is_Running, freezing the forever loops.
Finite-state visuals – costume changes (small → flower → dead) encode life-stage transitions.
Deterministic user input vs. stochastic dispersal – slider is user-controlled, while initial position uses pick random, separating deterministic forcing from random establishment.
Data export ready – every tick exposes population count and average size; a teacher can show how to capture these in a list for graphing, but no extra code is required.
Extra ideas (NOT in the current sketch)
Add a second tree sprite with a different thermal optimum to show altitudinal zonation.
Introduce a seed-dispersal distance limit block to make the “too fast” extinction even sharper.
Log biomass automatically with a hidden “scientist” sprite and plot it with the Pen extension.