June 2021
Beginner
432 pages
9h 9m
English
This simulation shows a forest whose trees are constantly growing and then being burned down. On each step of the simulation, there is a 1 percent chance that a blank space grows into a tree and a 1 percent chance that a tree is struck by lightning and burns. Fires will spread to adjacent trees, so a densely packed forest is more likely to suffer a larger fire than a sparsely packed one. This simulation was inspired by Nicky Case’s Emoji Sim at http://ncase.me/simulating/model/.
When you run forestfiresim.py, the output will look like this:
Figure 29-1: The forest fire simulation, with green
Read now
Unlock full access