diff --git a/Start_Windows/game.c b/Start_Windows/game.c index d8cc133..b029559 100644 --- a/Start_Windows/game.c +++ b/Start_Windows/game.c @@ -3,6 +3,7 @@ #include #include + #define MAX_RAND_TRIES_PER_WORD 10 #define EMPTY_CHAR 0 @@ -13,6 +14,28 @@ // 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) { + for(wordCount;wordCount>0;wordCount--) + { + size_t platzbedarf = strlen(words[wordCount-1]); + if (platzbedarf >= searchFieldLen) + { + printf("%s konnte nicht eingefuegt werden da es groeßer als das Feld ist",words[wordCount-1]); + continue; + } + do + { + srand(time(NULL)); + short max = searchFieldLen - platzbedarf; + short position = rand() % (max +1); + srand(time(NULL)); + short waagrecht = rand()%2; + + + }while(1); + + + } + }