Feat/game #2

Merged
binneran103617 merged 3 commits from feat/game into main 2026-10-30 08:50:05 +00:00
3 changed files with 19 additions and 2 deletions
Showing only changes of commit 3b6914dc8e - Show all commits

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@
// Read words from file and store in 'words' array
static int createSingleWords(char text[MAX_LINE_LEN], char words[][MAX_WORD_LEN], unsigned int maxWordCount);
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
unsigned int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
{
int wordCount = 0;
char lineRead[MAX_LINE_LEN];
+1 -1
View File
@@ -6,6 +6,6 @@
#define MAX_WORD_LEN 100
#define MAX_LINE_LEN 1024
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount);
unsigned int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount);
#endif
+17
View File
@@ -41,6 +41,23 @@ int main(int argc, char *argv[])
// Start the game if successful
// error message if some words couldn't be placed
if(wordCount > 19)
{
if(placedWords != 20)
{
exitCode = EXIT_FAILURE;
printf("Only %d of %d possible words could be placed\n", placedWords, 20);
}
}
else
{
if(placedWords != wordCount)
{
exitCode = EXIT_FAILURE;
printf("Only %d of %d possible words could be placed\n", placedWords, wordCount);
}
}
}
else
{