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,11 +4,11 @@
// TODO:
// 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
int index = 0; // Position im Puffer
int c; // Variablefür jedes gelesene Zeichen
int c; // Variable für jedes gelesene Zeichen
// Whitespace überspringen
while(isspace(c = fgetc(file))); //isspace checkt ob gelesenes Zeichen whitespace ist, wenn ja 1 wenn nein 0
@ -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_LINE_LEN 1024
char* readWord(FILE *file);
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount);
#endif

View File

@ -39,13 +39,15 @@ int main(int argc, char *argv[])
// Start the game if successful
// error message if some words couldn't be placed
// DONE
// Create the word salad by placing words into grid
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, 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);
}
else

View File

@ -10,7 +10,7 @@ unityfolder = ./unity
# initiales Spiel bauen
# --------------------------
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

View File

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