done_v2
This commit is contained in:
parent
2255a7f02f
commit
6bcf871acd
@ -84,7 +84,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("Words aborted: %d\n", wordsaborted);
|
printf("Words aborted: %d\n", wordsaborted);
|
||||||
return wordsplaced;
|
return wordsaborted;;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prints the word salad to console
|
// Prints the word salad to console
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int exitCode = EXIT_SUCCESS;
|
int exitCode = EXIT_SUCCESS;
|
||||||
|
int wordsaborted;
|
||||||
|
|
||||||
// Check if the correct number of arguments is provided
|
// Check if the correct number of arguments is provided
|
||||||
if(argc != 2)
|
if(argc != 2)
|
||||||
@ -34,13 +35,13 @@ int main(int argc, char *argv[])
|
|||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
// Create the word salad by placing words into grid
|
// Create the word salad by placing words into grid
|
||||||
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
wordsaborted = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
||||||
|
|
||||||
// Start game if all valid words were placed
|
// Start game if all valid words were placed
|
||||||
if (placedWords == wordCount) {
|
if (wordsaborted == 0) {
|
||||||
startGame(wordSalad, SALAD_SIZE, words, wordCount, 750);
|
startGame(wordSalad, SALAD_SIZE, words, wordCount, 750);
|
||||||
} else {
|
} else {
|
||||||
printf("Could not place all valid words. Placed %d out of %d words.\n", placedWords, wordCount);
|
printf("Could not place all valid words. Placed %d out of %d words.\n", wordCount - wordsaborted, wordCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "unity.h"
|
#include "unity/unity.h"
|
||||||
|
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user