diff --git a/Start_Windows/game.c b/Start_Windows/game.c index f01c4f0..9a0a2ee 100644 --- a/Start_Windows/game.c +++ b/Start_Windows/game.c @@ -15,15 +15,14 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi { // wipe field int placedWords = 0; - for (int i = 0; searchFieldLen < i; i++) + for (int i = 0; i < searchFieldLen; i++) { - for (int j = 0; searchFieldLen < j; i++) + for (int j = 0; j < searchFieldLen ; j++) salad[i][j] = EMPTY_CHAR; } // place Words for (int wordNumber = 0; wordNumber < wordCount; wordNumber++) { - srand(time(NULL)); int wordlength = strlen(words[wordNumber]); int placed = 0; @@ -74,7 +73,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi for (int i = 0; i < wordlength; i++) // position already occupied by other word { - if (salad[y + 1][x] != EMPTY_CHAR) + if (salad[y + i][x] != EMPTY_CHAR) { fits = 0; break; @@ -100,7 +99,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi { if (salad[i][j] == EMPTY_CHAR) { - salad[i][j] = (rand() % ((90 - 65) + 1)) + 65; // 90 ist Z in ASCII und A ist 65 + salad[i][j] = rand() % ('Z' - 'A' + 1) + 'A'; // 90 ist Z in ASCII und A ist 65 } } } diff --git a/Start_Windows/game.o b/Start_Windows/game.o index 1de3c4e..3c2ae47 100644 Binary files a/Start_Windows/game.o and b/Start_Windows/game.o differ diff --git a/Start_Windows/input.c b/Start_Windows/input.c index f8cd217..2763eea 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -27,6 +27,11 @@ while (fgets(line, sizeof(line), file) && (count < maxWordCount)) char *token = strtok(line, " ;,"); while (token && (count < maxWordCount)) { + for (int i = 0; token[i] != '\0'; i++) + { + token[i] = toupper(token[i]); + } + strcpy(words[count], token); count++; token = strtok(NULL, " ;,"); diff --git a/Start_Windows/input.o b/Start_Windows/input.o index 2e34fa4..29dea20 100644 Binary files a/Start_Windows/input.o and b/Start_Windows/input.o differ diff --git a/Start_Windows/runTests.exe b/Start_Windows/runTests.exe index da58ebc..7fad6df 100644 Binary files a/Start_Windows/runTests.exe and b/Start_Windows/runTests.exe differ