Browse Source

final piece of cake in labyrinth

main^2
Joe Lukas Kalb 11 months ago
committed by Peter Wiebe
parent
commit
054a3a47dd
  1. 20
      src/main/c/labyrinth.c

20
src/main/c/labyrinth.c

@ -161,8 +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;
ask_lab_dimensions(&len_x, &len_y); ask_lab_dimensions(&len_x, &len_y);
f = malloc(len_x * sizeof *f);
for (int c_index = 0; c_index < len_x; c_index++){
f[c_index] = malloc(len_y * sizeof f[c_index]);
}
ask_lab_walls(f, len_x, len_y);
if (calculate_lab_way(f, len_x, len_y, 0, 0) == 1){
printf("Keine Loesung moeglich!\n");
}
show_solution(f, len_x, len_y);
for (int c_index = 0; c_index < len_x; c_index++)
{
free(f[c_index]);
}
free(f);
} }
Loading…
Cancel
Save