Hangman Game is a Python terminal game which runs in the Code Institute mock terminal on Heroku.
To win the Hangman Game. The user has to guess the correct letters to complete the word. If the user don't complete the word within 7 guesses, then the hangmang guy dies and the game is over.
Here is a live version of my project.
Before the game starts. The player is given a choice between starting the game or exit the game by typing "yes" or "no". If the player types in "yes" the game starts. If the player types in "no" the game ends.
If the player choose to start the game. The player then gets assigned a hidden word from the computer. The user gets information that he or she has 7 lives left to complete the word.
To win the game you have to guess all the correct letters to complete the word. The player lose one life for each wrong guess that has been made. The game ends if the player lose all the 7 lives before completing the word.
- A random word from a list of 440 words are being generated into the game.
- The player gets a hint of how long the word is by counting the lines were the correct letters later will be placed.
- Each correct letter is being placed in the correct order of the word.
- Accept user input.
- Maintains how many lives the player has left.
- Maintains which letters the player have guessed.
- Responds "Wrong!" if the player guesses the wrong letter.
- A hanging man viusalize how many guesses left before the game ends.
- Input validation and error-checking.
- You can only enter letters. Not other characters.
- You cannot enter the same guess twice.
- Allow players to also guess the word directly instead of each letter.
- Add a scoreboard of the best players.
I have manually tested this project by doing the following:
- Passed the code through pep8online without any bugs.
- Given invalid inputs when playing the game. For examples numbers and other characters.
- Tested in my local terminal and the Code Institute Heroku Terminal.
Solved Bugs
- When I tested the game I found out that it did not have a return value at the end of the game. So everytime the game ended "None" got printed on the screen.
- I fixed this bug by calling the start_game() function again.
- No bugs remaining.
- No errors were returned when testing all three files.
This project was deployed using Code Institute's mock terminal for Heroku.
- Steps for deployment:
- Clone this repository.
- Create an account and a new app on Heroku.
- Configure vars with "KEY" in port and "8000" as value.
- Set the buildpacks to python and nodeJS in that order.
- Connect Heroku to Github.
- Connect and deploy the repository.
- Tom on stackoverlow.com.
- Tutor support on Code Institute.
- FreeCodeCamp.org with this video: https://www.youtube.com/watch?v=8ext9G7xspg
- Kite with this video: https://www.youtube.com/watch?v=m4nEnsavl6w