This commit is contained in:
Damián Korpesio 2022-01-20 08:09:00 +01:00
parent 4c1881da8c
commit f1770847de

View File

@ -19,16 +19,16 @@ return 1;
if(issafe(maze, x, y, size) == 1) { // znazornenie stien if(issafe(maze, x, y, size) == 1) { // znazornenie stien
maze[x * size + y] = '*'; maze[x * size + y] = '*';
if (backtracking(maze, x, y + 1, size) == 1) { if (backtracking(maze, x, y + 1, size) == 1) { //pohyb doprava
return 1; return 1;
} }
if (backtracking(maze, x + 1, y, size) == 1) { if (backtracking(maze, x + 1, y, size) == 1) { //pohyb dole
return 1; return 1;
} }
if (backtracking(maze, x - 1, y, size) == 1) { if (backtracking(maze, x - 1, y, size) == 1) { //pohyb dolava
return 1; return 1;
} }
if (backtracking(maze, x, y - 1, size) == 1) { if (backtracking(maze, x, y - 1, size) == 1) { //pohyb hore
return 1; return 1;
} }
maze[x * size + y] = ' '; maze[x * size + y] = ' ';
@ -37,5 +37,5 @@ return 1;
} }
int solve_maze(char* maze, int size) { int solve_maze(char* maze, int size) {
return backtracking(maze, 0, 0, size); return backtracking(maze, 0, 0, size); //volanie funkcie
} }