diff --git a/src/main/duellist-spielesammlung-projekt.c b/src/main/duellist-spielesammlung-projekt.c index 63b1395..dbe397a 100644 --- a/src/main/duellist-spielesammlung-projekt.c +++ b/src/main/duellist-spielesammlung-projekt.c @@ -12,7 +12,7 @@ int checkAge(int age) { return age >= MIN_AGE ? 1 : 0; } -// Funktion zur Initialisierung des Zufallsgenerators mit Rückgabewert + int initializeRandomGenerator() { srand(time(NULL)); return 1; // Erfolgreich initialisiert @@ -68,11 +68,11 @@ GameResult makeMove(TicTacToeGame* game, int row, int col) { return result; } -Player getCurrentPlayer(const TicTacToeGame * game) { +Player CurrentPlayer(const TicTacToeGame * game) { return game->currentPlayer; } -int getNumberOfMoves(const TicTacToeGame* game) { +int NumberOfMoves(const TicTacToeGame* game) { int moves = 0; for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { @@ -83,7 +83,7 @@ int getNumberOfMoves(const TicTacToeGame* game) { } return moves; } - +// Funktioin ob das Feld voll ist oder nicht int BoardFull(const TicTacToeGame* game) { for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { diff --git a/src/main/duellist-spielesammlung-projekt.h b/src/main/duellist-spielesammlung-projekt.h index 28c63c8..2f63a3e 100644 --- a/src/main/duellist-spielesammlung-projekt.h +++ b/src/main/duellist-spielesammlung-projekt.h @@ -29,9 +29,9 @@ typedef struct { GameResult makeMove(TicTacToeGame* game, int row, int col); GameResult checkGameResult(const TicTacToeGame* game); GameResult initializeGame(TicTacToeGame* game); -int getNumberOfMoves(const TicTacToeGame* game); +int NumberOfMoves(const TicTacToeGame* game); int BoardFull(const TicTacToeGame* game); -Player getCurrentPlayer(const TicTacToeGame* game); +Player CurrentPlayer(const TicTacToeGame* game); int checkAge(int age); int initializeRandomGenerator(); int FieldEmpty(const TicTacToeGame* game, int row, int col); diff --git a/src/test/test_duellist_spielesammlung_projekt.c b/src/test/test_duellist_spielesammlung_projekt.c index 9df6a4b..c1759cd 100644 --- a/src/test/test_duellist_spielesammlung_projekt.c +++ b/src/test/test_duellist_spielesammlung_projekt.c @@ -146,7 +146,7 @@ void test_invalid_input_overflow_column(void) { TEST_ASSERT_EQUAL(INVALID_MOVE, result); } -void test_getNumberOfMoves_returns_correct_number_of_moves(void) { +void test_NumberOfMoves_returns_correct_number_of_moves(void) { // Arrange TicTacToeGame game = { .board = {{PLAYER_X, EMPTY, EMPTY}, {EMPTY, PLAYER_O, EMPTY}, @@ -154,7 +154,7 @@ void test_getNumberOfMoves_returns_correct_number_of_moves(void) { .currentPlayer = PLAYER_X }; // Act - int moves = getNumberOfMoves(&game); + int moves = NumberOfMoves(&game); // Assert TEST_ASSERT_EQUAL(2, moves); @@ -186,7 +186,7 @@ void test_BoardFull_returns_true_when_board_is_full(void) { // Assert TEST_ASSERT_TRUE(boardFull); } -void test_getCurrentPlayer_returns_correct_player(void) { +void test_CurrentPlayer_returns_correct_player(void) { // Arrange TicTacToeGame game = { .board = {{PLAYER_X, EMPTY, EMPTY}, {EMPTY, PLAYER_O, EMPTY}, @@ -194,7 +194,7 @@ void test_getCurrentPlayer_returns_correct_player(void) { .currentPlayer = PLAYER_O }; // Act - Player currentPlayer = getCurrentPlayer(&game); + Player currentPlayer = CurrentPlayer(&game); // Assert TEST_ASSERT_EQUAL(PLAYER_O, currentPlayer);