From 96f7a2f77abc8cea751e13dcc723965ab68ec578 Mon Sep 17 00:00:00 2001 From: Saba Fazlali Date: Thu, 8 Feb 2024 23:21:23 +0100 Subject: [PATCH] clean up word_selector --- src/main/c/Hangman/word_selector.c | 7 +++---- src/main/c/Hangman/word_selector.h | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/c/Hangman/word_selector.c b/src/main/c/Hangman/word_selector.c index ff25adb..ec9c547 100644 --- a/src/main/c/Hangman/word_selector.c +++ b/src/main/c/Hangman/word_selector.c @@ -1,8 +1,7 @@ #include "word_selector.h" -#include "playHangman.h" // easy words -const char wordsList_easy[NUM_WORDS][MAX_WORD_LENGTH + 1] = { +char wordsList_easy[NUM_WORDS][MAX_WORD_LENGTH + 1] = { "apple", "world", "banana", @@ -26,7 +25,7 @@ const char wordsList_easy[NUM_WORDS][MAX_WORD_LENGTH + 1] = { }; // hard words -const char wordsList_hard[NUM_WORDS][MAX_WORD_LENGTH + 1] = { +char wordsList_hard[NUM_WORDS][MAX_WORD_LENGTH + 1] = { "database", "programming", "mountain", @@ -49,7 +48,7 @@ const char wordsList_hard[NUM_WORDS][MAX_WORD_LENGTH + 1] = { "quarter" }; -const char* selectRandomWord(int difficulty) { +char* selectRandomWord(int difficulty) { // pick a random number and assign it to index of wordsList_easy array srand((unsigned int)time(NULL)); diff --git a/src/main/c/Hangman/word_selector.h b/src/main/c/Hangman/word_selector.h index d606871..cb13eb7 100644 --- a/src/main/c/Hangman/word_selector.h +++ b/src/main/c/Hangman/word_selector.h @@ -9,4 +9,8 @@ #define MAX_WORD_LENGTH 20 #define NUM_WORDS 20 +char* selectRandomWord(); +char wordsList_easy[NUM_WORDS][MAX_WORD_LENGTH + 1]; +char wordsList_hard[NUM_WORDS][MAX_WORD_LENGTH + 1]; + #endif //PMUW_PROJEKT_NOTEBINDER_WORD_SELECTOR_H