Hangman game in C
- Emacs
- Oracle VM Virtual Box
This program must be run on a Linux system because it takes words from /usr/share/dict/words/
.
I used an Ubuntu Oracle VM Virtual Box to create this project.
to_str_lower
is_guess_word
get_random_word
get_guess
print_underlines
put_guess_in_letters_guessed
is_guess_in_word
is_word_guessed
print_hangman
Make all the char of str lowercase
void to_str_lower(char *string)
Is the given string a word?
bool is_guess_word(char *string)
Get and returnd a random word from words
file
char *get_random_word(void)
Asks user for input and cleans it up and returns it
char *get_guess(void)
Print the letters in the user guessed correctly
void print_underlines(const char *word, const char letters_guessed[])
Puts all the guessed letters into an array
void put_guess_in_letters_guessed(char letters_guessed[], char *user_guess)
Is the guess (letter/word) in the random_word?
bool is_guess_in_word(const char *word, char *letters_guessed, char *user_guess)
Is the word guessed?
bool is_word_guessed(const char *word, const char letters_guessed[], char *user_guess)
Prints lives in a visual hangman format
void print_hangman(const int lives)