Skip to content
Ruby HTML CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
public
views
Gemfile
Gemfile.lock
README.md
config.ru
dictionary.txt
hangman.rb

README.md

Hangman

A web version of the classic Hangman guessing game. A secret word is generated upon initialization. You have ten guesses to complete the word or you're hanged.

Installation

To play online go here Heroku

To run the game locally, first clone the repository in your command line, then enter the following:

$ cd hangman
$ ruby hangman.rb

Go to localhost:4567 in your browser.

Running

The game is written in Ruby and uses file I/O to load a secret word from a dictionary file. It will only accept letters in the guess input, and won't allow the user to re-enter letters he/she has already guessed. If a letter is entered that is in the word, that letter will take it's appropriate place in the secret word as well as be added to the correct guesses list. The user will not lose a turn. Incorrect guesses will be added to the incorrect guesses list and the turns will decrement by one.

If the word is completely filled out or the turns get down to 0, a game over message will appear prompting the user to start a new game.

Acknowledgments

The Odin Project

You can’t perform that action at this time.