diff --git a/Startcode/game.c b/Startcode/game.c index 07c0b8c..c47f852 100644 --- a/Startcode/game.c +++ b/Startcode/game.c @@ -12,10 +12,10 @@ // Creates the word salad by placing words randomly and filling empty spaces -void fillArrayEmpty(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen); -void generateCoordinates(unsigned int searchFieldLen, int *platzierung, int *xKoord, int *yKoord); -int placeWords(unsigned int searchFieldLen, const char *wort, int platzierung, int xKoord, int yKoord, char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN]); -void fillRandLetters(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen); +static void fillArrayEmpty(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen); +static void generateCoordinates(unsigned int searchFieldLen, int *platzierung, int *xKoord, int *yKoord); +static int placeWords(unsigned int searchFieldLen, const char *wort, int platzierung, int xKoord, int yKoord, char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN]); +static void fillRandLetters(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen); int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount) { @@ -53,7 +53,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi return numberWords; } -void fillArrayEmpty(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen) +static void fillArrayEmpty(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen) { for (unsigned int i = 0; i < searchFieldLen; i++) { @@ -64,14 +64,14 @@ void fillArrayEmpty(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi } } -void generateCoordinates(unsigned int searchFieldLen, int *platzierung, int *xKoord, int *yKoord) +static void generateCoordinates(unsigned int searchFieldLen, int *platzierung, int *xKoord, int *yKoord) { *platzierung = (unsigned int)rand() % 2; // 0=Horizont.; 1=Vertik. *xKoord = (unsigned int)rand() % searchFieldLen; *yKoord = (unsigned int)rand() % searchFieldLen; } -int placeWords(unsigned int searchFieldLen, const char *wort, int platzierung, int xKoord, int yKoord, char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN]) +static int placeWords(unsigned int searchFieldLen, const char *wort, int platzierung, int xKoord, int yKoord, char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN]) { if (platzierung == 0) // Horizontal @@ -131,7 +131,7 @@ int placeWords(unsigned int searchFieldLen, const char *wort, int platzierung, i } } -void fillRandLetters(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen) +static void fillRandLetters(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen) { for (unsigned int i = 0; i < searchFieldLen; i++) { @@ -139,7 +139,7 @@ void fillRandLetters(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], uns { if (salad[i][j] == EMPTY_CHAR) { - salad[i][j] = (unsigned int)rand() % 26 + 'A'; // Assci A=65='A', Z=90 + salad[i][j] = (char)(rand() % 26 + 'A'); // Ascii A=65='A', Z=90 } } } diff --git a/Startcode/input.c b/Startcode/input.c index 06c7639..aefc27a 100644 --- a/Startcode/input.c +++ b/Startcode/input.c @@ -46,8 +46,8 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) i++; } - // MIT CHAT GEMACHT ZUR KONTROLLE: Konsolenausgabe zur Kontrolle der eingelesenen Wörter - printf("Eingelesene Wörter (%u Stück):\n", i); + // MIT HILFE VON KI ZUR KONTROLLE GEMACHT: Konsolenausgabe zur Kontrolle der eingelesenen Wörter + printf("Eingelesene Woerter (%u Stueck):\n", i); for (unsigned int idx = 0; idx < i; idx++) { printf("%u. Entry: %s\n", idx + 1, words[idx]);