From 7f3e18becfd7ca4c66f9c71591a609b955516722 Mon Sep 17 00:00:00 2001 From: Jana Hulwa Date: Mon, 2 Nov 2026 20:50:18 +0100 Subject: [PATCH] Letzter Feinschliff --- Startcode/game.c | 2 +- Startcode/input.c | 9 ++++----- Startcode/makefile | 9 ++++++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Startcode/game.c b/Startcode/game.c index c47f852..01f9aa1 100644 --- a/Startcode/game.c +++ b/Startcode/game.c @@ -3,7 +3,7 @@ #include #include -#define MAX_RAND_TRIES_PER_WORD 10 +#define MAX_RAND_TRIES_PER_WORD 100 #define EMPTY_CHAR 0 // TODO: Spiellogik implementieren: diff --git a/Startcode/input.c b/Startcode/input.c index c2cf525..245699f 100644 --- a/Startcode/input.c +++ b/Startcode/input.c @@ -9,7 +9,7 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) { int c; - unsigned int i = 0; // Wort + unsigned int i = 0; // Wort unsigned int j = 0; // Zeichen im Wort while ((c = fgetc(file)) != EOF) @@ -18,9 +18,9 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) { if (j > 0) { - words[i][j] = '\0'; - i++; - j = 0; + words[i][j] = '\0'; + i++; + j = 0; if (i >= maxWordCount) { @@ -53,6 +53,5 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) printf("%u. Entry: %s\n", idx + 1, words[idx]); } - return (int)i; } \ No newline at end of file diff --git a/Startcode/makefile b/Startcode/makefile index 7cf1d4c..1d51572 100644 --- a/Startcode/makefile +++ b/Startcode/makefile @@ -41,13 +41,20 @@ graphicalGame.o: $(codefolder)/graphicalGame.c $(CC) -I$(raylibfolder) -c $(CFLAGS) $(codefolder)/graphicalGame.c +# -------------------------- +# Unser Spiel bauen +# -------------------------- +wordsalad_ourVersion: main.o graphicalGame.o $(BINARIES)/libwordsalad.a $(BINARIES)/libraylib.a + $(CC) $(CFLAGS) -o wordsalad_ourVersion main.o graphicalGame.o $(BINARIES)/libwordsalad.a $(BINARIES)/libraylib.a $(LDFLAGS) + # -------------------------- # Unit Tests # -------------------------- TEST_BIN = runTests test: input.o game.o $(codefolder)/unit_tests.c $(unityfolder)/unity.c - $(CC) -Wall -I$(unityfolder) -o $(TEST_BIN) input.o game.o $(codefolder)/unit_tests.c $(unityfolder)/unity.c + $(CC) $(CFLAGS) -I$(unityfolder) -o $(TEST_BIN) input.o game.o $(codefolder)/unit_tests.c $(unityfolder)/unity.c + # -------------------------- # Clean # --------------------------