diff --git a/Start_Windows/game.c b/Start_Windows/game.c index cd33f4e..7313aa3 100644 --- a/Start_Windows/game.c +++ b/Start_Windows/game.c @@ -52,14 +52,12 @@ wordPosition choserandomPosition(unsigned int searchFieldLen, unsigned int wordL { wordPosition position = {0, 0, 0}; - //srand(time(NULL)); + position.alignment = rand()%(VERTIKAL - HORIZONTAL + 1) + HORIZONTAL; position.rowOrColumn = rand()%(searchFieldLen); - printf("Wordlength: %d\n", wordLength); position.startingCell = rand()%(searchFieldLen - wordLength); - printf("Starting Cell: %d\n", position.startingCell); - + return position; } @@ -118,7 +116,6 @@ int placeWord(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], wordPositi for (i = position.startingCell; (i < serchFieldLen) && (currentWord[j] != '\0'); i++) { salad[position.rowOrColumn][i] = currentWord[j]; - printf("%c",currentWord[j]); j++; } salad[position.rowOrColumn][i] = '\0'; @@ -128,12 +125,10 @@ int placeWord(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], wordPositi for (i = position.startingCell; (i < serchFieldLen) && (currentWord[j] != '\0'); i++) { salad[i][position.rowOrColumn] = currentWord[j]; - printf("%c",currentWord[j]); j++; } salad[i][position.rowOrColumn] = '\0'; } - printf("\n"); return 1; } @@ -180,7 +175,6 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi srand(time(NULL)); initializeWordsalad(salad, searchFieldLen); - showWordSalad(salad, searchFieldLen); for (i = 1; i <= wordCount; i++) { @@ -198,12 +192,10 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi if (positionFound) { - printf("%d, %d, %d \n", currentWordPosition.alignment, currentWordPosition.rowOrColumn, currentWordPosition.startingCell); - printf("%s\n", currentWord); placedWords += placeWord(salad, currentWordPosition, currentWord, strlen(currentWord), searchFieldLen); } } - showWordSalad(salad, searchFieldLen); + placeRandomLetters(salad, searchFieldLen); diff --git a/Start_Windows/game.o b/Start_Windows/game.o index 8dc0825..c25f5e3 100644 Binary files a/Start_Windows/game.o and b/Start_Windows/game.o differ