A classic, lightweight word-guessing game built in Python. Designed for the terminal, this version of Hangman focuses on clean logic, interactive gameplay, and that nostalgic "low-fi" terminal aesthetic.
Dynamic drawing of the hangman as you progress through incorrect guesses.
Runs directly via Python using standard libraries - no 'pip install' required.
Fast, keyboard-driven interface optimized for terminal enthusiasts.
Code is organized into three distinct files (Logic, Art and Words) for better readability.
Includes a dedicated word list file, making it easy to add or customize categories.
Open your terminal and clone this repository:
git clone https://github.com/rhitamcoder/gallows.git
(Alternatively, click the green Code button on Github and select Download ZIP.)
If you want to play the game by simply typing 'gallows' from any folder in your terminal, follow these steps into a new terminal window:
mv gallows .gallows
sudo nano /usr/local/bin/gallows
#!/bin/bash
cd /path/to/.gallows/ && python3 hangman.py
Press 'Ctrl+O', 'Enter', then 'Ctrl+X'.
sudo chmod +x /usr/local/bin/gallows
Simple open your terminal and type:
gallows
If you did not set up the global command, simply navigate to the folder and run:
python3 hangman.py
1. The Objective: Guess the hidden word one letter at a time before the hangman is fully drawn.
2. Input: Type a single letter and press 'Enter'.
3. Feedback: The game will show you your correctly guessed letters and a list of missed attempts.
4. Win/Loss: If you complete the word, you win! If the hangman is finished (after 6 wrong guesses), the game is over.
Python 3.x: Works perfectly on any system with Python installed.
Linux/Unix Optimized: Tested on Arch, Ubuntu, Fedora, Mint, (Any Ubuntu-based distros) & MacOS.
This project was a deep dive into Python logic loops and string manipulation. It's a tribute to the classic "pen & paper" games, reimagined for the command line to prove that you don't need a heavy GUI to have a fun, polished experience.
By building this CLI game, I focused on:
1. Input Handling: Managing user errors and ensuring the game doesn't crash on weird inputs.
2. Game State Management: Keeping track of lives, guessed letters, and the hidden word simultaneously.
3. Terminal UI: Using ASCII arts to provide visual feedback within a text-only environment.
Feel free to Fork this repo to add your own word lists or custom ASCII art designs!