I wrote the labyrinth, but I know that all the path can be output, I hope that each master stab is
#include #include #define m 5 # define n 5struct queue {int x; int y; int pre;} SQ [200]; int maze [m 2] [N 2 ]; typedef struct {Int Dx; INT DY;} Moved; Moved Move [8]; Typedef struct {int x; int y;} road; road road [m * n]; void inimove (Moved Move []) / * Initialize Move [] * / {Move [0] .dx = 0; Move [0] .dy = -1; Move [1] .dx = 1; Move [1] .dy = -1; Move [2]. DX = 1; Move [2] .dy = 0; Move [3] .dx = 1; Move [3] .dy = 1; Move [4] .dx = 0; Move [4] .dy = 1; MOVE [5] .dx = -1; Move [5] .dy = 1; Move [6] .dx = -1; Move [6] .dy = 0; Move [7] .dx = -1; Move [7 ] .dy = -1;} void INPUT (int Maze [M 2] [N 2]) {INT I, J; Char CH; for (i = 0; i <= m; i ) / * set the Wall outside the maze * / {maze [i] [0] = 1; maze [i] [n 1] = 1;} for (j = 0; j <= n 1; j ) / * set the wall Outside the maze * / {maze [} [j] = 1;} for (i = 1; i <= m; i ) / * Input the data of maze * / for (j = 1; j <= n; j ) {CH = getCH (); maze [i] [j] = (int) (CH-48); Printf ("% 3d", CH-48); Prin TF (""); if (! (j% n)) printf ("/ n");}}
Void Output / * Output The Path * / {INT I, J, K; For (J = 0, K = Rear; (K! = 0) && (J