Skip to content

Hangman - console game. PC thinks of a word, and you tries to guess it by suggesting letters within a certain number of guesses.

Notifications You must be signed in to change notification settings

ukrmaxim/hangman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hangman

Hangman is console game. PC thinks of a word, and you try to guess it by suggesting letters within a certain number of guesses.

Requirements

  • Windows 10 x32/x64 or Ubuntu 20.04 LTS or macOS Big Sur
  • Ruby 2.7.2 or higher

Installation Ruby

Quick start

Before run the app, on command line/terminal, go to the directory, where you clone repository and type in the following command:

bundle

To run the app, on command line/terminal, go to the directory, where you clone repository and type in the following command:

bundle exec ruby main.rb

Rules of the game

The computer guesses a word (a random word selected from a file). The player enters a letter that can be included in this word. If such a letter is in a word, the computer displays it as many times as it appears in the word. If there is no such letter, the computer counts the error and a circle in the loop representing the head is added to the gallows. The player then continues to guess the letters until he guesses the whole word. For each wrong answer, the computer adds one part of the torso to the gallows (head, neck, torso, 2 arms and 2 legs). If the torso in the gallows is drawn completely, then the player loses and is considered hanged. If the player manages to guess the word, he wins. 7 mistakes are allowed.

Instructions how to add words

In order to change or add the words that the computer thinks, you need to edit the words.txt file, which is located in the hangman/data folder. Each word is written on a new line.

About

Hangman - console game. PC thinks of a word, and you tries to guess it by suggesting letters within a certain number of guesses.

Topics

Resources

Stars

Watchers

Forks

Languages