Logikfehler bei Probe auf Ueberlappung verbessert

This commit is contained in:
maxgrf 2025-11-07 17:35:10 +01:00
parent 7b215682a1
commit ec4b32c2a5

View File

@ -62,13 +62,19 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
{ {
if (direction == 0) // 0 = VERTIKAL if (direction == 0) // 0 = VERTIKAL
{ {
if (words[num_words][i_overlap] == salad[zeile][spalte + i_overlap]); if(salad[zeile + i_overlap][spalte] != '.')
check_overlap = 1; {
check_overlap = 1; //wenn check_overlap = 1 -> belegt
break;
}
} }
else if (direction == 1) // 1 = HORIZONTAL else if (direction == 1) // 1 = HORIZONTAL
{ {
if (words[num_words][i_overlap] == salad[zeile + i_overlap][spalte]); if(salad[zeile][spalte + i_overlap] == '.')
check_overlap = 1; {
check_overlap = 1; //wenn check_overlap = 1 -> belegt
break;
}
} }
if(check_overlap == 0) if(check_overlap == 0)
{ {
@ -78,7 +84,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
} }
//3. Schritt: Wort in Wortsalat schreiben //3. Schritt: Wort in Wortsalat schreiben
if(check_direction == 1 && check_overlap == 1 && tries < MAX_RAND_TRIES_PER_WORD) if(check_direction == 1 && check_overlap == 0 && tries < MAX_RAND_TRIES_PER_WORD)
{ {
for(int i_set = 0; i_set < len; i_set++) for(int i_set = 0; i_set < len; i_set++)
{ {