diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index bc3c05c..1d70380 100644 --- a/src/main/c/labyrinth.c +++ b/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){ switch (*direction) { case N: diff --git a/src/main/c/labyrinth.h b/src/main/c/labyrinth.h index 42c953a..593d111 100644 --- a/src/main/c/labyrinth.h +++ b/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); 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); +unsigned short get_natural_number(char text[]); #endif // TEST_H