From 5b4ef704527a653e46a1e016335338c1ce04d708 Mon Sep 17 00:00:00 2001 From: JonasPittel Date: Thu, 29 Oct 2026 09:57:06 +0100 Subject: [PATCH] =?UTF-8?q?Input.c=20wurde=20ge=C3=A4ndert,=20um=20die=20E?= =?UTF-8?q?ingabe=20von=20W=C3=B6rtern=20zu=20erm=C3=B6glichen.=20Die=20Fu?= =?UTF-8?q?nktionalit=C3=A4t=20wurde=20erweitert,=20um=20sicherzustellen,?= =?UTF-8?q?=20dass=20die=20Eingaben=20korrekt=20verarbeitet=20werden.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Startcode/game.c | 6 +++++- Startcode/input.c | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Startcode/game.c b/Startcode/game.c index 803301f..3d320e1 100644 --- a/Startcode/game.c +++ b/Startcode/game.c @@ -8,7 +8,11 @@ //TODO: Spiellogik implementieren: /* * Wörter aus der Wortliste zufällig horizontal oder vertikal platzieren - * restliche Felder mit zufälligen Buchstaben füllen */ + * restliche Felder mit zufälligen Buchstaben füllen + Idee: COunt von oben nach unten laufen zu lassen wenn möglich oder wie bei read datei + habe nxn Matrix. Muss buchgstaben von oben nach unten und rechts nach links + zufällig wörter per a[rand] rand zwischen x und y asuwählen + ausrichtung evtl mit wort ist abhängig von nur i und j = x 0oder anders rum */ // 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) diff --git a/Startcode/input.c b/Startcode/input.c index ed77805..824f731 100644 --- a/Startcode/input.c +++ b/Startcode/input.c @@ -8,5 +8,15 @@ // Read words from file and store in 'words' array int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) { + if (file == 0) { + return -1; + } + int count = 0; + + while(count < maxWordCount && scanf(file, %99s, words[count]) == 1){ + + count++; + + } } \ No newline at end of file