Hangman Python3 Command Line application. It's a guessing game where the User tries to guess a random word in a certain number of guesses.
The last update to this file was: August 22, 2022
You can find the live project here
After the user has registered or logged-in in the main menu the user is brought to the game. A random word from a word bank is generated every new game. The aim is to guess a secret word before spending the 7 lives given. If the user guesses the word before that he/she wins the game, if not the user dies and losses. Find out more about hangman in wikipedia
User stories - as user I want to able to:
-
easy navigate the application
-
register and login into the application
-
be greeted by my chosen username
-
exit the app during registration or login process if I chose so
-
be challenged with a different word every time I play the game
-
see feedback of my progress during the game
-
play again without having to login again
Main menu
- The main menu is displayed when the application starts. Simple an easy to to understand: 1. New user registration , 2. User login , 3. Exit.
- Validation message if user enters other that 1,2 or 3.
Registration
-
User is prompted to enter username and password that meets the requirements.
-
Validation message appears if invalid input is entered.
- Validation for username already taken.
Hangman game
- Features: random word, validates right input, lives countdown, display already guessed words, graphics.
Languages, External Libraries and Programs Used
- Python 3
- High level language used to build this project version 3.8.11
- Random
- Return a random element from the non-empty sequence.
- String
- The uppercase letters 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
- Time
- From time this app uses sleep to pause between screens.
- Gspread
- gspread is a Python API for Google Sheets.
- Sys
- System-specific parameters and functions.
- Github
- GitHub is the site used to store the source code for the Website.
- Git
- Git is the version control software used to commit and push code to the GitHub repository where the source code is stored.
- Visual Studio Code
- VS Code for short is the integrated development environment (IDE) software used to build the website.
- Lucid chart
- Lucid chart was used to create flowcharts of the project.
- Heroku
- Used to deploy the application and provides an environment where the code can be executed.
- Image converter
- Used to resize the images used in the project.
Solved bugs
- Problem: Registration of the same username multiple times.
- Fix: Added function that validates if username already exits.
- Problem: Username validation not triggered.
- Fix: Syntax error in list comprehension.
- Problem: Infinite loop during registration and login.
- Fix: Add a quit command to exit the loop.
- Problem: Accidentally pushed the users CSV database to Github,
but the accounts whose passwords were on Github were test accounts.
- Fix: They have so far been removed.
- Problem: Unable to retrieve CSV users data from Github to Heroku.
- Fix: Implement Google sheet API as database.
Steps taken to deploy
-
Create an account if necessary and log in.
-
Once in the Heroku dashboard, click on New dropdown menu button (top right side) and Create new App.
-
On the Create New App page, enter a name for the application and select your region. Then click Create app.
-
You will then be brought to the Application Configuration page for your new app.
-
Scroll down the Settings page to Buildpacks:
- Click Add buildpack, select Python from the pop up window and click on Save changes.
- Click Add buildpack again, select Node.js click on Save changes. It is important that is done in that order Python first, then Node.js beneath.
- Click on the Deploy tab on the Application Configuration page.
- Select GitHub as the Deployment Method.
- Enter your Github username and your Github repository name (in this case https://github.com/JoseMGuerra/hangman-pp3-py) and click on Connect to link up the Heroku app to the GitHub repository code.
-
Scroll down the page and there are to options, either Automatically Deploy each time changes are pushed to GitHub, or Manually deploy - for this project Automatic Deploy was selected.
-
The application can be run by clicking on the Open App button at the top of the Application Configuration page.
-
The live link for this project is https://hangman-pp3-py.herokuapp.com
- Python documentation
- Free code camp
- Stack over flow
- W3Schools documentation
- Geeks for Geeks
- Love sandwiches project
- Thank you to my mentor Brian Macharia for guiding me and for his invaluable advice.














