43 static int find_free_point(
char **maze,
int *
x,
int *
y,
int xc,
int yc,
int xsize,
int ysize);
67 char **maze = (
char **)calloc(
sizeof(
char *), xsize);
68 for (i = 0; i < xsize; i++) {
69 maze[i] = (
char *)calloc(
sizeof(
char), ysize);
73 for (i = 0; i < xsize; i++) {
74 maze[i][0] = maze[i][ysize-1] =
'#';
76 for (j = 0; j < ysize; j++) {
77 maze[0][j] = maze[xsize-1][j] =
'#';
135 for (i = 2; i < xsize-2; i++) {
145 for (j = 2; j < ysize-2; j++) {
199 if (yc < ysize-2 && xc > 2 && xc < xsize-2) {
200 int cleartest = (
int)maze[xc][yc+1]+(
int)maze[xc-1][yc+1]+(
int)maze[xc+1][yc+1];
202 cleartest += (
int)maze[xc][yc+2]+(
int)maze[xc-1][yc+2]+(
int)maze[xc+1][yc+2];
203 if (cleartest == 0) {
210 if (yc > 2 && xc > 2 && xc < xsize-2) {
211 int cleartest = (
int)maze[xc][yc-1]+(
int)maze[xc-1][yc-1]+(
int)maze[xc+1][yc-1];
213 cleartest += (
int)maze[xc][yc-2]+(
int)maze[xc-1][yc-2]+(
int)maze[xc+1][yc-2];
214 if (cleartest == 0) {
222 if (xc < xsize-2 && yc > 2 && yc < ysize-2) {
223 int cleartest = (
int)maze[xc+1][yc]+(
int)maze[xc+1][yc-1]+(
int)maze[xc+1][yc+1];
225 cleartest += (
int)maze[xc+2][yc]+(
int)maze[xc+2][yc-1]+(
int)maze[xc+2][yc+1];
226 if (cleartest == 0) {
234 if (xc > 2 && yc > 2 && yc < ysize-2) {
235 int cleartest = (
int)maze[xc-1][yc]+(
int)maze[xc-1][yc-1]+(
int)maze[xc-1][yc+1];
237 cleartest += (
int)maze[xc-2][yc]+(
int)maze[xc-2][yc-1]+(
int)maze[xc-2][yc+1];
238 if (cleartest == 0) {
254 switch (dirlist[
count]) {