Hangman is a letter based guessing game where the player has a limited number of tries to guess a word by choosing a single letter at a time. If the player guesses a correct letter then they continue being allowed to guess further letters. If they guess an incorrect letter their number of attempts is decreased. The object of the game is to guess all the letters contained in a word to spell the entire name without losing all of your lives.
- Project Goals
- User Experience
- Structure
- Technologies Used
- Features
- Testing
- Validation
- Bugs Fixed
- Deployment
- Credits
- Able to play a game of hangman
- Clearly know how many guesses remain
- Clearly shown if win the game
- Clearly shown if lose the game
- Fun easy experience of playing
- Give the user variation of the word to guess (Boys names v Girls names)
- Provide the user a limited number of attempts at guessing letters with an update to the number of remaining attempts
- Provide positive feedback for a correct guess
- Provide feedback for an incorrect guess
- Account for user input being in lower or uppercase
- People wanting to play an online game
- People with spare time and access to a computer
- People who enjoy logical quizzes
- People who enjoy guessing games
Before starting the website I used a flowchart design tool called Lucid Charts to mockup a flow of information.
- Python
- Git
- GitHub
- Gitpod
- Paint.NET
- Lucid Chart
- Heroku
-
Choice of boys name or girls name
- The user can decide which gender of name they wish to guess
-
Good luck message
- The user is displayed a good luck message
-
Word shown as underscores
- The user is displayed a the word with the letters replaced by '_' to show the length of the word
-
Enter a letter area
- The user is displayed an 'enter a letter' phrase and an area to enter said letter
-
Invalid entry
- The user is displayed a message to advise of an invalid entry when a letter is not the input
-
Duplicated guess
- The user is displayed a message to advise they have already tried to guess that letter
-
Correct guess
- The user is displayed a message to advise they have correctly guessed a letter. With the underscore transforming into the guessed letter where applicable
-
Incorrect guess
- The user is displayed a message to advise they have been unsuccessful at guessing a letter
-
Tries counter
- The user has a limited number of guesses which is displayed when an incorrect letter is guessed
-
No more tries
- The user has a limited number of guesses which ends the game when this number runs out
-
Correct word
- The user is shown a congratulatory message and the word when they guess all the letters
-
Play again
- The user has the option to play again when the game has been completed
- Add a username
- Tested choice of list works - Choosing Boy list or Girl list
- Tested inputting a number would throw an error and inform the user input was invalid
- Tested inputting a valid guess
- Tested for inputting a correct guess and showing the correct message on screen
- Tested for inputting an incorrect guess and showing the correct message on the screen
- Tested for running out of attempts at guesses and being shown the correct message on screen
- Tested for completing the word and being shown the correct message on screen
- Tested for wanting to play again
- Tested for not wanting to play again
The website was tested on the following devices:
- MacBook Pro
- MacBook
The website was tested on the following browsers:
- Chrome
- Safari
- Edge
Code validation completed by PEP8 and returned no errors
- Lowercase letter issue
- When inputting the initial decision for choosing a boy or girl name the if statement was not catching the decision. Utilised the .upper() function in Python to ensure the decision was a capital regardless of user decision
- If statement order of running
- When checking for if a user had already attempted a guess at that letter the if statement was incorrectly sequenced so the program congratulated the user. By switching the order of checking the if statement catches a previously guessed letter
The website was deployed using Heroku by following these steps:
- Log into Heroku
- Select Create New App
- Name your app and select location
- Enter the settings tab. Add the required buildpacks
- From the settings tab add the required Config Vars
- Select the Deploy tab. Connect to your required GitHub repository
- From the Deploy tab scroll to the bottom and select 'Deploy'
You can for fork the repository by following these steps:
- Go to the GitHub repository
- Click on Fork button in upper right hand corner
You can clone the repository by following these steps:
- Go to the GitHub repository
- Locate the Code button above the list of files and click it
- Select if you prefer to clone using HTTPS, SSH, or Github CLI and click the copy button to copy the URL to your clipboard
- Open Git Bash
- Change the current working directory to the one where you want the cloned directory
- Type git clone and paste the URL from the clipboard ($ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY)
- Press the Enter key to create your local clone.
The live link can be found here - https://ci-pp3.herokuapp.com/
- The responsive design cover was made using Am I Responsive?
- The flow diagram was made using Lucid Charts