testing-statements entfernt

This commit is contained in:
Jonas Hofmann 2025-11-04 17:03:59 +01:00
parent acc14b49d8
commit 42a5143e9a
2 changed files with 3 additions and 11 deletions

View File

@ -52,14 +52,12 @@ wordPosition choserandomPosition(unsigned int searchFieldLen, unsigned int wordL
{ {
wordPosition position = {0, 0, 0}; wordPosition position = {0, 0, 0};
//srand(time(NULL));
position.alignment = rand()%(VERTIKAL - HORIZONTAL + 1) + HORIZONTAL; position.alignment = rand()%(VERTIKAL - HORIZONTAL + 1) + HORIZONTAL;
position.rowOrColumn = rand()%(searchFieldLen); position.rowOrColumn = rand()%(searchFieldLen);
printf("Wordlength: %d\n", wordLength);
position.startingCell = rand()%(searchFieldLen - wordLength); position.startingCell = rand()%(searchFieldLen - wordLength);
printf("Starting Cell: %d\n", position.startingCell);
return position; 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++) for (i = position.startingCell; (i < serchFieldLen) && (currentWord[j] != '\0'); i++)
{ {
salad[position.rowOrColumn][i] = currentWord[j]; salad[position.rowOrColumn][i] = currentWord[j];
printf("%c",currentWord[j]);
j++; j++;
} }
salad[position.rowOrColumn][i] = '\0'; 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++) for (i = position.startingCell; (i < serchFieldLen) && (currentWord[j] != '\0'); i++)
{ {
salad[i][position.rowOrColumn] = currentWord[j]; salad[i][position.rowOrColumn] = currentWord[j];
printf("%c",currentWord[j]);
j++; j++;
} }
salad[i][position.rowOrColumn] = '\0'; salad[i][position.rowOrColumn] = '\0';
} }
printf("\n");
return 1; return 1;
} }
@ -180,7 +175,6 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
srand(time(NULL)); srand(time(NULL));
initializeWordsalad(salad, searchFieldLen); initializeWordsalad(salad, searchFieldLen);
showWordSalad(salad, searchFieldLen);
for (i = 1; i <= wordCount; i++) 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) 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); placedWords += placeWord(salad, currentWordPosition, currentWord, strlen(currentWord), searchFieldLen);
} }
} }
showWordSalad(salad, searchFieldLen);
placeRandomLetters(salad, searchFieldLen); placeRandomLetters(salad, searchFieldLen);

Binary file not shown.