Pathfinder_AI is a part of Assignment 2A for the COS30019 - Introduction to Artificial Intelligence. This project implements search algorithms such as DFS, BFS, GBFS, ASTAR and 2 custom methods.
Pathfinder_AI/
│__ Assignment2A.pdf #project report
├── Assets/ # Visuals, structure diagrams
├── methods/ # DFS, BFS, GBFS, ASTAR, CUS1, CUS2
├── pseudocode/ # Pseudocode references
├── tests/ # Input graph test files
├── utils/ # Graph + Heuristic utility functions
│
├── GUI.py # Graphical search visualizer
├── search.py # Command-line search executor
├── requirements.txt # Required dependencies
├── create_test.py # Path testing helper
├── TreeBasedSearch.ipynb# Jupyter testing notebook
├── README.md # Project information
Search methods are implemented as a class with a search(self, graph, origin, destination)
method.
The input graph is taken from the input text file stored in tests/test*.txt
by using utils/graph.py
.
We use Euclidean distance in utils/heuristics.py
for GBFS and A* (suited to 2D graphs).
Manhattan distance can be added in the future for other environments.
Use the command line to run the script with your input graph file and method:
python3 search.py <path_to_input_text_file> <search_method>
Example:
python3 search.py tests/test2.txt DFS
- Install requirements:
pip install -r requirements.txt
Or manually:
pip install pygame
- Run the GUI version:
python GUI.py tests/test2.txt DFS
- Press Enter when prompted to start the visual traversal.
The execution output required by the assignment looks like this:
<input_text_filename> <search_method>
<destination_goal> <number_of_nodes_in_path>
<full_path>
Example:
tests/test2.txt GBFS
11 8
1 3 5 6 7 9 10 11
test1.txt
– Basic pathfinding testtest3.txt
– Larger graph with multiple branchestest4.txt
– Multi-destination test with forked pathstest5.txt
– Edge case with multiple potential goal pathsDFS_test.txt
– Specifically designed for DFS validationBFS_test.txt
– BFS-focused graph structureGBFS_test.txt
– Heuristic-based graph to test GBFSASTARTest.txt
– Test case targeting A* algorithmCUS1_test.txt
– Designed for Uniform Cost Search (CUS1)CUS2test.txt
– Tailored for the custom CUS2 algorithmPathFinder-test.txt
– Overall integrated scenario testing
- Follows assignment rule: stops at first reachable goal
- Expands nodes in ascending order using
sorted()
- All methods return both the path and cost
- Modular codebase built for easy extension
- Ananda Pathiranage Ruveen Thathsilu Jayasinghe - 104317649
- Denver Cope - 104738758
- Rahat Alam - 103810105
- Fayiz Kallupalathingal - 104658733
- Course: COS30019 - Introduction to Artificial Intelligence
- Semester: 2025 HS1