prvy
This commit is contained in:
parent
fb9c572281
commit
eb8de40367
@ -20,6 +20,7 @@ int main(){
|
||||
" x ",
|
||||
" x ",
|
||||
" ",
|
||||
" ",
|
||||
};
|
||||
char maze[SZ*SZ];
|
||||
memset(maze,' ',SZ*SZ);
|
||||
|
BIN
sk1a/main.o
BIN
sk1a/main.o
Binary file not shown.
16
sk1a/maze.c
16
sk1a/maze.c
@ -7,28 +7,28 @@ int solve_maze(char* maze,int size) {
|
||||
int i = 0;
|
||||
int p, l, h, d = 0;
|
||||
while(i != size*size-1){
|
||||
if (maze[i + 1] == ' ' && i != size - 1 && l != 1) {
|
||||
if (maze[i + 1] == ' ' && i % size - 1 && l != 1) {
|
||||
maze[i + 1] = '*';
|
||||
i++;
|
||||
p = 0;
|
||||
l = 0;
|
||||
h = 0;
|
||||
d = 0;
|
||||
} else if (maze[i + size] == ' ' && i != size - 1 && h != 1) {
|
||||
} else if (maze[i + size] == ' ' /*&& i < size*size - size*/ && h != 1) {
|
||||
maze[i + size] = '*';
|
||||
i = i + size;
|
||||
p = 0;
|
||||
l = 0;
|
||||
h = 0;
|
||||
d = 0;
|
||||
} else if (maze[i - 1] == ' ' && i != 0 && p != 1) {
|
||||
} else if (maze[i - 1] == ' ' /*&& i % size*/ && p != 1) {
|
||||
maze[i - 1] = '*';
|
||||
i--;
|
||||
p = 0;
|
||||
l = 0;
|
||||
h = 0;
|
||||
d = 0;
|
||||
} else if (maze[i - size] == ' ' && i > size && d != 1) {
|
||||
} else if (maze[i - size] == ' ' /*&& i >= size*/ && d != 1) {
|
||||
maze[i - size] = '*';
|
||||
i = i - size;
|
||||
p = 0;
|
||||
@ -40,19 +40,19 @@ int solve_maze(char* maze,int size) {
|
||||
while(1){
|
||||
|
||||
if (maze[i + 1] == ' ' && i != size - 1 && l != 1) {
|
||||
i++;
|
||||
//i++;
|
||||
break;
|
||||
}
|
||||
if (maze[i + size] == ' ' && i != size - 1 && h != 1) {
|
||||
i = i + size;
|
||||
//i = i + size;
|
||||
break;
|
||||
}
|
||||
if (maze[i - 1] == ' ' && i != 0 && p != 1) {
|
||||
i--;
|
||||
//i--;
|
||||
break;
|
||||
}
|
||||
if (maze[i - size] == ' ' && i > size && d != 1) {
|
||||
i = i - size;
|
||||
//i = i - size;
|
||||
break;
|
||||
}
|
||||
p = 0;
|
||||
|
BIN
sk1a/maze.o
BIN
sk1a/maze.o
Binary file not shown.
BIN
sk1a/program
BIN
sk1a/program
Binary file not shown.
Loading…
Reference in New Issue
Block a user