main.c: Spielstart und Fehlerprüfung implementiert

This commit is contained in:
Nandor Bodocsi committed 2026-10-27 21:32:35 +01:00
commit 7a7062a925
4 files changed
+213 -7

No files matched your search

+32 -4
View File
@@ -6,6 +6,7 @@
#define MAX_NUMBER_OF_WORDS 100
#define SALAD_SIZE 20
#define WINDOW_WIDTH 800 //KI hat 800 geraten mal sehen ob es passt
int main(int argc, char *argv[])
{
@@ -36,10 +37,37 @@ 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 (wordCount == 0)
{
fprintf(stderr, "Keine Wörter in %s gefunden.\n", argv[1]);
exitCode = EXIT_FAILURE;
}
//Prüfung ob manche Wörter nicht platziert wurden
else if(placedWords != wordCount){
fprintf(stderr, "Es konnten nur %u von %u Wörtern platziert werden, such den Fehler\n", placedWords, wordCount);
exitCode = EXIT_FAILURE;
}
//sonst alles erfolgreich verlaufen
else
{
startGame(wordSalad, SALAD_SIZE, words, wordCount, WINDOW_WIDTH);
}
}
else