The Hangman is a classic guessing game.
- Mutliple diffculty levels
- Easy, Standard or Hard
- Unique Hangman gallows design with progressive updates
- Save & Resume gameplay, never lose progress mid-game with autosave
- Visual alphabet tracker, showing used and available letters
- Colorized terminal output
- OOP structure
- Code design with i18n in mind (YAML locale files)
- Guess word is not stored in player savefile to prevent cheating
- Regex-based input validation
- Session management, supporting multiple concurrent games
A demo savefile is storeed in the data/ directory.
Follow the simple steps below to get started:
- Ensure that Ruby
v3.X.Xis correctly installed on your device. - Clone the repo to your device.
- Open the directory via the terminal:
cd rb-hangman/. - Installed the required Gems:
bundle install. - You are ready to launch the program:
bundle exec ruby main.rb.
Once you have launched the program, follow the steps below to start a game session.
- Launch Hangman with a launch command:
--play hangmanor-p hangman. - Read the How-to-play section to learn more about the game.
- Type
1to create a new player profile. - Give your profile a name.
- Select a level difficulty, e.g.,
2for standard. - A game session will start.
- Start guessing by typing a single character to the prompt.
- You can leave the game any time by typing the following command:
-q,--exit,--ttfn. - You can find the savefile(player name) in the
data/folder.
Load a session
- Launch Hangman with a launch command. (See above)
- Type
2to load save. - Type your player profile name
- If a savefile is found, your session is resumed.
- If a savefile is not found(or type a wrong name), a new profile will be created.
For more command, type -h or --help to print the command tips.
- Rubocop
- Colorize
- Yard
I have published my Hangman gallows design as a separate file here. Feel free to use it for your own project ;)

