From 464c7ff1ad50a16fb36884726d208d93b57d6469 Mon Sep 17 00:00:00 2001 From: zidanmo99094 Date: Fri, 30 Oct 2026 01:05:15 +0100 Subject: [PATCH] test --- Startcode/game.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Startcode/game.c b/Startcode/game.c index e3238a4..2a0ee6a 100644 --- a/Startcode/game.c +++ b/Startcode/game.c @@ -6,12 +6,15 @@ #define MAX_RAND_TRIES_PER_WORD 10 #define EMPTY_CHAR 0 -// 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 wordCount, char **words) +int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int wordCount, char **words, unsigned int seed) { - // 1. Spielfeld initialisieren (memset ist kürzer und effizienter als Schleifen) - memset(salad, EMPTY_CHAR, MAX_SEARCH_FIELD_LEN * MAX_SEARCH_FIELD_LEN); + // Falls die Unit-Tests deterministisch sein müssen, Zufallsgenerator initialisieren: + srand(seed); + // 1. Spielfeld initialisieren + memset(salad, EMPTY_CHAR, MAX_SEARCH_FIELD_LEN * MAX_SEARCH_FIELD_LEN); + + // ... restlicher Code bleibt exakt gleich ... int placedWordsCount = 0; // 2. Jedes Wort aus der Wörterliste platzieren