umgeändert in ourversion

This commit is contained in:
Elena Riedmann 2026-03-31 14:48:38 +02:00
parent 36c61ff8e7
commit 208e35e934
6 changed files with 9 additions and 10 deletions

View File

@ -4,7 +4,7 @@
// TODO: // TODO:
// eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt. // eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt.
string readWord(FILE *file) char* readWord(FILE *file)
{ {
char word[MAX_WORD_LEN]; // Puffer für Wort char word[MAX_WORD_LEN]; // Puffer für Wort
int index = 0; // Position im Puffer int index = 0; // Position im Puffer
@ -41,5 +41,5 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
} }
} }
return count; // Anzahl der gelesenen Wörter zurückgeben return count; // Anzahl gelesene Wörter zurückgeben
} }

View File

@ -6,6 +6,7 @@
#define MAX_WORD_LEN 100 #define MAX_WORD_LEN 100
#define MAX_LINE_LEN 1024 #define MAX_LINE_LEN 1024
char* readWord(FILE *file);
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount); int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount);
#endif #endif

View File

@ -39,13 +39,15 @@ int main(int argc, char *argv[])
// Start the game if successful // Start the game if successful
// error message if some words couldn't be placed // error message if some words couldn't be placed
// DONE
// Create the word salad by placing words into grid // Create the word salad by placing words into grid
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount); placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
if(placedWords==wordCount) if(placedWords==wordCount)
{ {
// Spiel starten, mit dem erstellten wordSalad, der Anzahl der Wörter und der Liste der Wörter // Spiel starten, mit dem erstellten wordSalad, der Anzahl der Wörter und der Liste der Wörter, 800 = Fensterbreite
startGame(wordSalad, SALAD_SIZE, words, wordCount, 800); startGame(wordSalad, SALAD_SIZE, words, wordCount, 800);
} }
else else

View File

@ -10,7 +10,7 @@ unityfolder = ./unity
# initiales Spiel bauen # initiales Spiel bauen
# -------------------------- # --------------------------
wordsalad_initial: wordsalad_initial:
$(CC) -o wordsalad_initial -L. $(BINARIES)/libwordsalad_complete.a $(BINARIES)/libraylib.a $(LDFLAGS) $(CC) -o wordsalad_ourversion -L. $(BINARIES)/libwordsalad_complete.a $(BINARIES)/libraylib.a $(LDFLAGS)
# -------------------------- # --------------------------
# Normales Spiel bauen # Normales Spiel bauen

View File

@ -1,5 +1 @@
Yeti,Nessie Werwolf; Vampir Yeti Nessie Werwolf Vampir Monster Hydra Frankenstein Dracula KingKong Gremlin Kobold Hexe Poltergeist Gespenst Oger
Monster
Hydra;Frankenstein
Dracula;KingKong;Gremlin;Kobold,Hexe;Poltergeist
Gespenst, Oger