Code game.c

This commit is contained in:
Maximilian Ott 2025-11-04 17:45:30 +01:00
parent 096d400a40
commit d9c39024bb
2 changed files with 11 additions and 1 deletions

View File

@ -29,6 +29,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
for (int j = 0; j < searchFieldLen; j++)
{
salad[i][j] = '\0';
}
}

View File

@ -36,11 +36,20 @@ int main(int argc, char *argv[])
// Create the word salad by placing words into grid
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
// TODO:
// Check if all words were successfully placed
// Start the game if successful
// error message if some words couldn't be placed
if (placedWords == wordCount)
{
startGame(wordSalad, SALAD_SIZE, words, placedWords, 800);
}
else{
printf("The game can not start! %d words can not be placed!", wordCount - placedWords);
exitCode = EXIT_FAILURE;
}
}
else
{