diff --git a/sk1a/main.c b/sk1a/main.c index 091005a..7d3bac0 100644 --- a/sk1a/main.c +++ b/sk1a/main.c @@ -1,4 +1,4 @@ -#define SZ 5 +#define SZ 2 #include #include #include "maze.h" @@ -14,11 +14,8 @@ void print_solution(char* matrix,int sz){ int main(){ char tmaze[SZ+1][SZ+1]={ - "*x ", - " x ", - " x ", - " x ", - " ", + "* ", + " " }; char maze[SZ*SZ]; memset(maze,' ',SZ*SZ); diff --git a/sk1a/maze.c b/sk1a/maze.c index 129e0e4..cff6af7 100644 --- a/sk1a/maze.c +++ b/sk1a/maze.c @@ -5,7 +5,7 @@ #include int paths(char* maze, int journey, int size){ - //printf("journy je:%d\n",journey); + printf("journy je:%d\n",journey); if(journey == size*size-1){ maze[journey]= '*'; @@ -18,6 +18,7 @@ int paths(char* maze, int journey, int size){ //Pohyb dole if(journey < (size * size) - (size)){ + puts("dole"); if(paths(maze, journey+size, size)){ return 1; } @@ -26,6 +27,7 @@ int paths(char* maze, int journey, int size){ //Pohyb vpravo if((journey+1)%size!=0) { + puts("vpravo"); if (paths(maze, journey + 1, size)) { return 1; } @@ -38,6 +40,7 @@ int paths(char* maze, int journey, int size){ //Pohyb vlavo if((journey%size)!=0){ + puts("vlavo"); if(paths(maze, journey-1, size)) return 1; } diff --git a/sk1a/maze.h b/sk1a/maze.h index 2e34662..d653add 100644 --- a/sk1a/maze.h +++ b/sk1a/maze.h @@ -19,4 +19,6 @@ int solve_maze(char* maze,int size); +int findWay(char* maze, int i, int j); + #endif