From 62da76ef4f93ac5dd0c8c0e99d612e1ddf9ef332 Mon Sep 17 00:00:00 2001 From: Jana Hulwa Date: Fri, 30 Oct 2026 22:15:19 +0100 Subject: [PATCH] =?UTF-8?q?game.c=20verk=C3=BCrzung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Startcode/game.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Startcode/game.c b/Startcode/game.c index 80b98d2..07c0b8c 100644 --- a/Startcode/game.c +++ b/Startcode/game.c @@ -2,7 +2,6 @@ #include #include #include -#include //für toupper #define MAX_RAND_TRIES_PER_WORD 10 #define EMPTY_CHAR 0 @@ -21,7 +20,7 @@ void fillRandLetters(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], uns int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount) { fillArrayEmpty(salad, searchFieldLen); - + srand((unsigned int)time(NULL)); int numberWords = 0; @@ -79,7 +78,7 @@ int placeWords(unsigned int searchFieldLen, const char *wort, int platzierung, i { size_t len = strnlen(wort, MAX_WORD_LEN); - if ((size_t)xKoord + len > searchFieldLen) //Addition da unsigned int + if ((size_t)xKoord + len > searchFieldLen) // Addition da unsigned int { return 0; } @@ -87,8 +86,7 @@ int placeWords(unsigned int searchFieldLen, const char *wort, int platzierung, i for (size_t j = 0; j < len; j++) { char c = salad[yKoord][xKoord + j]; - char w = (char)toupper((unsigned char)wort[j]); //Umwandlung in Großbuchstaben - if (c != EMPTY_CHAR && c != w) + if (c != EMPTY_CHAR) { return 0; } @@ -96,7 +94,7 @@ int placeWords(unsigned int searchFieldLen, const char *wort, int platzierung, i for (size_t j = 0; j < len; j++) { - salad[yKoord][xKoord + j] = (char)toupper((unsigned char)wort[j]); //Umwandlung in Großbuchstaben + salad[yKoord][xKoord + j] = wort[j]; } return 1; @@ -114,8 +112,7 @@ int placeWords(unsigned int searchFieldLen, const char *wort, int platzierung, i for (size_t j = 0; j < len; j++) { char c = salad[yKoord + j][xKoord]; - char w = (char)toupper((unsigned char)wort[j]); - if (c != EMPTY_CHAR && c != w) + if (c != EMPTY_CHAR) { return 0; } @@ -123,7 +120,7 @@ int placeWords(unsigned int searchFieldLen, const char *wort, int platzierung, i for (size_t j = 0; j < len; j++) { - salad[yKoord + j][xKoord] = (char)toupper((unsigned char)wort[j]); + salad[yKoord + j][xKoord] = wort[j]; } return 1;