diff --git a/Startcode/game.c b/Startcode/game.c index 803301f..d49b8e9 100644 --- a/Startcode/game.c +++ b/Startcode/game.c @@ -13,5 +13,26 @@ // 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 searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount) { + //Initialisiert den seed für rand() + srand(time(NULL)); + int placedWords = 0; + //Iterate over words + unsigned int counter = 0; + while(counter < wordCount){ + //load current word + char currentWord[MAX_WORD_LEN] = words[counter]; + + //try to place a word + int try = 0; + while(try < 10){ + int x = rand() % MAX_SEARCH_FIELD_LEN; + int y = rand() % MAX_SEARCH_FIELD_LEN; + + + + try++; + } + } + return placedWords; }