Browse Source

get_natural_number

remotes/origin/Joe
Joe Lukas Kalb 11 months ago
parent
commit
126fd0d3d6
  1. 7
      src/main/c/labyrinth.c
  2. 1
      src/main/c/labyrinth.h

7
src/main/c/labyrinth.c

@ -14,6 +14,13 @@ void show_solution(Field_State** field, unsigned short len_x, unsigned short len
} }
} }
unsigned short get_natural_number(char text[]){
unsigned short result;
printf("%s", text);
scanf("%hu", &result);
return result;
}
void turn_direction_right(Direction *direction){ void turn_direction_right(Direction *direction){
switch (*direction) { switch (*direction) {
case N: case N:

1
src/main/c/labyrinth.h

@ -9,5 +9,6 @@ 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); 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); 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); void show_solution(Field_State** field, unsigned short len_x, unsigned short len_y);
unsigned short get_natural_number(char text[]);
#endif // TEST_H #endif // TEST_H
Loading…
Cancel
Save