Skip to content

elias-utf8/braise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Braise

Probabilistic cellular automaton for fire propagation with real-time OpenGL visualization.

Description

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.

Simulation Rules

  1. A burning cell (yellow) becomes burnt (black) in the next generation
  2. A green cell ignites with probability p if at least one neighbor is burning
  3. A burnt cell remains burnt

Cell States

  • Green (0): Unburnt cell
  • Yellow (1): Burning cell
  • Black (2): Burnt cell

Installation

Dependencies

sudo apt install g++ libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev libx11-dev libfmt-dev libspdlog-dev

Build

make

Usage

The 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 position
    • east: 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 north

Or using the Makefile (uses default parameters):

make run

Project Structure

braise/
├── 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

Technical Details

  • 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

License

Apache License 2.0

About

Probabilistic cellular automaton for fire propagation with OpenGL

Topics

Resources

Stars

Watchers

Forks

Contributors