test
This commit is contained in:
parent
7dbf43f175
commit
5b36a493b0
@ -1,4 +1,4 @@
|
||||
#define SZ 5
|
||||
#define SZ 2
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#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);
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <math.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -19,4 +19,6 @@
|
||||
int solve_maze(char* maze,int size);
|
||||
|
||||
|
||||
int findWay(char* maze, int i, int j);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user