From 5b36a493b092c7cccdd484cd49193c551d87d33d Mon Sep 17 00:00:00 2001 From: vj586da Date: Sat, 22 Jan 2022 02:27:27 +0100 Subject: [PATCH] test --- sk1a/main.c | 9 +++------ sk1a/maze.c | 5 ++++- sk1a/maze.h | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) 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