update main

This commit is contained in:
maxgrf 2025-11-10 13:30:02 +01:00
parent 31fbbb3153
commit 5929da2766
3 changed files with 13 additions and 7 deletions

View File

@ -19,7 +19,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
int placedWords = 0;
unsigned int attemps = 0;
unsigned int check_direction = 0, check_overlap = 0;
unsigned int check_overlap = 0;
int zeile = 0, spalte = 0, len = 0;
//Alle Felder mit ? befüllen
@ -46,14 +46,12 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
{
zeile = rand() % searchFieldLen;
spalte = rand() % searchFieldLen;
check_direction = 1;
}
if (direction == 1) // 1 = HORIZONTAL
{
zeile = rand() % searchFieldLen;
spalte = rand() % searchFieldLen;
check_direction = 1;
}
for(int i = 0; i < len; i++)
@ -132,7 +130,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
}
}
}
/*
// fügt zufällige Buchstaben ein
for(int l = 0; l < searchFieldLen; l++){
for(int m = 0; m < searchFieldLen; m++ ){

Binary file not shown.

View File

@ -36,12 +36,18 @@ int main(int argc, char *argv[])
// Create the word salad by placing words into grid
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
// TODO:
// TODO: (if Schleife implementieren, die das prüft)
// Check if all words were successfully placed
// Start the game if successful
// error message if some words couldn't be placed
// wordcount mit placedwords vergleichen
if (placedWords == wordCount){
startGame(wordSalad, SALAD_SIZE, words, wordCount, 750);
}
else{
printf("Error. The words couldn't be placed.\n");
return -1;
}
}
else
@ -54,3 +60,5 @@ int main(int argc, char *argv[])
return exitCode;
}
//