diff --git a/Startcode/game.c b/Startcode/game.c index f442b1f..caa84cf 100644 --- a/Startcode/game.c +++ b/Startcode/game.c @@ -1,4 +1,5 @@ #include "game.h" +#include "input.h" #include #include #include @@ -40,11 +41,11 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi int dir = rand() % 2; // cant place vertically - if(dir == 1 && MAX_SEARCH_FIELD_LEN < (y + (int) len -1)){ + if(dir == 1 && MAX_SEARCH_FIELD_LEN < (y + (int) len)){ dir = 0; } //cant place horizontally - if((x + (int) len -1) > MAX_SEARCH_FIELD_LEN){ + if((x + (int) len) > MAX_SEARCH_FIELD_LEN){ continue; } diff --git a/Startcode/game.h b/Startcode/game.h index cc66572..d6cd51b 100644 --- a/Startcode/game.h +++ b/Startcode/game.h @@ -3,7 +3,7 @@ #include "input.h" -#define MAX_SEARCH_FIELD_LEN 100 +#define MAX_SEARCH_FIELD_LEN 20 int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount); diff --git a/Startcode/input.c b/Startcode/input.c index e0c883b..0c107cf 100644 --- a/Startcode/input.c +++ b/Startcode/input.c @@ -27,7 +27,7 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) strncpy(words[count], copy, len); words[count][len] = '\0'; - count++; + //schaue ob auch alles groß geschrieben ist for(int i = 0; i < len; i++){ @@ -36,7 +36,7 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) words[count][i] -= 32; } } - + count++; token = strtok(NULL, delimit); } } diff --git a/Startcode/input.h b/Startcode/input.h index 032ec28..a5502c3 100644 --- a/Startcode/input.h +++ b/Startcode/input.h @@ -3,7 +3,7 @@ #include -#define MAX_WORD_LEN 100 +#define MAX_WORD_LEN 20 #define MAX_LINE_LEN 1024 int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount); diff --git a/Startcode/main.c b/Startcode/main.c index 96e2dd0..4cc839a 100644 --- a/Startcode/main.c +++ b/Startcode/main.c @@ -6,7 +6,7 @@ #include "graphicalGame.h" #define MAX_NUMBER_OF_WORDS 100 -#define SALAD_SIZE 20 +#define SALAD_SIZE 36 int checkSalad(char words[][MAX_WORD_LEN], char wordSalad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], int placedWords, int wordCount){ //Iteriere über alle verfügbaren Wörter @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) exitCode = EXIT_FAILURE; } //keine Ahnung wiegroß pixelSize sein soll - startGame(wordSalad, MAX_SEARCH_FIELD_LEN, words, placedWords, SALAD_SIZE * SALAD_SIZE); + startGame(wordSalad, MAX_SEARCH_FIELD_LEN, words, placedWords, MAX_SEARCH_FIELD_LEN * SALAD_SIZE); } else {