diff --git a/sk1a/main.o b/sk1a/main.o index 330aa67..c7ee5e6 100644 Binary files a/sk1a/main.o and b/sk1a/main.o differ diff --git a/sk1a/maze.c b/sk1a/maze.c index 5f09bc8..d078bb5 100644 --- a/sk1a/maze.c +++ b/sk1a/maze.c @@ -3,6 +3,23 @@ #include "maze.h" #include -int solve_maze(char* maze,int size){ - return 0; +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; } diff --git a/sk1a/maze.o b/sk1a/maze.o index e73ecc2..c8ded7d 100644 Binary files a/sk1a/maze.o and b/sk1a/maze.o differ diff --git a/sk1a/program b/sk1a/program index 6045c16..1c484b5 100644 Binary files a/sk1a/program and b/sk1a/program differ