From 74e6535320b8989dbe6e3e8ea0904b3f0ce5cc5a Mon Sep 17 00:00:00 2001 From: "Denis.Schrempf" Date: Thu, 29 Oct 2026 10:04:42 +0100 Subject: [PATCH] zufallsgenerator --- Startcode/main.c | 14 +++++--------- Startcode/makefile | 5 +++-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Startcode/main.c b/Startcode/main.c index ee9b849..5dbc0a7 100644 --- a/Startcode/main.c +++ b/Startcode/main.c @@ -3,16 +3,12 @@ #include "input.h" #include "game.h" #include "graphicalGame.h" -#include #define MAX_NUMBER_OF_WORDS 100 #define SALAD_SIZE 20 - int main(int argc, char *argv[]) { - srand(time(NULL)); - int exitCode = EXIT_SUCCESS; // Check if the correct number of arguments is provided @@ -44,16 +40,16 @@ int main(int argc, char *argv[]) // Check if all words were successfully placed // Start the game if successful // error message if some words couldn't be placed - if(placedWords == wordCount) // Wenn alle Wörter reinpassten, rufe das grafische Fenster auf + if (placedWords == wordCount) { + // Start the graphical game with the generated word salad startGame(wordSalad, SALAD_SIZE, words, wordCount, 800); - } - else + } + else { - fprintf(stderr, "Could not place all words\n"); + fprintf(stderr, "Could not place all words!\n"); exitCode = EXIT_FAILURE; } - } else { diff --git a/Startcode/makefile b/Startcode/makefile index 71bdc7b..a736b47 100644 --- a/Startcode/makefile +++ b/Startcode/makefile @@ -21,8 +21,9 @@ codefolder = . # -------------------------- wordsalad_initial: $(CC) -o wordsalad_initial -L. $(BINARIES)/libwordsalad_complete.a $(BINARIES)/libraylib.a $(LDFLAGS) -wordsalad_myversion: main.o game.o graphicalGame.o - $(CC) $(CFLAGS) -o wordsalad_myversion main.o game.o graphicalGame.o -L. $(BINARIES)/libwordsalad.a $(BINARIES)/libraylib.a $(LDFLAGS) +wordsalad_myversion: main.o + $(CC) -o wordsalad_myversion main.o -L. $(BINARIES)/libwordsalad.a $(BINARIES)/libraylib.a $(LDFLAGS) + # -------------------------- # Normales Spiel bauen # --------------------------