diff --git a/Start_Windows/game.c b/Start_Windows/game.c index 6b74bde..e0f2b6e 100644 --- a/Start_Windows/game.c +++ b/Start_Windows/game.c @@ -19,7 +19,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi int placedWords = 0; unsigned int attemps = 0; - unsigned int check_direction = 0, check_overlap = 0; + unsigned int check_overlap = 0; int zeile = 0, spalte = 0, len = 0; //Alle Felder mit ? befüllen @@ -46,14 +46,12 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi { zeile = rand() % searchFieldLen; spalte = rand() % searchFieldLen; - check_direction = 1; } if (direction == 1) // 1 = HORIZONTAL { zeile = rand() % searchFieldLen; spalte = rand() % searchFieldLen; - check_direction = 1; } for(int i = 0; i < len; i++) @@ -132,7 +130,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi } } } - /* + // fügt zufällige Buchstaben ein for(int l = 0; l < searchFieldLen; l++){ for(int m = 0; m < searchFieldLen; m++ ){ diff --git a/Start_Windows/game.o b/Start_Windows/game.o index ad8b6e8..2125229 100644 Binary files a/Start_Windows/game.o and b/Start_Windows/game.o differ diff --git a/Start_Windows/main.c b/Start_Windows/main.c index a1d4f24..c9d258a 100644 --- a/Start_Windows/main.c +++ b/Start_Windows/main.c @@ -36,12 +36,18 @@ int main(int argc, char *argv[]) // Create the word salad by placing words into grid placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount); - // TODO: + // TODO: (if Schleife implementieren, die das prüft) // Check if all words were successfully placed // Start the game if successful // error message if some words couldn't be placed - // wordcount mit placedwords vergleichen + if (placedWords == wordCount){ + startGame(wordSalad, SALAD_SIZE, words, wordCount, 750); + } + else{ + printf("Error. The words couldn't be placed.\n"); + return -1; + } } else @@ -53,4 +59,6 @@ int main(int argc, char *argv[]) } return exitCode; -} \ No newline at end of file +} + +//