Ada Project
Ada Project
JNANASANGAMA, BELGAVI-590018
RAMYA R 1BI24IS445
TEJASHWINI K S 1BI24IS456
SAHANA K 1BI24IS447
SANDEEP R 1BI24IS451
CERTIFICATE
This is to certify that the implementation of ADA PROJECT (BCS401) entitled “SUDOKU
SOLVER USING BACKTRACKING ALGORITHM” has been successfully completed by
RAMYA R (1BI24IS445), TEJASHWINI K S (1BI24IS456), SAHANA K (1BI24IS447),
SANDEEP R (1BI24IS451) of IVth semester B.E. for the partial fulfilment of the requirements for
the Bachelor's degree in Information Science & Engineering of the Visvesvaraya Technological
University during the academic year 2024-2025.
Course Co-Ordinator:
Pathfinding algorithms are essential tools used in computer science to determine the best path
between two points. These algorithms have wide applications in fields like robotics, artificial
intelligence, gaming, and GPS navigation. In this project, we have implemented and visualized
four popular pathfinding algorithms: Breadth-First Search (BFS), Depth-First Search (DFS),
Dijkstra’s Algorithm, and A* (A-Star) Algorithm.
Each algorithm explores a grid from a given start point to an end point while avoiding obstacles.
The grid is represented as a 2D matrix where 0 indicates free space and 1 indicates obstacles.
The start and end positions are defined by the user, and the shortest or most efficient path is
calculated using the selected algorithm.
BFS (Breadth-First Search) explores level by level and guarantees the shortest path in
unweighted graphs.
DFS (Depth-First Search) goes deep into one direction first, and does not guarantee the
shortest path.
Dijkstra’s Algorithm works well with weighted grids and finds the shortest path based on
minimum cost.
A* Algorithm combines the actual cost with a heuristic (estimated distance) to find the path
more efficiently than Dijkstra.
By comparing the behavior of each algorithm visually, users can understand how different
strategies affect pathfinding performance. This project helps in understanding core algorithmic
concepts such as search strategy, graph traversal, heuristics, and cost optimization.
2024-25 1
Department of ISE
CHAPTER 2
PROBLEM STATEMENT
In many computational and real-life scenarios, finding a path from one point to another
while avoiding obstacles is a fundamental problem. Whether it's a robot navigating through
a warehouse, a GPS calculating a route, or an AI character in a game avoiding walls,
pathfinding is everywhere. In various real-world applications, the ability to find an optimal
path between two points while avoiding obstacles is essential.
• Video Games: Characters or enemies moving across maps with walls or traps.
• Navigation Systems: Finding the shortest driving or walking route from one
location to another.
• Computer Networks: Finding the least-cost path for data packets to travel across
routers.
Step 2: Let the user add obstacles on the grid by entering positions.
Step 3: Ask for the starting point and the end point from the user.
# for obstacles
Dijkstra's Algorithm
A* (A-Star) Algorithm
The program tries to find a path from the start to the end, avoiding obstacles.
Step 8: The user can try again with a different algorithm or exit.
b. If it is the destination, trace back the path using the parent array.
If the cell is valid and unvisited, mark it visited, set its parent, and enqueue it.
b. If it is the destination, trace back the path using the parent array.
If the cell is valid and unvisited, mark it visited, set its parent, and push it.
3. Dijkstra's Algorithm
Initialize distance of all nodes as infinity except the start node, which is set to 0.
If new cost is lower, update distance, set parent, and push it to the queue.
4. A* (A Star) Algorithm
Initialize g-cost of all nodes as infinity except start, which is 0.
Push the start node into the priority queue with f = g + heuristic.
If new g-cost is better, update it, set parent, and push with new f to the queue.
Figure 5.1: Initial Grid Setup: Start and End Point with Obstacle Placement
This program effectively demonstrates how various pathfinding algorithms like BFS, DFS,
Dijkstra, and A* can be used to navigate a grid from a starting point (S) to an endpoint (E) while
avoiding obstacles. Each algorithm has its own way of exploring the grid: BFS uses a level-by-
level approach to find the shortest path, DFS goes deep and may not always find the most
efficient route, Dijkstra guarantees the shortest path by considering least cost, and A* combines
both distance and cost to find the optimal path more efficiently. By visualizing the paths taken
by each algorithm, the program offers a clear and practical understanding of how pathfinding
works in real-world scenarios like maps, games, and robotics. It serves as an educational tool
to compare algorithm behavior and efficiency in a simple, visual format.