This commit is contained in:
Tobias Linz committed 2026-10-29 16:25:50 +01:00
1 parent e94da31756
commit b56aa9d557
4 files changed
+23 -11

No files matched your search

+6 -5
View File
@@ -13,7 +13,7 @@ int placeWord(const char *word, int wordLength, char salad[MAX_SEARCH_FIELD_LEN]
int searchFieldLen, int column, int row, int axis);
// Creates the word salad by placing words randomly and filling empty spaces
int createWordSalad(
unsigned int createWordSalad(
char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN],
unsigned int searchFieldLen,
const char words[][MAX_WORD_LEN],
@@ -41,9 +41,9 @@ int createWordSalad(
// Wörter platzieren
for (int w = 0; w < wordCount; w++)
{
int wordlenght = strlen(words[w]); // Wortlänge festgelegt
int wordlength = strlen(words[w]); // Wortlänge festgelegt
if (wordlenght == 0 || wordlenght > searchFieldLen)
if (wordlength == 0 || wordlength > searchFieldLen)
{
continue;
}
@@ -57,7 +57,7 @@ int createWordSalad(
int row = rand() % searchFieldLen;
int column = rand() % searchFieldLen;
int success = placeWord(words[w], wordlenght, salad, searchFieldLen, column, row, axis);
int success = placeWord(words[w], wordlength, salad, searchFieldLen, column, row, axis);
if (success)
{
@@ -78,7 +78,8 @@ int createWordSalad(
}
}
}
printf("%d placed", placedWords);
printf("%d placed\n", placedWords);
return placedWords;
}