The program is a classic game "Hangman", where you need to guess the word with 7 attempts.
The program was created on the Ruby 2.5.1 .
You need to install Ruby interpreter in order to work with this program. ruby
The program uses such libraries (gems) as rspec and i18n.
Ensure that the library manager bundler is installed.
- Input in the cmd or terminal the following command:
gem install bundler
- After installing the library manager, input the next command in order to make sure that it was installed:
bundler -v
- Input the next command for installing the necessary gems before running program:
`bundle install`
- Input the next command for running program:
or
bundle exec ruby main.rb
where [locale] is a locale key. There are two locale keys in the program such as en and ru.bundle exec ruby main.rb [locale]
main.rb
- running program file../data/WordsEN.txt
or./data/WordsRU.txt
- text files, in which you can add new words and the program will take them from there../image/*.txt
- text images files files with text images (gallows) for different stages of the game.
You can create your custom locale. For example, you want to make an internationalization of the game in German.
Examine the content of other yaml files (e.g. en.yml
) in order to create your custom yaml file.
Then you need to commit the following steps:
- Create a new yaml file
de.yml
in the folderconfig/locales
. - Fill the file with necessary internationalization texts. The
template.yaml
file is located in theconfig/locales
folder. - Create a new txt file
WordsDE.txt
in the folderdata
for adding your words. - Create a new text file
HangmanLogoDE.txt
in the folder 'data' for showing game logo and fil him some text image. This step is an optional.
You can watch a demo version of the game at the link.
Kirill Ilyin, study project from goodprogrammer.ru