From 5b28c39baac32859b51907ec6ec51d876b93c3f5 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 19:11:32 +0100 Subject: [PATCH] refactoring: lab_can_move --- src/main/c/labyrinth.c | 11 +---------- src/test/c/test_labyrinth.c | 8 -------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index c0aa3ed..6acd557 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -64,16 +64,7 @@ short lab_can_move(Field_State** field, unsigned short x, unsigned short y, Dire if (y >= len_y){ return 1; } - if (direction == N && field[x][y] == WALL){ - return 1; - } - if (direction == E && field[x][y] == WALL){ - return 1; - } - if (direction == S && field[x][y] == WALL){ - return 1; - } - if (direction == W && field[x][y] == WALL){ + if (field[x][y] == WALL){ return 1; } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 4a60303..5cde2e1 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -607,11 +607,3 @@ void test_lab_can_move_at_1_1_direction_W_target_WALL_expected_1(void) free(field); } - - - - - - - -