Compare commits

..

No commits in common. "c97f4bd97d6cae25a30c3e7526661b91de919991" and "dc9b59395b2999754557c3a413e04aec1f05f782" have entirely different histories.

2 changed files with 0 additions and 40 deletions

View File

@ -13,48 +13,11 @@
// 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)
{
// set seed for random number generator
srand(time(NULL));
int r, c;
//Gesamtes Feld auf 0 setzen
for (r=0; r < searchFieldLen; r++) {
for (c=0; c < searchFieldLen; c++) {
salad [r][c] = EMPTY_CHAR;
}
}
//Wörter zufällig horizontal oder vertikal platzieren
enum Richtung {HORIZONTAL,VERTIKAL}; //0;1
enum Richtung dir;
dir = (rand() % 2 == 0) ? HORIZONTAL : VERTIKAL;
//Schleife, die das Setzen für alle Wörter durchführt, Zufällig horizontal(0) oder vertikal(1), an zufällige Stelle
//Prüfen, ob das Wort von der Länge her ins Feld passt
//Felder, in denen keine Wörter stehen, werden mit zufälligen Buchstaben befüllt
for (r=0; r < searchFieldLen; r++) {
for (c=0; c < searchFieldLen; c++) {
if (salad[r][c] == EMPTY_CHAR) {
salad [r][c] = 'A' + (rand()% 26);
}
}
}
return 0;
}
// Prints the word salad to console
void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen)
{
int r, c;
//Ausgabe des gesamten Feldes
for (r=0; r < searchFieldLen; r++) {
for (c=0; c < searchFieldLen; c++) {
printf("%c ", salad[r][c]);
}
printf("\n");
}
}

View File

@ -13,9 +13,6 @@
// 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)
{
// set seed for random number generator
srand(time(NULL));
int r, c;
//Gesamtes Feld auf 0 setzen