|
|
@ -14,14 +14,11 @@ int checkAge(int age) { |
|
|
|
return age >= MIN_AGE ? 1 : 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int initializeRandomGenerator() { |
|
|
|
srand(time(NULL)); |
|
|
|
return 1; // Erfolgreich initialisiert |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int decideGameType() { |
|
|
|
// Rückgabe einer zufälligen Zahl (1 für Schere-Stein-Papier, 2 für Münzwurf) |
|
|
|
return (rand() % 2) + 1; |
|
|
@ -33,9 +30,6 @@ Player playRockPaperScissors() { |
|
|
|
return (rand() % 3) == 0 ? PLAYER_X : ((rand() % 3) == 1 ? PLAYER_O : EMPTY); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GameResult initializeGame(TicTacToeGame* game) { |
|
|
|
// Initialisiere das Spielfeld |
|
|
|
for (int i = 0; i < 3; ++i) { |
|
|
@ -53,6 +47,7 @@ GameResult initializeGame(TicTacToeGame* game) { |
|
|
|
// Rückgabe des Ergebnisses |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
GameResult makeMove(TicTacToeGame* game, int row, int col) { |
|
|
|
if (row < 0 || row >= 3 || col < 0 || col >= 3 || game->board[row][col] != EMPTY) { |
|
|
|
return INVALID_MOVE; |
|
|
|