#include "game.h" #include #include #include #define MAX_RAND_TRIES_PER_WORD 10 #define EMPTY_CHAR 0 //TODO: Spiellogik implementieren: /* * Wörter aus der Wortliste zufällig horizontal oder vertikal platzieren * restliche Felder mit zufälligen Buchstaben füllen */ // 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); } } // Prints the word salad to console void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen) { }