placedWordCounter eingefügt

This commit is contained in:
Björn 2025-10-26 16:17:28 +01:00
parent 288693c76f
commit 8844495411

View File

@ -29,6 +29,8 @@ int checkforOverlap(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], shor
// Creates the word salad by placing words randomly and filling empty spaces // Creates the word salad by placing words randomly and filling empty spaces
int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount) int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount)
{ {
int placedCount = 0;
for(short i = 0; i < searchFieldLen; i++) for(short i = 0; i < searchFieldLen; i++)
{ {
for(short j = 0; j < searchFieldLen; j++) for(short j = 0; j < searchFieldLen; j++)
@ -72,9 +74,12 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
salad[x+xoffset][y+yoffset]=words[i-1][k]; salad[x+xoffset][y+yoffset]=words[i-1][k];
} }
placedCount++;
} }
return placedCount;
} }