This commit is contained in:
hopfenu103561 committed 2026-10-29 11:09:16 +01:00
1 parent e931591801
commit d21c6beda0
1 file changed
+42
+42
View File
@@ -13,5 +13,47 @@
// 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)
{
srand(time(NULL));
int i,j;
int Woertergesetzt = 0;
for (i=0 ; i<MAX_SEARCH_FIELD_LEN;i++);
{
for (j=0 ; j<MAX_SEARCH_FIELD_LEN;j++);
{
salad[i][j] = 0;
}
}
for (int k = 0 ; k < wordCount ; k++);
{
int richtigplatziert = 0;
for (int f = 0 ; f < 1000 && !richtigplatziert ; f++);
{
int ausrichtung, zeile, spalte;
ausrichtung = rand() % 2;
zeile = rand() % (searchFieldLen);
spalte = rand() % (searchFieldLen);
if (ausrichtung == 0);
{
if ((spalte + strlen)(words[k]) < MAX_SEARCH_FIELD_LEN);
{
int moeglichePosition = 1;
for (int i1 = 0; i1< strlen(words[k]); i1++);
{
if (salad[zeile][spalte + i] !=0);
moeglichePosition = 0;
}
richtigplatziert = 1;
Woertergesetzt++;
}
}
}
else
{
if ((zeile + strlen(words[k]));
}
}
}