fix vom 27.10

This commit is contained in:
Giorgi Kesidis 2025-10-27 20:07:40 +01:00
parent 1e229ad916
commit 63b1ccd0ea
4 changed files with 4 additions and 5 deletions

View File

@ -30,7 +30,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
for (int try = 0; (try < MAX_RAND_TRIES_PER_WORD) && !placed; try++)
{
int horizontal = rand() % 2;
int horizontal = rand() % 2; // 0 vertikal --> 1 horizontal
int x = rand() % searchFieldLen;
int y = rand() % searchFieldLen;
@ -46,7 +46,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
{
if (salad[y][x + 1] != EMPTY_CHAR)
if (salad[y][x + i] != EMPTY_CHAR)
{
fits = 0;
break;
@ -57,7 +57,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
{
for (int i = 0; i < wordlength; i++)
{
salad[y][x + 1] = words[wordNumber][i];
salad[y][x + i] = words[wordNumber][i];
}
placed = 1;
placedWords++;
@ -75,7 +75,6 @@ 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
{
if (salad[y + 1][x] != EMPTY_CHAR)
;
{
fits = 0;
break;
@ -85,7 +84,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
{
for (int i = 0; i < wordlength; i++)
{
salad[y + 1][x] = words[wordNumber][i];
salad[y + i][x] = words[wordNumber][i];
}
placed = 1;
placedWords++;

Binary file not shown.

Binary file not shown.

Binary file not shown.