diff --git a/Wortsalat_CLion/Startcode/game.c b/Wortsalat_CLion/Startcode/game.c new file mode 100644 index 0000000..e362445 --- /dev/null +++ b/Wortsalat_CLion/Startcode/game.c @@ -0,0 +1,76 @@ +#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, int control[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN]) +{ + int row, col, word, startcol=0, startrow=0; + srand(time(NULL)); + for(row=0; row