26 lines
628 B
C
26 lines
628 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "maze.h"
|
|
#include <assert.h>
|
|
|
|
int solve_maze(char* maze,int size) {
|
|
int i = 0;
|
|
while(i != size*size-1){
|
|
if (maze[i + 1] == ' ' && i != size - 1) {
|
|
maze[i + 1] = '*';
|
|
i++;
|
|
} else if (maze[i + size] == ' ' && i != size - 1) {
|
|
maze[i + size] = '*';
|
|
i = i + size;
|
|
} else if (maze[i - 1] == ' ' && i != 0) {
|
|
maze[i - 1] = '*';
|
|
i--;
|
|
} else if (maze[i - size] == ' ' && i > size) {
|
|
maze[i - size] = '*';
|
|
i = i - size;
|
|
}
|
|
}
|
|
|
|
return 1;
|
|
}
|