Create a classic Hangman word-guessing game that runs in the command line. The program should select a random word from a predefined list (stored in a file), display the progress (e.g., `_ _ _ _`), and track incorrect guesses.
What you'll build
This project involves creating a classic Hangman word-guessing game that runs entirely within the command line interface (CLI). The program will select a random word from an external file containing a list of potential words. It will display the word's length using underscores and progressively reveal letters as the user guesses correctly. The game will track the number of incorrect guesses, often represented by drawing parts of a 'hangman' figure using ASCII characters. The user interacts by typing single letter guesses. The game concludes when the user either guesses the word correctly (win) or runs out of allowed incorrect guesses (loss). Requirements include: a text file named words.txt in the same directory as the executable, containing one word per line (e.g., 'programming', 'hangman', 'computer'). The program should handle basic input validation (checking if the input is a single letter). For portfolio enhancement and potential future expansion, the project includes steps for adding difficulty levels (affecting the number of allowed guesses) and ensuring the code is well-structured and documented.
What you'll learn
Roadmap
11 steps · 90 tasksShowcases
1 approved build