|
@ -161,28 +161,28 @@ short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned shor |
|
|
|
|
|
|
|
|
void labyrinth(){ |
|
|
void labyrinth(){ |
|
|
unsigned short len_x, len_y; |
|
|
unsigned short len_x, len_y; |
|
|
Field_State **f; |
|
|
|
|
|
|
|
|
Field_State **field; |
|
|
|
|
|
|
|
|
ask_lab_dimensions(&len_x, &len_y); |
|
|
ask_lab_dimensions(&len_x, &len_y); |
|
|
|
|
|
|
|
|
f = malloc(len_x * sizeof *f); |
|
|
|
|
|
|
|
|
field = malloc(len_x * sizeof *field); |
|
|
for (int c_index = 0; c_index < len_x; c_index++){ |
|
|
for (int c_index = 0; c_index < len_x; c_index++){ |
|
|
f[c_index] = malloc(len_y * sizeof f[c_index]); |
|
|
|
|
|
|
|
|
field[c_index] = malloc(len_y * sizeof field[c_index]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ask_lab_walls(f, len_x, len_y); |
|
|
|
|
|
|
|
|
ask_lab_walls(field, len_x, len_y); |
|
|
|
|
|
|
|
|
if (calculate_lab_way(f, len_x, len_y, 0, 0) == 1){ |
|
|
|
|
|
|
|
|
if (calculate_lab_way(field, len_x, len_y, 0, 0) == 1){ |
|
|
printf("Keine Loesung moeglich!\n"); |
|
|
printf("Keine Loesung moeglich!\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
show_solution(f, len_x, len_y); |
|
|
|
|
|
|
|
|
show_solution(field, len_x, len_y); |
|
|
|
|
|
|
|
|
for (int c_index = 0; c_index < len_x; c_index++) |
|
|
for (int c_index = 0; c_index < len_x; c_index++) |
|
|
{ |
|
|
{ |
|
|
free(f[c_index]); |
|
|
|
|
|
|
|
|
free(field[c_index]); |
|
|
} |
|
|
} |
|
|
free(f); |
|
|
|
|
|
|
|
|
free(field); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|