Compare commits

..

No commits in common. "c95c264a3ac2513871d134feac435abae0544094" and "4041e9ee9bcb5d2c6797b282762a0d15f551e6bf" have entirely different histories.

3 changed files with 16 additions and 24 deletions

View File

@ -37,21 +37,17 @@ int main(int argc, char *argv[])
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
// Check if all words were successfully placed
// Start the game if successful
// error message if some words couldn't be placed
if (placedWords < wordCount)
{
int notPlacedNum = wordCount - placedWords;
fprintf(stderr, "%d word(s) couldn't be placed\n", notPlacedNum);
fprintf(stderr, "some words couldn't be placed\n");
exitCode = EXIT_FAILURE;
}
// TODO:
// correct parameters for startGame
// Start the game if at least 1 word has been successfully placed
else if (placedWords >= 1)
{
startGame(wordSalad, 80, words, placedWords, 800);
}
// Start the game if successful
}
else
{

View File

@ -16,9 +16,9 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
// set seed for random number generator
srand(time(NULL));
int r, c, placedWords=0;
int r, c;
//Gesamtes Feld auf 0 setzen, am besten in eigene Fkt, dann aber extra Tests dafür erstellen
//Gesamtes Feld auf 0 setzen
for (r=0; r < searchFieldLen; r++) {
for (c=0; c < searchFieldLen; c++) {
salad [r][c] = EMPTY_CHAR;
@ -33,7 +33,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
//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, am besten in eigene Fkt, dann aber extra Tests dafür erstellen
//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) {
@ -41,8 +41,8 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
}
}
}
//return "Anzahl platzierter Wörter", wird in Main dann mit soll verglichen
return placedWords;
return 0;
}
// Prints the word salad to console

View File

@ -37,21 +37,17 @@ int main(int argc, char *argv[])
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
// Check if all words were successfully placed
// Start the game if successful
// error message if some words couldn't be placed
if (placedWords < wordCount)
{
int notPlacedNum = wordCount - placedWords;
fprintf(stderr, "%d word(s) couldn't be placed\n", notPlacedNum);
fprintf(stderr, "some words couldn't be placed\n");
exitCode = EXIT_FAILURE;
}
// TODO:
// correct parameters for startGame
// Start the game if at least 1 word has been successfully placed
else if (placedWords >= 1)
{
startGame(wordSalad, 80, words, placedWords, 800);
}
// Start the game if successful
}
else
{