🗂️ main.c
#include <stdio.h>
#include <time.h>
#include "maze_gen.h"
#include "search.h"
#include "display.h"
#include "analysis.h"
int main() {
Maze maze;
initMaze(&maze, 21, 21);
generateMaze(&maze);
clock_t start, end;
int pathLength, expandedNodes;
printf("=== Maze Escape AI ===\n");
displayMaze(&maze);
printf("\nChoose algorithm: 1.DFS 2.BFS 3.A*\n> ");
int choice;
scanf("%d", &choice);
start = clock();
if (choice == 1)
DFS_Search(&maze, &pathLength, &expandedNodes);
else if (choice == 2)
BFS_Search(&maze, &pathLength, &expandedNodes);
else
AStar_Search(&maze, &pathLength, &expandedNodes);
end = clock();
double timeUsed = (double)(end - start) / CLOCKS_PER_SEC * 1000;
printf("\n=== Search Result ===\n");
displayMaze(&maze);
printf("\nPath Length: %d | Expanded Nodes: %d | Time: %.2f ms\n",
pathLength, expandedNodes, timeUsed);
saveResult(choice, pathLength, expandedNodes, timeUsed);
freeMaze(&maze);
return 0;
}