Probabilistic cellular automaton for fire propagation with real-time OpenGL visualization.
Braise is a visual fire propagation simulation based on a probabilistic cellular automaton. The initial grid can start with a 5x5 square of burning cells in the center, or with a fire front from one of the four cardinal directions (east, west, north, south). The fire spreads according to probabilistic rules.
- A burning cell (yellow) becomes burnt (black) in the next generation
- A green cell ignites with probability
pif at least one neighbor is burning - A burnt cell remains burnt
- Green (0): Unburnt cell
- Yellow (1): Burning cell
- Black (2): Burnt cell
sudo apt install g++ libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libx11-dev libfmt-dev libspdlog-devmakeThe simulation requires three mandatory parameters and one optional parameter:
./build/braise <height> <width> <probability> [front]Parameters:
height: Number of rows in the grid (integer)width: Number of columns in the grid (integer)probability: Ignition probability (float between 0.0 and 1.0)front(optional): Fire front starting positioneast: Fire starts from the eastern edge (right side)west: Fire starts from the western edge (left side)north: Fire starts from the northern edge (top)south: Fire starts from the southern edge (bottom)- If not specified, fire starts in a 5x5 square in the center
Examples:
# Default: 5x5 square in the center
./build/braise 100 100 0.5
# Fire starting from the eastern edge
./build/braise 100 100 0.5 east
# Fire starting from the northern edge
./build/braise 100 100 0.5 northOr using the Makefile (uses default parameters):
make runbraise/
├── include/
│ └── fire.hpp # Simulation function declarations
├── src/
│ ├── fire.cpp # Cellular automaton logic
│ │ # - generation(): computes next generation
│ │ # - neighbors(): counts burning neighbors
│ └── main.cpp # OpenGL interface and render loop
├── Makefile # Build script
└── README.md
- Rendering engine: OpenGL with GLUT (double buffering)
- Update frequency: 50ms per generation
- Random generator: Mersenne Twister (std::mt19937)
- Neighborhood: 8 neighbors (Moore neighborhood)
- Logging: spdlog for debugging
Apache License 2.0
