0001 #include "_share/util.h" 0002 #include "stack/stack.h" //使用栈 0003 #include "Cell.h" //迷宫格点类 0004 0005 int labySize; 0006 Cell* startCell; 0007 Cell* goalCell; 0008 0009 #include "neighbor.h" 0010 #include "advance.h" 0011 0012 #include "displayLaby.h" 0013 #include "laby.h" 0014 0015 #include "randLaby.h" 0016 #include "readLaby.h" 0017 0018 /****************************************************************************************** 0019 * 迷宫寻径 0020 ******************************************************************************************/ 0021 int main ( int argc, char* argv[] ) { 0022 srand ( ( unsigned int ) time ( NULL ) ); //设置随机种子 0023 ( 1 < argc ) ? readLaby ( argv[1] ) : randLaby(); //使用指定迷宫文件,或随机生成 0024 labyrinth ( laby, startCell, goalCell ) ? //启动算法 0025 printf ( "\nRoute found\a\n" ) : 0026 printf ( "\nNo route found\a\n" ); 0027 getchar(); 0028 return 0; 0029 }