From 05d668c6691470a176f6b529fe862fa8f2229c77 Mon Sep 17 00:00:00 2001 From: vj586da Date: Fri, 21 Jan 2022 23:22:19 +0100 Subject: [PATCH] test --- sk1a/maze.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/sk1a/maze.c b/sk1a/maze.c index 919b8d2..ed2a7e1 100644 --- a/sk1a/maze.c +++ b/sk1a/maze.c @@ -14,17 +14,28 @@ int solve_maze(char* maze,int size){ while(actualPos != size*size-1){ //printf("acpos: %d\n", actualPos); - + + //Pohyb dole if(actualPos < (size*size-size) && maze[actualPos+size]==' '){ //printf("dole\n"); maze[actualPos+size]='*'; actualPos+=size; - //printf("acpos: %d\n", actualPos); continue; } + //Pohyb hore + if(actualPos-size > size && maze[actualPos-size]==' '){ + //printf("hore\n"); + maze[actualPos-size]='*'; + actualPos-=size; + continue; + }else if(actualPos-size > size && maze[actualPos-size]=='*'){ + maze[actualPos]=' '; + actualPos-=size; + } + //Pohyb vpravo if(maze[actualPos+1]==' '){ //puts("vpravo"); @@ -33,16 +44,11 @@ int solve_maze(char* maze,int size){ continue; } - //Pohyb hore - if(maze[actualPos-size]==' ' && actualPos-size != 0){ - maze[actualPos-size]='*'; - actualPos-=size; - continue; - } //Pohyb vlavo if(maze[actualPos-1]==' '){ + //printf("vlavo\n"); maze[actualPos]='*'; actualPos--; continue;