Fix gross klein
This commit is contained in:
parent
63b1ccd0ea
commit
6f1a59af0c
@ -15,15 +15,14 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
|||||||
{
|
{
|
||||||
// wipe field
|
// wipe field
|
||||||
int placedWords = 0;
|
int placedWords = 0;
|
||||||
for (int i = 0; searchFieldLen < i; i++)
|
for (int i = 0; i < searchFieldLen; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; searchFieldLen < j; i++)
|
for (int j = 0; j < searchFieldLen ; j++)
|
||||||
salad[i][j] = EMPTY_CHAR;
|
salad[i][j] = EMPTY_CHAR;
|
||||||
}
|
}
|
||||||
// place Words
|
// place Words
|
||||||
for (int wordNumber = 0; wordNumber < wordCount; wordNumber++)
|
for (int wordNumber = 0; wordNumber < wordCount; wordNumber++)
|
||||||
{
|
{
|
||||||
srand(time(NULL));
|
|
||||||
int wordlength = strlen(words[wordNumber]);
|
int wordlength = strlen(words[wordNumber]);
|
||||||
|
|
||||||
int placed = 0;
|
int placed = 0;
|
||||||
@ -74,7 +73,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
|||||||
|
|
||||||
for (int i = 0; i < wordlength; i++) // position already occupied by other word
|
for (int i = 0; i < wordlength; i++) // position already occupied by other word
|
||||||
{
|
{
|
||||||
if (salad[y + 1][x] != EMPTY_CHAR)
|
if (salad[y + i][x] != EMPTY_CHAR)
|
||||||
{
|
{
|
||||||
fits = 0;
|
fits = 0;
|
||||||
break;
|
break;
|
||||||
@ -100,7 +99,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
|||||||
{
|
{
|
||||||
if (salad[i][j] == EMPTY_CHAR)
|
if (salad[i][j] == EMPTY_CHAR)
|
||||||
{
|
{
|
||||||
salad[i][j] = (rand() % ((90 - 65) + 1)) + 65; // 90 ist Z in ASCII und A ist 65
|
salad[i][j] = rand() % ('Z' - 'A' + 1) + 'A'; // 90 ist Z in ASCII und A ist 65
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@ -27,6 +27,11 @@ while (fgets(line, sizeof(line), file) && (count < maxWordCount))
|
|||||||
char *token = strtok(line, " ;,");
|
char *token = strtok(line, " ;,");
|
||||||
while (token && (count < maxWordCount))
|
while (token && (count < maxWordCount))
|
||||||
{
|
{
|
||||||
|
for (int i = 0; token[i] != '\0'; i++)
|
||||||
|
{
|
||||||
|
token[i] = toupper(token[i]);
|
||||||
|
}
|
||||||
|
|
||||||
strcpy(words[count], token);
|
strcpy(words[count], token);
|
||||||
count++;
|
count++;
|
||||||
token = strtok(NULL, " ;,");
|
token = strtok(NULL, " ;,");
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user