Skip to content

Technozamazing/Hangman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Hangman Game

Welcome to the Hangman Game! This is a simple command-line-based implementation of the classic word-guessing game. Players must guess a randomly selected word one letter at a time, with a limited number of tries.

Features

  • Random word selection from a predefined list.
  • Case-insensitive guessing.
  • Tracks and displays previously guessed letters.
  • Input validation to prevent invalid guesses.
  • Clear feedback for correct and incorrect guesses.
  • Replay functionality to play multiple rounds without restarting the program.

Gameplay

  1. A random word is selected, and its letters are hidden (displayed as underscores _).
  2. Players guess one letter at a time.
  3. Each correct guess reveals the letter(s) in the word.
  4. Incorrect guesses decrease the number of remaining tries.
  5. The game ends when:
    • The player guesses the word correctly.
    • The player runs out of tries.
  6. Players can choose to play again after each round.

How to Run the Game

  1. Ensure you have a C++ compiler (e.g., GCC, Clang, or MSVC) installed.
  2. Copy the game code into a file named hangman.cpp.
  3. Open a terminal or command prompt and navigate to the file's directory.
  4. Compile the code using the following command:
    g++ -o hangman hangman.cpp
    
  5. Run the compiled program:
    ./hangman
    

Rules

  • Each player starts with 6 tries.
  • Guess one letter at a time.
  • Each incorrect guess reduces the remaining tries by one.
  • Guesses are case-insensitive (A and a are treated the same).
  • You win if you guess all letters in the word before running out of tries.
  • You lose if your tries reach 0 before guessing the word.

License

This project is open-source and available for modification and distribution. Contributions are welcome!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages