This Hangman game is a text-based Python implementation where players can guess words and try to complete them before running out of lives. The game provides a visual representation of the hangman figure and gives players the option to exit or start a new game.
- Word Selection: Randomly selects a word from a list of over 100 words stored in the
words.json
file. - Visual Feedback: Displays a series of ASCII art hangman figures for each incorrect guess stored in the
hangmanPics.json
file. - User Interaction: Allows users to input characters to guess the word.
- Game Outcome: Declares whether the player has won or lost the game, revealing the correct word if lost.
- New Game Option: After completing a game, users have the option to start a new game.
- words.json: Contains a list of words used for the game. Over 100 words are stored in this file.
- hangmanPics.json: Contains a list of ASCII art representations of the hangman figure corresponding to each incorrect guess.
- Run the Python script in your terminal or preferred Python environment.
- Choose to either exit the game (
"e"
) or play ("p"
). - If playing, input characters to guess the word.
- The game will provide visual feedback and inform you of the outcome.
- After completing a game, choose to start a new game.
- Python 3.x
- Clone this repository to your local machine (Make sure to keep all these files in the same folder).
- Ensure you have Python installed.
- Open a terminal in the project directory.
- Run the command:
python hangman_game.py
$ python hangman_game.py
Enter "e" to exit or "p" to play
->>p
['_', '_', '_', '_', '_']
Enter character: e
Your guess e is in the word , completed words 1
['_', '_', 'e', '_', '_']
Enter character: x
+---+
| |
|
|
|
|
=========
Your guess x is not in the word, you lose one life. Remaining: 6
['_', '_', 'e', '_', '_']
...
You lost!! Never give up... The word was example
------------------New Game-----------------
Enter "e" to exit or "p" to play
->>e
This Hangman game is licensed under the MIT License.