How arminzolfaghari/searching-algorithms-ids-bbfs-astar works
Project type and purpose
• This is a standalone Python AI project (not a web or microservice application) that implements and compares three search algorithms—Iterative Deepening Search (IDS), Bidirectional Breadth-First Search (BBFS), and A*—to solve a simple path-finding puzzle. It provides both a command-line interface (CLI) and a graphical interface (GUI).
File structure
• Top-level scripts:
• main.py – entry point, parses user choice (CLI vs. GUI) and algorithm selection
• GraphicalInterface.py – GUI layer (renders grid, handles user events)
• AStar.py, BidirectionalBreadthFirstSearch.py, IterativeDeepeningSearch.py – the three core search algorithms
• AdditionalFunctions.py – shared utilities (e.g., parsing input, heuristics)
• Node.py – state representation for search nodes
• Data directories:
• input/ – test maps
• Assets/ – image/sprite assets for GUI
• result/ – output logs and result files
• Configuration/build: no external build system, pure Python modules.
README for insights
• Confirms purpose (push butter to plate optimally), describes invocation (main.py → choose algorithm), shows GUI screenshots, references PDF descriptions.
Main components & relationships
a. Components:
• User Interface Layer
– CLI handler (in main.py)
– GraphicalInterface (in GraphicalInterface.py)
• Core Logic Layer
– Search engines: IDS, BBFS, A* modules
– Shared utilities: AdditionalFunctions.py
– State model: Node.py
• Data Layer
– Input loader: reads map text files from input/
– Output writer: writes to result/
– Asset manager: loads images from Assets/
b. Interactions:
1. User → main.py (selects CLI or GUI + algorithm)
2. main.py → Data loader reads the selected input file
3. main.py (or GUI) initializes Node for start state
4. main.py (or GUI) invokes chosen search module, passing Node(s) and utility functions
5. Search module → AdditionalFunctions & Node for expansions, heuristics
6. Algorithm returns a path (sequence of moves)
7. main.py (or GUI) → directs result to console, result/*.txt, and/or GUI canvas
8. GUI layer visualizes moves using Assets
c. Architectural patterns & principles:
• Layered architecture separating UI, business logic (search algorithms), and data I/O
• Single-responsibility per module: each algorithm in its own file, Node encapsulates state, utilities separated
• Plug-and-play: adding a new search algorithm only requires dropping a new .py and hooking it in main.py
d. Key technologies/libraries:
• Python 3.x standard library (no external dependencies specified)
• Possibly Tkinter or Pygame (in GraphicalInterface.py)
• File I/O, text parsing for input maps