Skip to content

wierdlygoodcoder/hangman

Repository files navigation

HANGMAN The Word Guessing Game

The hangman game is a python terminal game that is running the code institute mock terminal on Heroku.

This game allows users to guess words from a dictionary of a preset word for 3 difficulties easy, normal, and hard. The game also has lived and you can try to play up to 6 times before the game will say that you fail.

Screenshot 2022-05-14 013151

How To Play

The rules for hangman are simple you can only use letters and nothing else and only guess one letter at a time.

This game also has the extra rule that all letters must be the lower case when guessed and the game will turn the first letter in the word into a capital.

The way this game plays will tell you how many tries you have and how many letters you have to guess.

You win by guessing the word that the computer has chosen for you in that game.

Features

Existing Features

  • Choose your difficulty:
    • The player is asked to choose from the three difficulties.

Screenshot 2022-05-14 014950

  • Once the difficulty is chosen the player is then asked to put in a letter.
    • If the player puts in anything but a letter the game will ask for a letter.

Screenshot 2022-05-14 020123

  • The player makes a correct guess the console returns their guess on the board.
    • The console then says they guessed correctly.
    • The game then asks them to guess again.

Screenshot 2022-05-14 020852

  • If the player gets the guess wrong they are told that it was wrong
    • That they have tried counting down from 6.
    • The game then asks for the player to retry.

Screenshot 2022-05-14 024512

  • When the player wins they have to guess each and every letter in the word one at a time.
    • When they do this the game says well done and the restarts letting them go again

Screenshot 2022-05-14 030156

  • When the player guesses wrong the game will give them 6 tries
    • After the 6th try the game will say that you lost
    • The game then tells the player what the word was.

Screenshot 2022-05-14 031409

Future Features

  • To have a visual hangman when the player goes through their lives.
  • Allow players to add words to the category.
  • Have topes within the difficulties.

Data Model

I have used functions to make this game by naming them so they can interact with each other.

I used the choose functionto allow the user to have the choice and then that passes the user's answers through. from there the choice the user made gives that choice a variable of secret_word.

From there the next function gives the user the ability to interact with the game allowing them to put in a letter. it also validates the user's choice and then if they use the alphabet the choice they make is passed on to the to see if it's in the secret word if it is the guess was correct if not then they get that answer. the function returns the next function until the player has completed the loop.;

The next function checks to see if the player has won or lost and if they have not then they return to the previous function.

Testing

  • passed the code through a pep8 tester there were no issues
  • invalid inputs do not work and ask for the user to put in a letter
  • tested my code in the code institute Heroku terminal

Bugs

Solved bugs

  • Corrected an issue that the serect_number arguments were in the wrong order to be called by the function so it gave them a number instead of a word
  • the game was only running 1 .5 was ending after guess so linked the last two functions and it now repeats until the correct answer or wrong answer is given.
  • lose count called in globally as was not being called.
  • loss count was not reduced before it was being printed

Remaining bugs

  • I would like to reset the tries after the program restarts as it continues with the number of tries you had from the previous game.

Validator testing

The application was put through pep 8 online check.

Screenshot 2022-05-14 035856

Deployment

To deploy this project I had to use Heroku to deploy. this was difficult to understand to start off but by the end I understand it. the steps I took to deploy the project were:

  1. used the console to log on to Heroku using the command: 'Heroku login -i'.
  2. still in the console I had to choose the correct Heroku app using the following command: 'Heroku apps'.
  3. after that I used the following command to select that app so that I could commit to it: Heroku git: 'remote -a hangmans'.
  4. this is where I put the commit message to both git and heruko:'git add. && git commit -m "input message here"'.
  5. here is where I push to both git and Heroku: 'git push origin main', 'git push Heroku main'.

Credits

  • Code institute for the deployment terminal
  • My mentor

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published