generated from freudenreichan/info2Praktikum-Wortsalat
Compare commits
No commits in common. "8800ac8b5c224fc153e0d3172954774cb1683a75" and "d96e1d9d18ec40a80113ebf042c611781111be52" have entirely different histories.
8800ac8b5c
...
d96e1d9d18
@ -13,29 +13,7 @@
|
|||||||
// Creates the word salad by placing words randomly and filling empty spaces
|
// 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 createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount)
|
||||||
{
|
{
|
||||||
srand(time(NULL));
|
|
||||||
|
|
||||||
for (int i = 0;i < searchFieldLen; i++) { //Feld mit random Buchstaben füllen
|
|
||||||
for (int j = 0; j < searchFieldLen; j++) {
|
|
||||||
salad[i][j] = 'A' + (rand() % 26);
|
|
||||||
}
|
|
||||||
salad[i][j] = 'A' + (rand() % 26);
|
|
||||||
}
|
|
||||||
|
|
||||||
wordCount = sizeof(words) / sizeof(words[0]); //Array das mit der Anzahl der Wörter gefüllt wird
|
|
||||||
int wordOrientation[wordCount];
|
|
||||||
|
|
||||||
for (int w = 0;w < wordCount; w++) { //Randomizer, ob Wort horizontal oder vertikal wird
|
|
||||||
wordOrientation[w] = rand() % 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//for (int w = 0,w < wordCount, w++) {
|
|
||||||
// const char *words = words[w];
|
|
||||||
//int wordlen = strlen (words);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prints the word salad to console
|
// Prints the word salad to console
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user