My Hangman game is based on logic: one player at the time. It's a Python terminal game, which runs in the mock terminal created by Code Institute and is deployed on Heroku. My game contains functions to check if the user input is valid, to avoid any kind of confusion in the game flow. The player can guess only one letter at the time or, if lucky, the whole word. If case the guessed a letter is a duplicate or triplicate, all the empty blanks will be fill-in or in case of repeated guess a warning message will pop-up in the mock terminal. Once the max number of attempts is reached and the player fails to guess the word, then the game is lost and it's a game over.
The goal of this project is to put together everything I have learned throughout the past month. Combined from, Python Essential modules by CI and the things my mentor has showed me, this project is a demonstration of my knowledge acquired throughout the Python course and 'Love Sandwiches' walkthrough project.
You can view the live deployed game here: Hangman_Game
- Objective
- User Experience
- Hangman Flow Chart
- Features
- Future Features
- Technologies Used
- Testing
- Deployment
- Lighthouse
- Bugs
- Credits
- Acknowledgements
With this project I want to deliver a fully interactive, user friendly fun command line game.
- The player wants to feel welcome to play.
- The Player wants to be able to input their name and receive a feedback if the data is invalid.
- The Player wants to know the number of attempts in total and attempts left.
- The Player wants to know the already guessed letters/words and get notified if the letter/word has been already guessed.
- The player wants to have a clear message about the state on the end of the game.
- The player wants to be able to choose if they wanna play further or quit.
A flow-chart was used for mapping-out the necessary steps throughout the implementation process of this game. A free sign up with Lucid Chart helped in creation of this map.
My game displays the following features:
- Home Page and the latest five results from the result sheet
- Game Stages
- Exit Game
- The home page displays the latest five results from the hangman_game sheet, the name and ASCII art of the game and welcomes the user.
- User will be asked to input their username to continue and once they hit the ENTER, the player will be greeted bu seeing their name being displayed.
- Once the game begins, the user will be able to see all the stages of the game after each attempt, these are:
- Random word displayed with underscores
- List of incorrectly guesses letter(s) or word(s)
- The number of incorrect attemps
- Error messages if the player makes the wrong selection
- The option to play again
- This game could have a menu option to offer a player more, such as a choice of picking a language or a difficulty level for the game as well as list of instructions to make it more interactive and more fun.
- This feature would improve the game and add a level of difficulty to it.
-
Git by utilizing the Gitpod terminal for version control.
-
GitHub used to store the project once pushed from Git.
-
Heroku used for deploying the application.
-
Lucid Chart to map the game's flowchart.
-
CI Python Linter to find indentation errors in Python.
CI Python Linter online validation used to check if the code is meeting the standard. All checked in Linter, no remaining errors.
- The project was deployed using Code Institute's mock terminal for Heroku.
- Log into Heroku (create an account if you don't have one)
- Pick the 'Create new app' option from the dashboard.
- Enter your application name - this name has to be unique - select your region and then click "Create App"
- This will bring you to your project page. From here, click the "Settings" tab and scroll down to Config Vars.
- In the KEY input field, enter "PORT" and in the VALUE input field, enter "8000".
- Click the "Add" button to the right to add the Convig Vars.
- Repeat the same step one more time but this time enter "CREDS" in the KEY and under VALUE copy/paste your credentials from CREDS.JSON file and press "Add".
- On the same page scroll down to the buildpacks section and click "Add Buildpack"
- Add both the Python and node.js buildpacks but make sure that the Python buildpack is above the node.js one
- Go back to the tabs at the top of the page and this time select the "Deploy" tab.
- Select Github deployment method.
- Search for your repository name and click the "Connect" button to link your chosen repository
- At the bottom of that page, select your preferred deplyment type; Automatic Deployment or Manual Deployment and wait a few minutes for your project to be deployed.
- I have a known bug in my result display, in which the Wrong_guesses and Result are displayed weirdly due to length of random word.
- While testing the game I discovered I had no function to check if the whole word was guessed and if the one was correct or not, plus function to decrement the number of incorrect guesses.
- While testing the game in CI Python Linter I came accross a bug "Invalid escape sequence '' (W605)" which required just adding a sigle letter r in front of quotation mark. I found a solution on:
-
Code Institute's 'Love Sandwiches' project, was a nice walkthrough and it has helped me a bit in creating my own game.
-
Alumni's old projects has been a good reference for ideas and thoughts for this project portfolio, mainly the projects posted on Linkedin.
-
A few online pages and tutorials that inspired the whole idea together:
- Python Tutorial: Object Oriented Hangman
- What Does if name == "main" Do in Python?
- Python Tutorial
- How To Use LucidChart
- The README template provided by Code Institute from "Portfolio Project Scope".
- Specially grateful to my mentor Antonio Rodriquez, I really appreciate all the help, guidance and patience throughout the mentoring sessions.
Happy coder :)