This commit is contained in:
Jonas Urban 2025-10-27 14:31:13 +01:00
commit 41792a6c82
3 changed files with 6 additions and 3 deletions

View File

@ -30,6 +30,7 @@ void fillRestWithRandom(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN],
// - wordCount -> anzahl an Wörtern // - wordCount -> anzahl an Wörtern
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)
{ {
srand(time(NULL));
int placedWords = 0; int placedWords = 0;
//Feld komplettmit EMPTY_CHAR füllen //Feld komplettmit EMPTY_CHAR füllen
@ -85,7 +86,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
if (y + wordLength > searchFieldLen) continue; if (y + wordLength > searchFieldLen) continue;
//Prüfen ob kein anderes Wort im Weg //Prüfen ob kein anderes Wort im Weg
int fits = 1; int fits = 1;
for (int i = 0; i < wordLength; i++) for (int i = 0; i < wordLength; i++)
{ {
if (salad[y + i][x] != EMPTY_CHAR) if (salad[y + i][x] != EMPTY_CHAR)

View File

@ -30,6 +30,7 @@ void fillRestWithRandom(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN],
// - wordCount -> anzahl an Wörtern // - wordCount -> anzahl an Wörtern
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)
{ {
srand(time(NULL));
int placedWords = 0; int placedWords = 0;
//Feld komplettmit EMPTY_CHAR füllen //Feld komplettmit EMPTY_CHAR füllen
@ -85,7 +86,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
if (y + wordLength > searchFieldLen) continue; if (y + wordLength > searchFieldLen) continue;
//Prüfen ob kein anderes Wort im Weg //Prüfen ob kein anderes Wort im Weg
int fits = 1; int fits = 1;
for (int i = 0; i < wordLength; i++) for (int i = 0; i < wordLength; i++)
{ {
if (salad[y + i][x] != EMPTY_CHAR) if (salad[y + i][x] != EMPTY_CHAR)

View File

@ -30,6 +30,7 @@ void fillRestWithRandom(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN],
// - wordCount -> anzahl an Wörtern // - wordCount -> anzahl an Wörtern
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)
{ {
srand(time(NULL));
int placedWords = 0; int placedWords = 0;
//Feld komplettmit EMPTY_CHAR füllen //Feld komplettmit EMPTY_CHAR füllen
@ -85,7 +86,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
if (y + wordLength > searchFieldLen) continue; if (y + wordLength > searchFieldLen) continue;
//Prüfen ob kein anderes Wort im Weg //Prüfen ob kein anderes Wort im Weg
int fits = 1; int fits = 1;
for (int i = 0; i < wordLength; i++) for (int i = 0; i < wordLength; i++)
{ {
if (salad[y + i][x] != EMPTY_CHAR) if (salad[y + i][x] != EMPTY_CHAR)