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