Wildfire Simulator
Summary
If you want a Project Idea with full instructions, please pick one without an asterisk (*) at the end of the title.
Abstract
Wildfires can devastate communities, destroying homes and creating smoke that can affect air quality over huge areas. A wildfire could start from a natural cause like a lightning strike, or humans being careless with cigarette butts or campfires. What if you could predict how a wildfire will spread to help give people an advanced warning to get out of harm's way? Can forest management techniques like controlled burns—intentionally setting smaller, more controlled fires—help reduce the frequency of larger, more catastrophic fires? You can investigate these questions for a science project using a wildfire simulation, which is much safer than setting real fires!
Click the green flag to run this simple wildfire simulation (or click here to edit the code yourself). In the simulation, trees grow at random locations. With each step of the simulation, there is a random chance that a fire will start somewhere. Trees that are touching fire will also catch on fire, allowing the fire to spread.
Watch the simulation run with the default fire probability of 50. You should see that fires are fairly frequent, but they usually stay small and only burn a few trees. Now, slowly decrease the fire probability variable using the slider and watch what happens. Fires will become less frequent, but you may see occasional enormous fires that almost burn down the entire forest! This demonstrates what can happen when forest growth is left unchecked with no management. The right conditions can lead to a huge, disastrous fire.
Here is another version of the simulation (and here is the link to the code). This one only simulates one fire at a time, each time you click the green flag. It counts the total number of trees burned in each fire. For a science project, can you run the simulation many times and make a histogram of fire sizes? What shape, or distribution, does the histogram have? How does the shape change if you change the parameters in the simulation, such as the tree size or number of trees?
These are basic simulations that do not account for weather effects like wind and rain, undergrowth like brush and grass that can help fire spread, or management techniques like controlled burns. Can you modify the programs to add any of these things to your simulation? Here are some ideas for what you could do:
- Add patches of brush or grass in addition to the trees. These patches can be larger than the trees, making it easier for fire to spread from tree to tree, even if the trees are not touching.
- Add "wind" that makes the fires move so they spread more easily.
- Add rain in random locations that can extinguish fires.
- Experiment with the timing of the simulation by changing the values in the
waitblocks or turning on Turbo mode in Scratch. - Add controlled burns, or fires that remove a small number of trees without spreading to adjacent trees.
- Add houses and buildings to the simulation.
- Instead of placing buildings and trees randomly, place them based on real aerial photos or maps of a certain area.
- Let the user act like a firefighter and interact with the simulation. For example, they could click to remove trees, apply controlled burns, or put out fires. Can you make a game where the goal is to protect the buildings from burning down?
Note: the Scratch simulation may start to lag if there are more than about 200 sprites on the screen. Check the official Scratch documentation for limits on the number of sprites/clones and project file size.
Bibliography
This project is inspired by this forest fire simulation, which was featured in this video by Veritasium.
Ask an Expert
Global Goals
The United Nations Sustainable Development Goals (UNSDGs) are a blueprint to achieve a better and more sustainable future for all.
Careers
If you like this project, you might enjoy exploring these related careers:









