The link to Noose Naught
Noose Naught is a Python terminal project and its purpose is to provide entertainment via a game of hangman. To those unfamiliar of the concept, hangman is a game whereby players guess a word with limited tries, otherwise it's game over and the man is hanged, hence the name.
- Click this link or copy this:
https://pp3-noose-naught-06bebcccec81.herokuapp.com/
and paste it in your browser's address bar. - Normally, the program should automatically run once the page has loaded. If not, click on the 'RUN PROGRAM' button on top.
- Read the game instructions on the game menu.
- Using the arrow keys, select a word category and hit enter to start a game, or select quit and hit enter to exit the program.
- I want to immediately understand how the program works without difficulty through intuitive navigation and controls.
- I want to be able to select different word categories to try out different challenges.
- I want to be able to quit and close the program from the game menu.
- I want to be notified if I have entered a wrong input and be told what type of input is needed.
- I want to be able to use hint and get the definition of the word in question to help me guess it.
- I want to be able to quit a game in progress and go back to the game menu.
- I want to know how many lives I had left after I have guessed the word correctly.
- I want to know how many letters I guessed correctly, as well as what the word in question was, after I have run out of lives.
- It contains a welcome message.
- It provides the game instructions.
- It gives options for three different word categories, as well as the option to quit and close the program.
- It displays the hangman stage.
- It displays blanks corresponding to the number of letters to guess.
- It displays the definition of the word if the hint was used.
- It lists the letters already entered for the user's reference.
- It shows the number of lives and hint available.
- It provides feedback in yellow depending on the user's input.
- It prompts the user to guess a letter.
- It shows the man escaping the gallows.
- It shows a congratulatory message, as well as the number of lives left.
- It informs the user that the program is going back to the game menu and to wait a moment.
- It shows the man hanged.
- It shows a consolatory message, as well as the number of letters guessed correctly and the word in question.
- It informs the user that the program is going back to the game menu and to wait a moment.
The flowchart below shows the logic of the application:
- Python 3.9.1: used to anchor the project and direct all application behaviour.
- JavaScript: used to provide the start script needed to run the Code Institute mock terminal in the browser.
- HTML: used to construct the elements involved in building the mock terminal in the browser.
- random was used to choose a random word from a list.
- os was used to clear the terminal at certain points of the logic flow of the application.
- time was used to add a few seconds of time delay to give users time to read messages, as well as to give an illusion of loading.
- Simple Terminal Menu was used to implement the game menu when choosing word categories and when confirming to use hint or when quitting.
- Colorama was used to add colours to some text.
- VSCode was used as the main tool to write and edit code.
- Git was used for the version control of the website.
- GitHub was used to host the code of the website.
- Canva was used to create the flowchart for the application.
- Code Institute's CI Python Linter was used to validate the PY files.
- Heroku was used to deploy the project.
Tests done are documented in the TESTING.md file.
Note:
- This project requires you to have Python installed on your local PC:
sudo apt install python3
- You will also need pip installed to allow the installation of modules the application uses.
sudo apt install python3-pip
Create a local copy of the GitHub repository by following one of the two processes below:
-
Download ZIP file:
- Go to the GitHub Repo page.
- Click the Code button and download the ZIP file containing the project.
- Extract the ZIP file to a location on your PC.
-
Clone the repository:
- Open a folder on your computer with the terminal.
- Run the following command
git clone https://github.com/marcgithub23/pp3-noose-naught.git
-
Alternatively, if using Gitpod, you can click below to create your own workspace using this repository.
-
Install Python module dependencies:
- Navigate to the folder pp3-noose-naught by executing the command:
cd pp3-noose-naught
- Run the command pip install -r requirements.txt
pip3 install -r requirements.txt
-
-
Clone the repository:
-
Open a folder on your computer with the terminal.
-
Run the following command
git clone https://github.com/marcgithub23/pp3-noose-naught.git
-
Create your own GitHub repository to host the code.
-
Run the command
git remote set-url origin <Your GitHub Repo Path>
to set the remote repository location to your repository. -
Push the files to your repository with the following command:
git push
-
Create a Heroku account if you don't already have one here Heroku.
-
Create a new Heroku application on the following page here New Heroku App:
-
Go to the Deploy tab:
-
Link your GitHub account and connect the application to the repository you created.
-
Go to the Settings tab:
-
Click "Add buildpack" and add the Python and Node.js buildpacks in the following order:
-
Click "Reveal Config Vars"
-
Add 1 new Config Vars:
- Key: PORT Value: 8000
- This Config was provided by CODE INSTITUTE.
-
Go back to the Deploy tab:
-
Click "Deploy Branch":
-
Click "View" to launch the application inside a web page.
-
- The following YouTube tutorials were consulted whose codes were adapted to my use case:
- The following YouTube tutorials inspired the menu design and logic of this project:
- This blog article was consulted for how to choose a random key from a dictionary.
- The YouTube tutorial How To Print Colored Text in Python (Colorama Tutorial) by Tech With Tim was consulted for how to implement colorama to change text colour in the terminal.
- Words and definitions were adapted from Google dictionary, which is provided by Oxford Languages.
I am indebted to Juliia Konovalova, my mentor, for her insightful guidance and advice throughout this project. Thank you.