init salad

This commit is contained in:
sengpielto106561 committed 2026-10-22 11:59:25 +02:00
1 parent 947054bb51
commit d368eea2f3
1 file changed
+13 -2
+13 -2
View File
@@ -16,12 +16,21 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
//Initialisiert den seed für rand()
srand(time(NULL));
//Initialisiere spielfeld auf '0'
// TODO: memset()
for(int i = 0; i < MAX_SEARCH_FIELD_LEN; i++){
for (int j = 0; j < MAX_SEARCH_FIELD_LEN; j++){
salad[i][j] = '0';
}
}
int placedWords = 0;
//Iterate over words
unsigned int counter = 0;
while(counter < wordCount){
//load current word
char currentWord[MAX_WORD_LEN] = words[counter];
char currentWord[MAX_WORD_LEN];
strncpy(currentWord)
//try to place a word
int try = 0;
@@ -29,8 +38,10 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
int x = rand() % MAX_SEARCH_FIELD_LEN;
int y = rand() % MAX_SEARCH_FIELD_LEN;
if (salad[x][y] == '0'){
}
try++;
}
}