From ad8fc5d7bcb1279df272e1ed3d33f2a4d9d6f5d8 Mon Sep 17 00:00:00 2001 From: David Moeller Date: Sat, 27 Jan 2024 16:05:11 +0100 Subject: [PATCH] minor fixes --- src/main/c/Minesweeper/minesweeper_start.c | 8 -------- src/main/c/Minesweeper/minesweeper_start.h | 2 +- test/Minesweeper/test_bomb_in_array.c | 4 ++-- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/main/c/Minesweeper/minesweeper_start.c b/src/main/c/Minesweeper/minesweeper_start.c index 3025597..fae882a 100644 --- a/src/main/c/Minesweeper/minesweeper_start.c +++ b/src/main/c/Minesweeper/minesweeper_start.c @@ -22,7 +22,6 @@ void game_minesweeper(); void options_minesweeper(); Minesweeper_Board initialize_minesweeper(); void place_bombs(Minesweeper_Board *board); -bool bomb_in_array(int *array, int bomb, int length); bool array_contains_value(int *array, int value, int length); void draw_minesweeper(Minesweeper_Board *board); int open_tile(Minesweeper_Board *board, int tile); @@ -182,13 +181,6 @@ void place_bombs(Minesweeper_Board *board){ } } -bool bomb_in_array(int *array, int value, int length){ - for(int i = 0; i < length; i++){ - if(array[i] == value){return true;} - } - return false; -} - bool array_contains_value(int *array, int value, int length){ for(int i = 0; i < length; i++){ if(array[i] == value){return true;} diff --git a/src/main/c/Minesweeper/minesweeper_start.h b/src/main/c/Minesweeper/minesweeper_start.h index b577233..c37d731 100644 --- a/src/main/c/Minesweeper/minesweeper_start.h +++ b/src/main/c/Minesweeper/minesweeper_start.h @@ -13,7 +13,7 @@ typedef struct Minesweeper_Board{ void minesweeper_start(); Minesweeper_Board initialize_minesweeper(); -bool bomb_in_array(int *array, int bomb, int length); +bool array_contains_value(int *array, int bomb, int length); int number_of_bombs(Minesweeper_Board *board, int tile); diff --git a/test/Minesweeper/test_bomb_in_array.c b/test/Minesweeper/test_bomb_in_array.c index 8aae16d..7073857 100644 --- a/test/Minesweeper/test_bomb_in_array.c +++ b/test/Minesweeper/test_bomb_in_array.c @@ -16,7 +16,7 @@ void test_bomb_in_array(void){ int length = 10; /* act */ - result = bomb_in_array(array, bomb, length); + result = array_contains_value(array, bomb, length); /* assert */ TEST_ASSERT_TRUE(result); @@ -31,7 +31,7 @@ void test_bomb_not_in_array(void){ int length = 10; /* act */ - result = bomb_in_array(array, bomb, length); + result = array_contains_value(array, bomb, length); /* assert */ TEST_ASSERT_FALSE(result);