diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 09e00a1..bc3c05c 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -5,6 +5,15 @@ #include "stdio.h" #include "stdlib.h" +void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y){ + for (int c_x = 0; c_x < len_x; c_x++){ + for (int c_y = 0; c_y < len_y; c_y++){ + printf("%hi", field[c_x][c_y]); + } + printf("\n"); + } +} + void turn_direction_right(Direction *direction){ switch (*direction) { case N: @@ -67,9 +76,6 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (field[x][y] == WALL){ return 1; } - if (direction == N && field[x][y] == SOLUTION){ - return 1; - } if (field[x][y] == SOLUTION){ return 1; } diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index ef19e30..42c953a 100644 --- a/src/main/c/labyrinth.h +++ b/src/main/c/labyrinth.h @@ -8,5 +8,6 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction); void set_wall(Field_State** field, unsigned short x, unsigned short y); void init_field(Field_State** field, unsigned short len_x, unsigned short len_y); short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Direction direction, unsigned short len_x, unsigned short len_y); +void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y); #endif // TEST_H