Browse Source

show_solution

remotes/origin/Joe
Joe Lukas Kalb 11 months ago
parent
commit
ce38e86808
  1. 12
      src/main/c/labyrinth.c
  2. 1
      src/main/c/labyrinth.h

12
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:
@ -66,9 +75,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;

1
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
Loading…
Cancel
Save