adamgilroy22 / python-hangman

Portfolio project 3 for Code Institute's diploma in software development
1 stars 4 forks source link

Hangman - Portfolio Project 3

Mockup

This is Python terminal game of Hangman and is deployed on Heroku using Code Institute's mock terminal template.

Users enter their name and location before being brought to the main menu where they can start a game, view the rules or look at the leaderboard. After choosing to start the game they must choose their difficulty and begin guessing letters or words until either the word is found or they run out of lives. The number of lives is determined by what difficulty they choose.

If the user gets the word correct they gain points depending on their difficulty level and length of the word. Easy gets you 1 point, normal 2 points and hard 3 points. The user is given an additional point if their word is longer than 6 letters. After the game is finished the user is given the choice to either play again or quit the game and the user can play the game as many times as they want with their points adding up after each game. If a user loses a game and their score is more than 1, they will lose 1 point.

On exit of the game, the user's score is checked against the current leaderboard and the user is told whether or not they made the top 10.

The live deployed application can be found at Python Hangman.

Final Grade: Distinction

UX & Design

User Stories

Flowchart

I made this flowchart before writing my code to give myself a clear view of what needed to be implemented as I wrote the program. It clearly indicates the layout and structure of the program including where the user needs to be asked for input, where the computer much check the input and how to handle invalid inputs, where the program should subtract the user's lives and add to the user's score.

Flowchart

Data Model

I wanted to include an object oriented class in this project so I created a Player class to do so. I used Real Python to help me achieve this.

class Player:
    def __init__(self, name, place, lives, score):
        self.name = name
        self.place = place
        self.lives = 7
        self.score = 0

Favicon

I included a favicon that I deisgned on Canva to enhance the user experience.

Favicon

Colour Scheme

As this program was built for the terminal, there wasn't much in terms of design or colour but I did use Colorama to add a bit of colour where I felt was needed within the terminal to make certain parts stand out to the user.

Features

Welcome Screen

Main Menu

Rules

Leaderboard

Difficulty Menu

Game Start

Wrong Guess

Right Guess

Wrong Word Length

Letters Guessed

Already Guessed

Orange Warning

Red Warning

Game Over - Lose

Game Over - Win

Restart Game

New Game

Didn't Make Leaderboard

Made Leaderboard

Invalid Input

Features Left to Implement

Technologies Used

The following is a list of the technologies I used on this project.

Imported Libraries and Packages

Testing and Validation

View Testing and Validation here.

Bugs

I used GitHub's issues section to track and manage any bugs that I found during the development and testing of my program. I currently have 0 open bugs and a history of the bugs I tackled can be found here

Bugs

Deployment

Code Institute has provided a template to display the terminal view of this backend application in a modern web browser. This is to improve the accessibility of the project to others.

The live deployed application can be found at Python Hangman.

Local Deployment

Gitpod IDE was used to write the code for this project.

To make a local copy of this repository, you can clone the project by typing the follow into your IDE terminal:

Alternatively, if using Gitpod, you can click below to create your own workspace using this repository.

Open in Gitpod

Heroku Deployment

This project uses Heroku, a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud.

Deployment steps are as follows, after account setup:

Heroku needs two additional files in order to deploy properly.

You can install this project's requirements (where applicable) using: pip3 install -r requirements.txt. If you have your own packages that have been installed, then the requirements file needs updated using: pip3 freeze --local > requirements.txt

The Procfile can be created with the following command: echo web: node index.js > Procfile

For Heroku deployment, follow these steps to connect your GitHub repository to the newly created app:

The frontend terminal should now be connected and deployed to Heroku.

Credits

Code

Content

Design

Acknowledgements

I would like to give special thanks to my mentor, Tim Nelson for his guidance during the development of this project.