Maze solving is the art and science of finding a path from start to finish through complex pathways. It's not just a puzzle, it's a fundamental challenge in robotics, artificial intelligence, and algorithm design that simulates real-world navigation problems.
Maze solving bridges theory with practice in the most engaging way possible. While you learn algorithms in lectures, here you implement them in action!
This project gives you hands-on experience with two critical engineering skills:
- Numerical computation
- Algorithm development
- Data visualization
- Pathfinding algorithms (Ex: DFS, BFS, A*)
- Optimization techniques
- Real-time decision making
- Problem-solving strategies
Every maze presents unique challenges that teach you:
- Spatial reasoning - Understanding 2D navigation
- Sensor interpretation - Making decisions with limited information
- Efficiency optimization - Finding the shortest/fastest path
- Debugging skills - When your algorithm gets stuck
Option A: Download ZIP (Recommended for Beginners)
- Click the green "Code" button above
- Select "Download ZIP"
- Extract the files locally in any folder of your choice
Option B: Clone the GitHub Repository
git clone https://github.com/[your-username]/MazeSolver.gitMazeSolver/
βββ config/
β βββ generate_random_maze.m
β βββ maze_def.m
βββ controller/
β βββ your_controller.m <-- YOUR ALGORITHM GOES HERE (your_controller.m)
βββ robot/
β βββ init_robot.m
β βββ sense_robot.m
β βββ update_robot.m
βββ visualization/
β βββ draw_maze.m
β βββ draw_robot.m
βββ main.m <-- RUN SIMULATION FROM HERE (main.m)
-
Open MATLAB
-
Navigate to the MazeSolver folder
- Use the "Current Folder" browser to navigate to your extracted/cloned folder
- Run the main file
- Double-click on
main.min the file browser
- Double-click on
- Run the simulation
- Click the "Run" button or press F5
-
Add to Path (First time only)
- If prompted, select "Add to Path" to allow MATLAB to access all files
-
Start the simulation
- Enter your entry number and select a level (1-6)
- Level 1-5 are predefined fixed examples
- Level 6 is the main level (random everytime) for final runs
The project comes with a basic right-wall follower algorithm implemented by default: (Note for level 1 this algorithm works well, the final stats file are saved in .txt file on successful completion)
Note in the image above all the stats are very intutive run the example algorithm in the first level.
- The triangle shows the bot, where the head shows the front of the bot, and right or left are in POV of Bot.
- The blue trace shows where it moved
- Orange dots are produced at turns (looks cool visually)
- The small red dots in blue line (are the locations stored in saved_path[]), by default it is capturing all the locations
Important: The only file you need to modify is your_controller.m. This is where you implement your maze solving algorithm.
Understanded the commented lines to understand in detail.
- Always run from
main.m - Use full screen for better statistics readability
- Adjust speed by modifying
bot_speedin line 10 of main.m (no other changes needed in main)
- Levels 1-5: Predefined example mazes for practice
- Level 6: Random maze generator (main challenge level)
- Represented as matrices (0 = wall, 1 = path)
- Starting position: (2,2)
- Goal position: Bottom-right corner ,i.e., at ((Max Row - 1), (Max Column -1)) location

-
your_controller code is expected for submission, as well as screenshots as you progress and justifications for methods used
-
TRY BEST 2-3 ALGORITHMS FOR SUBMISSIONS, stating the pros and cons among them.
-
Reference Score: Scoring system inbuilt, just for reference for the participant themselves
-
Main Evaluation (for competition):
- Random maze solving capabilities (on average performance, will be checked on multiple mazes)
- Code quality and structure
- Algorithm creativity and novelty
- Shortest path finding achievement (More like the bot is exploring dead ends to, save in array only the main path(fastest) removing the dead end paths)
- Time to complete
Saved path should be ideally something like (I have enlarged red dots for visibility of how the array should look at the end)
When your simulation completes successfully, a statistics file will be saved automatically. Save this file along with your code for submission.
- Understand the basics
- Learn how sensors work
- Master basic movement commands (forward, turn, stop)
- Implement simple decision-making (if-else logic)
- Implement classic algorithms
- Master wall-following techniques (right-hand/left-hand rule)
- Implement memory-based navigation (avoiding loops)
- Develop goal-seeking behavior
- Enhance performance metrics
- Minimize steps and turns
- Reduce collisions
- Find shortest paths
- (Think: "If I had to go again, which path should I follow to reach fastest, considering I already did the dry run?")
- Create something new and original
- Combine multiple algorithms
- Implement adaptive strategies
- Push the boundaries of what's possible
The robot has three binary sensors (1=open, 0=wall):
- Front: Cell directly ahead
- Left: Cell to the left
- Right: Cell to the right
- 1: Move forward
- 2: Turn left
- 3: Turn right
- 4: Stay (penalized in scoring)
- Every participant is requested to go through all the files and understand the coding part, will be helpful for your intution for designing the controller
- There can be minor updates still required in repo, in case you feel some improvements contact us
- Use LLM's for your benefit, though plagiarism will be strictly checked, but support can be taken from LLM's in case of difficulty of putting your thoughts to code
- This is special, Consider you instead of bot, and you are solving a maze what will you be doing, from the given information.
Feel free to fork this repository, experiment with different algorithms, and submit pull requests with improvements!
For questions or issues, please:
- Check the code comments in each file
- Review the example algorithms provided
- Contact the Robotics Club, IIT Ropar robotics@iitrpr.ac.in or Aman Mittal, 2023eeb1182@iitrpr.ac.in
Happy Coding and Happy Maze Solving! π―
"The only way to learn a new programming language is by writing programs in it." - Dennis Ritchie







