From bf666148ce035fa3ad44fd73bcda4304bf6040b1 Mon Sep 17 00:00:00 2001 From: Oleksandr Hryshchenko Date: Sun, 9 Jan 2022 17:07:39 +0000 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BB(=D0=B0)=20?= =?UTF-8?q?'sk1a/main.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sk1a/main.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 sk1a/main.c diff --git a/sk1a/main.c b/sk1a/main.c new file mode 100644 index 0000000..091005a --- /dev/null +++ b/sk1a/main.c @@ -0,0 +1,39 @@ +#define SZ 5 +#include +#include +#include "maze.h" + +void print_solution(char* matrix,int sz){ + for (int i = 0; i < sz * sz; i++){ + printf("%c ",matrix[i]); + if (i % sz == (sz-1)){ + printf("\n"); + } + } +} + +int main(){ + char tmaze[SZ+1][SZ+1]={ + "*x ", + " x ", + " x ", + " x ", + " ", + }; + char maze[SZ*SZ]; + memset(maze,' ',SZ*SZ); + for (int i= 0; i < SZ; i++){ + for (int j= 0; j < SZ; j++){ + if (tmaze[i][j] == 'x'){ + maze[i*SZ+j] = 'x'; + } + } + } + int r = solve_maze(maze,SZ); + if (!r){ + printf("Nenasiel som riesenie\n"); + } + print_solution(maze,SZ); + + return 0; +}