From daf05939e59699524b4377dcd65bcd0726df89ce Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:47:09 +0100 Subject: [PATCH] refactoring: labyrinth, final piece of cake --- src/main/c/labyrinth.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index 221e0f7..11eaf59 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -161,28 +161,28 @@ short calculate_lab_way(Field_State** field, unsigned short len_x, unsigned shor void labyrinth(){ unsigned short len_x, len_y; - Field_State **f; + Field_State **field; 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++){ - 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"); } - 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++) { - free(f[c_index]); + free(field[c_index]); } - free(f); + free(field); }