Skip to content

Latest commit

 

History

History
24 lines (16 loc) · 1.19 KB

README.md

File metadata and controls

24 lines (16 loc) · 1.19 KB

Rat in Maze Problem Solving Using C++

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.

How to Use

  1. Create an input.txt file with the maze matrix (0s and 1s).
  2. Compile and run the source.cpp program.
  3. The program will find and print a path from source to destination if possible.

Features

  • 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.

Input

Screenshot 2023-08-20 004500

Output

Screenshot 2023-08-20 004523