diff --git a/Startcode/input.c b/Startcode/input.c index 245699f..81a9ebd 100644 --- a/Startcode/input.c +++ b/Startcode/input.c @@ -46,12 +46,14 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) i++; } - // MIT HILFE VON KI ZUR KONTROLLE GEMACHT: Konsolenausgabe zur Kontrolle der eingelesenen Wörter - printf("Eingelesene Woerter (%u Stueck):\n", i); - for (unsigned int idx = 0; idx < i; idx++) - { - printf("%u. Entry: %s\n", idx + 1, words[idx]); - } + /* + // MIT HILFE VON KI ZUR KONTROLLE GEMACHT: Konsolenausgabe zur Kontrolle der eingelesenen Wörter + printf("Eingelesene Woerter (%u Stueck):\n", i); + for (unsigned int idx = 0; idx < i; idx++) + { + printf("%u. Entry: %s\n", idx + 1, words[idx]); + } + */ return (int)i; -} \ No newline at end of file +} diff --git a/Startcode/main.c b/Startcode/main.c index 4fc4e8b..f3ab4cb 100644 --- a/Startcode/main.c +++ b/Startcode/main.c @@ -6,14 +6,14 @@ #define MAX_NUMBER_OF_WORDS 100 #define SALAD_SIZE 20 -#define WINDOW_WIDTH 800 //KI hat 800 geraten mal sehen ob es passt +#define WINDOW_WIDTH 800 // KI hat 800 geraten mal sehen ob es passt int main(int argc, char *argv[]) { int exitCode = EXIT_SUCCESS; // Check if the correct number of arguments is provided - if(argc != 2) + if (argc != 2) { fprintf(stderr, "Usage: %s \n", argv[0]); exitCode = EXIT_FAILURE; @@ -25,7 +25,7 @@ int main(int argc, char *argv[]) FILE *file = fopen(argv[1], "r"); - if(file != NULL) + if (file != NULL) { unsigned int placedWords = 0; char wordSalad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN]; // 2D array to store the word salad @@ -37,38 +37,25 @@ int main(int argc, char *argv[]) // Create the word salad by placing words into grid placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount); - if (wordCount == 0) { fprintf(stderr, "Keine Woerter in %s gefunden.\n", argv[1]); exitCode = EXIT_FAILURE; } - //Prüfung ob manche Wörter nicht platziert wurden - else if(placedWords != wordCount){ + // Prüfung ob manche Wörter nicht platziert wurden + else if (placedWords != wordCount) + { fprintf(stderr, "Es konnten nur %u von %u Woertern platziert werden, such den Fehler\n", placedWords, wordCount); exitCode = EXIT_FAILURE; } - //sonst alles erfolgreich verlaufen + // sonst alles erfolgreich verlaufen else { - startGame(wordSalad, SALAD_SIZE, words, wordCount, WINDOW_WIDTH); - + startGame(wordSalad, SALAD_SIZE, words, wordCount, WINDOW_WIDTH); } - - - - - - - - - - - - } else {