Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hangman-C

A classic Hangman word-guessing game for the terminal, written in C.

Guess letters to reveal the hidden word before the stick figure is fully drawn. Each wrong guess adds another body part — six mistakes and it's game over.

Features

  • 4 categories — Animals, Foods, Technology, Nature (60+ words total)
  • ASCII art gallows — 7-stage progressive drawing (6 mistakes + game over)
  • Color-coded output — green for correct guesses, red for wrong ones
  • Score tracking — win/loss tally across multiple rounds
  • Input validation — rejects non-letters and duplicate guesses
  • Portable C99 — compiles on Linux, macOS, WSL, and any POSIX system

Quick Start

gcc -o hangman hangman.c
./hangman

Or use the Makefile:

make
./hangman

How to Play

  1. Run ./hangman
  2. Choose Play from the menu
  3. A hidden word appears as underscores (_ _ _ _)
  4. Type one letter at a time and press Enter
  5. Correct letters are revealed in green
  6. Wrong letters add a body part to the gallows
  7. Win by guessing the full word — lose after 6 mistakes

Screenshot

Terminal Hangman

Building from Source

Requirements

  • A C compiler (gcc, clang, or tcc)
  • make (optional)

Compile & Run

make clean
make
./hangman

Project Structure

hangman-c/
├── hangman.c    # Main game source
├── Makefile     # Build automation
├── README.md    # This file
└── LICENSE      # MIT License

License

MIT — do whatever you like with it.

About

Classic Hangman word-guessing game for the terminal, written in C with ASCII art gallows, 4 word categories, and color-coded feedback

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages