This commit is contained in:
Alexander Schneider 2025-10-27 14:47:44 +01:00
parent 872684c909
commit 1d952bf2e3
2 changed files with 4 additions and 4 deletions

View File

@ -29,13 +29,13 @@ static int platziereWort(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN],
// Überprüfen, ob das Wort ins Feld passt // Überprüfen, ob das Wort ins Feld passt
if (richtung == 0 && spalte + wortLaenge > feldGroesse) return 0; // horizontal if (richtung == 0 && spalte + wortLaenge > feldGroesse) return 0; // horizontal
if (richtung == 1 && zeile + wortLaenge > feldGroesse) return 0; // vertikal if (richtung == 1 && zeile + wortLaenge > feldGroesse) return 0; // vertikal
// Prüfen, ob die Positionen frei oder kompatibel sind // Prüfen, ob die Positionen frei oder kompatibel sind
for (unsigned int i = 0; i < wortLaenge; i++) { for (unsigned int i = 0; i < wortLaenge; i++) {
char c = (richtung == 0) ? salad[zeile][spalte + i] : salad[zeile + i][spalte]; char c = (richtung == 0) ? salad[zeile][spalte + i] : salad[zeile + i][spalte];
if (c != EMPTY_CHAR && c != wort[i]) if (c != EMPTY_CHAR && c != wort[i])
return 0; // Kollision return 0; // Kollision
} }
// Wort eintragen // Wort eintragen

View File

@ -46,8 +46,8 @@ int main(int argc, char *argv[])
printf("Alle %u Wörter wurden erfolgreich platziert!\n\n", wordCount); printf("Alle %u Wörter wurden erfolgreich platziert!\n\n", wordCount);
// Spiel starten // Spiel starten
//showWordSalad(wordSalad, SALAD_SIZE);
startGame(wordSalad, SALAD_SIZE, words, wordCount, ); startGame(wordSalad, SALAD_SIZE, words, wordCount, 800);
} }
else else