Skip to content

JohnPetros/clean-hangman

Repository files navigation

Clean Hangman ➰


🖥️ About the project

Hangman is a classic game in which the player guesses a word of a certain category within a limited number of attempts.

The base code itself follows the concepts of Clean Architecture proposed by Uncle Bob in his book. Therefore, it conscerns to separate the core business logic (rules of the game) from any external factors like frameworks, libraries, environment, and UI. This separation consequently enhaces the maintainability, scalability and testability of the project in the long run.

The project is divided into three packages: core, CLI and GUI. So, this allows user to choose their preferred application for playing the game, whether by command-line interface or graphical interface.

⏹️ Preview

Command-line Interface
CLI app preview
Graphical Interface
GUI app preview

✨ Features

  • User should choose the category from which a random word will be generated by the app
  • User should have up to five attempts to get the word correct:
  • User should be able to reset the running game at any time
  • App should add a limb to Hangman for each incorrect user guess
  • App should display the user's left attempt count
  • App should prevent already used letters
  • App should display what letters are correct and incorrect throughout the game
  • App should display a end game message to user, adapting it based on whether user won or not
  • App should validate any input from user, displaying an error message if any
  • GUI app should listen to keyboard click and press events

⚙️ Archtecture

📦 Packages

  • Core for protecting and encapsulating all the rules of the hangman game

  • CLI throughout the entire CLI application codebase.

  • GUI throughout the entire GUI application codebase.

🛠️ Technologies

This project was developed using the technologies bellow:

  • ✔️ Python for writing the code of all applications

  • ✔️ Typer for building the CLI application

  • ✔️ Rich for writing rich text to the terminal, and for displaying advanced content such as tables

  • ✔️ Flet for building multi-plataform GUI application powered by Flutter

For more details on the projects dependencies like specific versions check out the package.json file


🚀 How to run the application

🔧 Prerequisitives

  • Git for manipulating Git repositories
  • Python for installing the dependencies and running the application using pip, the official packange manager for Python.

Also it is good to have a code editor like VSCode if you feel like writing the code base for any reason.

🏗️ Setup the project

# Clone this repository
git clone https://github.com/JohnPetros/clean-hangman.git

# Access the project directory
cd clean-hangman

🖥️ Running the application

Using script 📟

# For Linux
chmod +x start-app.sh

./start-app.sh start # For starting the CLI application
./start-app.sh gui # For starting the GUI application


# For Windows
icacls start-app.bat /grant Everyone:F

start-app.bat start # For starting the CLI application
start-app.bat gui # For starting the GUI application

Using Docker 🐳

# CLI app
docker run --it joaopetros/clean-hangman:2.0 start

# GUI app
docker run --port 8000:46857 joaopetros/clean-hangman:2.0 gui

The GUI application will be running on localhost:8000


Deploy 🚚

📦 Bundle

The executable bundle of the app are available to download for:

🖥️ Site

The GUI web application can be used online by https://clean-hangman.onrender.com/ which is hosted by Render plataform via Docker container.


💪 How to contribute

# Fork this repository
$ git clone https://github.com/JohnPetros/clean-hangman.git

# Create a branch for your feature
$ git checkout -b my-feature

# Commit your changes
$ git commit -m ' ✨feat: my feature'

# Push your branch
$ git push origin my-feature

You should replace 'my-feature' wuth your feature's name that you adding

You can also open a new issue reporting some problem, question or sugestion about the project. I will really be glad to help and improve this project as well


📝 Licence

This application is under MIT licence. See the licence file to obtain more details about it


Made with 💜 by John Petros 👋🏻