Exercise: Word Guess CSV

The goal of this exercise is to refactor the included word_guess.rb to get its words from the included words.csv.

Playing the Game

Run $ ruby word_guess.rb to start the game. Choose a difficulty level and then try to guess the word one letter at a time. You win when you complete the word, and lose if you run out of guesses.

Debug mode

The WordGuess initializer accepts an optional boolean. Pass true to put the game in debug mode, which will reveal the chosen word at the beginning of the game.

Requirements

  • Alter the game to get its words from the provided words.csv.
  • The CSV has three lines. The first entry on each line is the difficulty and every other entry is a word for that difficulty.
    • Example: e,cat,hat,bat,rat,sat,wat,nat,mat....
    • The e is the difficulty (easy mode).
    • Everything else is a word for the easy difficulty
  • The updated program should read the csv and select a random word from the appropriate difficulty.
  • No other gameplay changes are required.