A real-time terminal-based fire evacuation simulation featuring advanced AI pathfinding algorithms including A*, Dijkstra's algorithm, BFS, and hybrid adaptive pathfinding. This C++ simulation demonstrates intelligent agent behavior, emergency evacuation scenarios, and dynamic algorithm selection for optimal escape routes.
fire-evacuation-simulator.mp4
- A* (A-Star) - Heuristic-based optimal pathfinding
- Dijkstra's Algorithm - Weighted pathfinding with fire danger zones
- BFS (Breadth-First Search) - Guaranteed shortest path
- Hybrid Adaptive - Dynamic algorithm switching based on conditions
- Multi-Objective - Balances safety vs speed with configurable weights
- Dynamic Fire Spread - Probabilistic propagation to adjacent cells
- Fire-Aware Pathfinding - Algorithms adapt to avoid dangerous zones
- Real-time Danger Assessment - Continuous fire proximity evaluation
- Adaptive Decision Making - Agents switch algorithms based on situation
- Individual Intelligence - Each person uses optimal pathfinding strategy
- Real-time Path Recalculation - Responds to changing fire conditions
| Key | Action | Description |
|---|---|---|
Q |
Quit | Exit simulation |
M |
Manual Mode | Step-by-step control |
A |
Auto Mode | Continuous simulation |
SPACE |
Next Step | Advance one step (manual mode) |
- Windows OS (uses Windows Console API)
- C++ Compiler (GCC, MinGW, MSVC, or Clang)
- C++11 Standard or later
-
Clone Repository
git clone https://github.com/yourusername/fire-evacuation-simulator.git cd fire-evacuation-simulator -
Compile
g++ -std=c++11 -O2 -o fire_sim.exe main.cpp Grid.cpp Person.cpp Fire.cpp SimulationManager.cpp PathfindingAlgorithms.cpp
-
Run
./fire_sim.exe
- PathfindingAlgorithms - Multiple algorithm implementations with dynamic selection
- Person (AI Agent) - Adaptive intelligence with real-time strategy switching
- Grid Management - Building layout, visualization, and obstacle handling
- Fire System - Spreading fire mechanics with danger zone calculation
- SimulationManager - Real-time orchestration and statistics
๐ฆ fire-evacuation-simulator/
โโโ main.cpp # Application entry point
โโโ Position.h # 2D coordinate system
โโโ Grid.h/.cpp # Building layout & visualization
โโโ Person.h/.cpp # AI agent with pathfinding
โโโ Fire.h/.cpp # Fire spread mechanics
โโโ PathfindingAlgorithms.h/.cpp # Advanced pathfinding library
โโโ SimulationManager.h/.cpp # Simulation orchestration
โโโ README.md # Documentation
| Algorithm | Best For | Time Complexity | Use Case |
|---|---|---|---|
| A* | Speed with heuristics | O(b^d) | Early stages, low fire danger |
| Dijkstra | Safety-prioritized | O((V+E)logV) | High fire danger situations |
| BFS | Shortest path guarantee | O(V+E) | Simple scenarios |
| Hybrid | Dynamic adaptation | Variable | Changing conditions |
| Multi-Objective | Balanced decisions | O((V+E)logV) | Complex scenarios |
| Symbol | Meaning | Description |
|---|---|---|
P |
Person | AI agent using pathfinding |
F |
Fire | Spreading danger zone |
E |
Exit | Emergency evacuation point |
# |
Wall | Impassable structure |
|
Empty | Safe walkable space |
// Add walls in Grid::initializeGrid()
cells[row][col] = '#';
// Add exits
exits.push_back(Position(x, y));// Adjust spread rate in Fire::spread()
if (rand() % 100 < 40) { // 40% spread rate
newFires.push_back(neighbor);
}// Multi-objective optimization
findPathMultiObjective(grid, start, goal, fires,
0.8, // Safety weight
0.2); // Speed weight- Computer Science Education - Algorithm visualization and comparison
- Emergency Management Training - Evacuation planning and bottleneck analysis
- Research - Multi-agent systems and optimization problems
- Algorithm Benchmarking - Performance comparison in dynamic scenarios
Intelligent selection based on fire proximity, simulation time, distance to goal, and fire density.
- People rescued/casualties/active evacuees
- Success rate and simulation steps
- Individual agent algorithm status and positions
For Linux/macOS: Replace Windows-specific headers and console functions.
MIT License - see LICENSE file for details.
Keywords: Fire evacuation simulation, pathfinding algorithms, A* algorithm, Dijkstra algorithm, BFS pathfinding, emergency evacuation, AI simulation, C++ pathfinding, adaptive algorithms, multi-objective optimization, emergency planning, crowd simulation, building evacuation, fire safety simulation, intelligent agents, real-time pathfinding, evacuation modeling, emergency response training, computer science education, algorithm visualization.