A simple terminal-based Hangman game written in Python 3. This game includes multiple features such as difficulty levels, various word categories, an optional sentence mode, and an optional timer.
-
Main Menu
- Start the game
- Go to Options
- Quit
-
Options Menu
- Difficulty: Easy, Medium, Hard, or Random
- Word Categories: Animals, Countries, Movies, Fruits
- Sentence Mode: Toggle On/Off (guesses sentences instead of single words)
- Timer: Toggle On/Off
-
Game Flow
- Randomly picks a word (or sentence) based on the selected categories and difficulty.
- Tracks incorrect guesses with a simplistic Hangman ASCII art.
- Allows you to win by guessing all letters or lose by reaching 6 incorrect guesses (or running out of time if the timer is on).
-
Timer (optional)
- Counts down the time you have to guess.
- If time runs out, the game ends.
-
Multiple Word Categories
- You can enable or disable different categories (animals, countries, movies, fruits) at will.
- Python 3.x
- constants.py located in the same directory as the main script.
No external libraries are required. This game does not rely on any additional data files, just the two .py
files.
-
Clone or download the repository
git clone https://github.com/your-username/hangman-game.git
-
Navigate to the project folder
cd hangman
-
Ensure constants.py is in the same folder Make sure the main script and constants.py are both in the same directory.
-
(Optional) Create a virtual environment
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Run the game
python main_script.py
- On launching, you will see a welcome message. Type
START
(orS
or1
) to begin a new Hangman game. - Alternatively, navigate to
OPTIONS
(orO
or2
) to configure settings before starting.
-
Difficulty:
1
for Easy2
for Medium3
for Hard4
for Random
-
Word Categories: Toggle categories on or off. You can keep multiple categories active at once.
-
Sentence Mode: Turn it on (
ON
/1
) to guess sentences, or off (OFF
/2
) to guess single words. -
Timer: Turn it on (
ON
/1
) or off (OFF
/2
). If the timer is on, it begins counting down as soon as the game starts.
- Enter your guess when prompted:
- A single letter (e.g.,
A
) - Or, if you think you know the entire word or sentence, try typing it in full.
- A single letter (e.g.,
- You lose after 6 incorrect guesses.
- If using the timer and it runs out, you also lose the game.
- Type
QUIT
(orQ
) whenever prompted to exit the game.
This project is open-source and available under the MIT License.