Giter VIP home page Giter VIP logo

python-portfolio-project's Introduction

Hangman python game!

View the live project here

USER EXPERIENCE

  • First of all, I want the user to simply enjoy a very simple game of hangman, which should run without issues, and if any unnacceptable guesses are entered an appropriate message will be displayed to tell the player of what they must do in order to get a valid guess, for example "The letter must be from a-z"
  • Secondly, I want the player to be able to play the game a couple of times without getting the same five words in a row, hence time and random was imported and then a function was used to seed the randomness into the game, making it seem like the computer chooses a word randomly from the list of words it has been given
    • Thirdly, I want the player to have an easy time differentiating between what is the hangman drawing and where they can input their guess. Hence appropriate guiding text will show where the input will be, as well as if a letter is guessed incorrectly it will be dislpayed above, so the player will know what they have already guessed.

    Design

    The design is rather simple, as it is a game run only in the commandline interface created only using python, with no HTML and CSS as a backbone, however using the keys on the keyboar the hangman was "drawn" with the style of ascii to provide visual support of how many tries/lives the player has left before they either loose the game or win it.

    FEATURES

    This is a simple game of hangman played in the terminal of the code, the game chooses a random word from the file called listofwords.py (the randomness is seeded into the code using the imports of time and random to build a randomness function). The words will, before any guesses, be displayed by dashes to show how long the chosen word will be. depending on if the guess from the player is incorrect or correct it will be appended to either the correct list of words or the incorrect list of words. The computer will compare the guesses to the chosen word and if the player guesses all the letters before all the lives has been lost (aka the hangman has been fully drawn) the game will display a "You win!" message, if not guessed before the hangman has been completeda different message will be displayed telling the player of their loss.

    • An appropriate message will show for the user if an invalid input has been made
    • A hangman will be drawn everytime the player makes an incorrect guess, until there are no lives left and the player will loose
    • The list of words used in the game is in a separate file for a cleaner look when there are a larger amount of words

    TECHNOLOGIES

    Languages

    • Python

    Frameworks, libraries and programs used

    Git was used to commit to git and then pushed to github using the gitpod terminal

    Github was used to store the code for the project after it was pushed from git.

    Python template from Code Institute was used to import and install the necessart libraries and other good files to make a good up and running python project

    Heroku was used to deploy the project

    TESTING

    PEP8 checks the projects code, both the listofwords.py file and the run.py file, was run through the pep8 online check without any notifications of any errors


    The code was also continuously debugged inside gitpod, there are some warnings still active, which react to there being no assigned value to the global variable, but as the game runs these variable will update and the game runs smoothly, so I have decided to not mind these warnings as there has been no proof of them causing trouble for my project code.


    There is also some infos active which wants there to be a change in the naming style of the global variables, which I have decided against as the lower case naming style works just as well for this project, and makes (for me), an overall much cleaner look.


    While in the early stages of testing my code in the terminal, no area for input was given and the game started, but couldn't be played by the user, this was solved by changing from the recommended enumerate function to an range(0, len(accepted words)) function. This is pointed out in the infos when debugging, but as the recommended enumerate would not work with this project I have decided to not use that recommendation and instead keep to the range fuunction previously mentioned.

    Another issue I ran into was that no matter if the letter was correctly guessed or not the computer would not count it as correct, and hence the player could only ever loose the game. This issue was solved as I found a typing error where I had mistakenly written append.lower() instead of the append.upper(). This made the computer compare two different things as it is case sensitive, once that was fixed the game ran smoothly without any issues.

    DEPLOYMENT

    Github pages and Heroku

    1. Log into github and locate the Github Repository
    2. After creating a heroku account, add the necessary Config_vars and buildpacks so that the app can be deployed
    3. choose github for deployment method, and after linking the account search for the repository name and press connect
    4. then scroll down and choose enable automatic deploys so that the app will run when the code is updated

    CREDITS

    As this project is a resubmission I was a little short on time, so I chose to follow a tutorial for a hangman game on youtube but making a different list in a separate file, the words used for the game is different and so are the names of the definitions and style of comments as well.

    1. tutorial from CS students This is the tutorial which I followed to get a working hangman game for this python project
    2. tutorial from kite This tutorial gave me the idea of creating a second python file which contains the words of which the computer will randomly choose from, but the contents of the list are my own.
    3. Python template was referenced to create an appropriate readme.md file for this project

    Acknowledgments

    1. My mentor for continous support throughout this project
    2. Friends and family for proof reading and testing my project to see if it works as a player and not the creator
    3. The Code Institute student care team for the help with resubmission

python-portfolio-project's People

Contributors

ebbastrandholm 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.