From f001d40668140618116bc99866b6bcc5d82e622a Mon Sep 17 00:00:00 2001 From: Timo Hertel Date: Mon, 27 Oct 2025 14:04:20 +0100 Subject: [PATCH 1/3] Seed erstellen --- I2_Wortsalat/Start_Linux/game.c | 1 + I2_Wortsalat/Start_Mac/game.c | 8 +------- I2_Wortsalat/Start_Windows/game.c | 1 + 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/I2_Wortsalat/Start_Linux/game.c b/I2_Wortsalat/Start_Linux/game.c index 1c8027c..6b56af7 100644 --- a/I2_Wortsalat/Start_Linux/game.c +++ b/I2_Wortsalat/Start_Linux/game.c @@ -30,6 +30,7 @@ void fillRestWithRandom(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], // - wordCount -> anzahl an Wörtern int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount) { + srand(time(NULL)); int placedWords = 0; //Feld komplettmit EMPTY_CHAR füllen diff --git a/I2_Wortsalat/Start_Mac/game.c b/I2_Wortsalat/Start_Mac/game.c index 1c8027c..4d257ce 100644 --- a/I2_Wortsalat/Start_Mac/game.c +++ b/I2_Wortsalat/Start_Mac/game.c @@ -115,11 +115,5 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi // Prints the word salad to console void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen) { - for( int i = 0; i < searchFieldLen; i++ ) - { - for( int j = 0; j < searchFieldLen; j++ ) - { - printf("%c", salad[i][j]); - } - } + } diff --git a/I2_Wortsalat/Start_Windows/game.c b/I2_Wortsalat/Start_Windows/game.c index 1c8027c..6b56af7 100644 --- a/I2_Wortsalat/Start_Windows/game.c +++ b/I2_Wortsalat/Start_Windows/game.c @@ -30,6 +30,7 @@ void fillRestWithRandom(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], // - wordCount -> anzahl an Wörtern int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount) { + srand(time(NULL)); int placedWords = 0; //Feld komplettmit EMPTY_CHAR füllen From 5ba22a1fa87b30d379dfab5f4b9269bdd98fa8b9 Mon Sep 17 00:00:00 2001 From: Timo Hertel Date: Mon, 27 Oct 2025 14:08:05 +0100 Subject: [PATCH 2/3] Seed setzen --- I2_Wortsalat/Start_Linux/game.c | 8 +------- I2_Wortsalat/Start_Mac/game.c | 1 + I2_Wortsalat/Start_Windows/game.c | 8 +------- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/I2_Wortsalat/Start_Linux/game.c b/I2_Wortsalat/Start_Linux/game.c index 6b56af7..d724872 100644 --- a/I2_Wortsalat/Start_Linux/game.c +++ b/I2_Wortsalat/Start_Linux/game.c @@ -116,11 +116,5 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi // Prints the word salad to console void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen) { - for( int i = 0; i < searchFieldLen; i++ ) - { - for( int j = 0; j < searchFieldLen; j++ ) - { - printf("%c", salad[i][j]); - } - } + } diff --git a/I2_Wortsalat/Start_Mac/game.c b/I2_Wortsalat/Start_Mac/game.c index 4d257ce..d724872 100644 --- a/I2_Wortsalat/Start_Mac/game.c +++ b/I2_Wortsalat/Start_Mac/game.c @@ -30,6 +30,7 @@ void fillRestWithRandom(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], // - wordCount -> anzahl an Wörtern int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount) { + srand(time(NULL)); int placedWords = 0; //Feld komplettmit EMPTY_CHAR füllen diff --git a/I2_Wortsalat/Start_Windows/game.c b/I2_Wortsalat/Start_Windows/game.c index 6b56af7..d724872 100644 --- a/I2_Wortsalat/Start_Windows/game.c +++ b/I2_Wortsalat/Start_Windows/game.c @@ -116,11 +116,5 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi // Prints the word salad to console void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen) { - for( int i = 0; i < searchFieldLen; i++ ) - { - for( int j = 0; j < searchFieldLen; j++ ) - { - printf("%c", salad[i][j]); - } - } + } From cf09c5233ad4b85c695c14fb0f4cf0f411aa6de2 Mon Sep 17 00:00:00 2001 From: Timo Hertel Date: Mon, 27 Oct 2025 14:23:36 +0100 Subject: [PATCH 3/3] Seed erzeugen korigieren --- I2_Wortsalat/Start_Linux/game.c | 10 ++++++++-- I2_Wortsalat/Start_Mac/game.c | 10 ++++++++-- I2_Wortsalat/Start_Windows/game.c | 10 ++++++++-- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/I2_Wortsalat/Start_Linux/game.c b/I2_Wortsalat/Start_Linux/game.c index d724872..a8905e1 100644 --- a/I2_Wortsalat/Start_Linux/game.c +++ b/I2_Wortsalat/Start_Linux/game.c @@ -86,7 +86,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi if (y + wordLength > searchFieldLen) continue; //Prüfen ob kein anderes Wort im Weg - int fits = 1; + int fits = 1; for (int i = 0; i < wordLength; i++) { if (salad[y + i][x] != EMPTY_CHAR) @@ -116,5 +116,11 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi // Prints the word salad to console void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen) { - + for( int i = 0; i < searchFieldLen; i++ ) + { + for( int j = 0; j < searchFieldLen; j++ ) + { + printf("%c", salad[i][j]); + } + } } diff --git a/I2_Wortsalat/Start_Mac/game.c b/I2_Wortsalat/Start_Mac/game.c index d724872..a8905e1 100644 --- a/I2_Wortsalat/Start_Mac/game.c +++ b/I2_Wortsalat/Start_Mac/game.c @@ -86,7 +86,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi if (y + wordLength > searchFieldLen) continue; //Prüfen ob kein anderes Wort im Weg - int fits = 1; + int fits = 1; for (int i = 0; i < wordLength; i++) { if (salad[y + i][x] != EMPTY_CHAR) @@ -116,5 +116,11 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi // Prints the word salad to console void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen) { - + for( int i = 0; i < searchFieldLen; i++ ) + { + for( int j = 0; j < searchFieldLen; j++ ) + { + printf("%c", salad[i][j]); + } + } } diff --git a/I2_Wortsalat/Start_Windows/game.c b/I2_Wortsalat/Start_Windows/game.c index d724872..a8905e1 100644 --- a/I2_Wortsalat/Start_Windows/game.c +++ b/I2_Wortsalat/Start_Windows/game.c @@ -86,7 +86,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi if (y + wordLength > searchFieldLen) continue; //Prüfen ob kein anderes Wort im Weg - int fits = 1; + int fits = 1; for (int i = 0; i < wordLength; i++) { if (salad[y + i][x] != EMPTY_CHAR) @@ -116,5 +116,11 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi // Prints the word salad to console void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen) { - + for( int i = 0; i < searchFieldLen; i++ ) + { + for( int j = 0; j < searchFieldLen; j++ ) + { + printf("%c", salad[i][j]); + } + } }