Giter VIP home page Giter VIP logo

python-hangman-3's Introduction

Hangman Game (Python)

Goals for this Project

The purpose of this project is to provide a fun interactive game of hangman for users to play. A random word will be selected from a large list of words and the users will have to guess letters in order to win the game. If they guess incorrectly too many times, they will lose.

All of the code for this project will be written in python.

Live Project

View the live project here.

UX

User Goals

  • Easy to understand how play
  • Fun to play
  • Test their vocabulary

User Stories

  • As a user, I want to easily understand how to play the game
  • As a user, I want to be able to test my vocabulary on a wide range of words
  • As a user, I want to easily be able to play the game over and over again without much wait time in between games

Site Owner Goals

  • Provide a game that is easy to play
  • Have a large number of words that are randomly selected
  • Make the game challenging by giving the user a limited number of lives

Requirements

  • Visual image of the hangman changing to represent letters guessed incorrectly
  • Option to play again after finishing game

Design

Flowchart

The flowchart below shows the logic of how the game will be run from the beginning of the game to the end of the game.

Features

Existing Features

Start Screen

  • The start screen show a simple command for the user to get the game started.

The Game Begins

  • The game begins and users are shown an image where the man will be hung if they lose lives.
  • Beneath this the users are shown several hyphens which represent how many letters are in the word they have to guess.
  • Finally, there is a prompt indicating the user to enter a word or letter.

User Input Responses

  • If the user inputs a letter that is incorrect, there will be a message to tell them and the image of the hangman will be added to.

  • If the user inputs a letter that is correct, there will be a message to tell them and the image of the hangman will remain the same as before.

    • If the user inputs a word that is incorrect, there will be a message to tell them and the image of the hangman will be added to.

  • If the user inputs an invalid guess such as an invalid character, too many or too little letters in a word or nothing at all, they will be prompted with an invalid message a be told to try again. They will not lose a life for this.

  • If the user already used a letter or word, they will be prompted with a message telling them to try again. They will not lose a life for this.

Winning and Losing

  • If a user gets the word right, they will be prompted with a message telling them.

  • If a user runs out of lives, they will be prompted with a message telling them that they lost and the word they were guessing will be revealed.

Play Again?

  • If the user wants to play the game again, they must type "YES" and click enter. The game will then be restarted.

  • If the user does not want to play the game again, they may enter any key and the game will exit.

Features to be Added

  • Levels of difficulty (More/Less lives)
  • Countdown timer option
  • Multiplayer mode (Two hangmen take turns guessing letters/words)

Technologies Used

Languages

Tools

Testing

Code Validation

PEP8 was used to test all of the python code.

The results are given below:

functions.py

hangman.py

run.py

words.py

Bugs

  • I had some issues with the while loop as when I entered characters that weren't letters such as: / ? ! etc. the game would accept them as an entry, even though I only wanted alphabet characters to work. I used w3schools to help me solve this issue.
  • When I used "break" and "exit()" on the if/else statement which asked users to play again, I could only enter "YES" and have it work once. The second time the game ended it would automatically exit. To solve this I removed both "break" and "exit()" and it functioned perfectly.

Unfixed Bugs

There are no unfixed bugs.

Deployment

The app was deployed using Heroku

  • Log in to Heroku (or create an account if necessary).
  • Click on New in the Heroku dashboard and select ”Create new app”.
  • Give the application an original name, choose your region and click “Create App”.
  • In the settings tab for the new application enter two Config Vars (if necessary):
    • One is CREDS and contains the credentials key for Google Drive API.
    • One is PORT and has the value of 8000.
  • Two buildpack scripts are to be added: Python and Nodejs (in that order).
  • Go to "Deploy" section, and click the Github icon in 'Deployment Method' and connect github.
  • Set the project to 'Automatic Deploys'.
  • The app will then be deployed and you will be provided a link to it.

Credits

Useful Resources

python-hangman-3's People

Contributors

danieljjb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.