This program solves the classic Rat in a Maze problem using Depth First Search (DFS) algorithm. The maze is read from the input.txt
file, where the maze matrix is given with '0' representing the open path and '1' representing a blocked path. The rat navigates from the source to the destination, finding a valid path.
- Create an
input.txt
file with the maze matrix (0s and 1s). - Compile and run the
source.cpp
program. - The program will find and print a path from source to destination if possible.
- Utilizes DFS algorithm for maze traversal.
- Input maze is read from a text file.
- Output path is displayed in the console.
Feel free to use and modify the code according to your needs.
Note: This implementation assumes that the maze is represented as a 2D matrix, and the source is at (0,0), and the destination is at the last cell.